NodePosition.java
001 /*
002  * NodePosition.java
003  *
004  * Copyright (c) 2004, The University of Sheffield.
005  *
006  * This file is part of GATE (see http://gate.ac.uk/), and is free
007  * software, licenced under the GNU Library General Public License,
008  * Version 2, June1991.
009  *
010  * A copy of this licence is included in the distribution in the file
011  * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
012  *
013  * Niraj Aswani 02/2002
014  *
015  */
016 
017 package gate.creole.gazetteer;
018 
019 /**
020  <p>Title: NodePosition.java </p>
021  <p>Description: This class is used to store the information about the
022  * changes in the text and the addition or the substraction of the spaces.
023  * It is used by FlexibleGazetteer. </p>
024  @author Niraj Aswani
025  @version 1.0
026  */
027 
028 public class NodePosition {
029 
030   /** The original start offset before changes */
031   private long oldStartNode;
032 
033   /** The original end offset before changes */
034   private long oldEndNode;
035 
036   /** The new start offset after the changes */
037   private long newStartNode;
038 
039   /** The new end offset after the changes */
040   private long newEndNode;
041 
042   /** total deducted spaces due to change in the text before the start
043    * offset in the document
044    */
045   private long deductedSpaces;
046 
047   /** Constructor */
048   public NodePosition() {
049   }
050 
051   /**
052    * constructor
053    @param osn - old start offset
054    @param oen - old end offset
055    @param nsn - new start offset
056    @param nen - new end offset
057    @param space - total deducted spaces due to change in the text before
058    * the start offset in the document
059    */
060   public NodePosition(long osn, long oen, long nsn, long nen, long space) {
061     oldStartNode = osn;
062     oldEndNode = oen;
063     newStartNode = nsn;
064     newEndNode = nen;
065     deductedSpaces = space;
066   }
067 
068   /**
069    * Returns the old start offset
070    @return <tt>long</tt> value.
071    */
072   public long getOldStartNode() {
073     return oldStartNode;
074   }
075 
076   /**
077    * Returns the old end offset
078    @return <tt>long</tt> value.
079    */
080   public long getOldEndNode() {
081     return oldEndNode;
082   }
083 
084   /**
085    * Returns new start offset
086    @return  <tt>long</tt> value.
087    */
088   public long getNewStartNode() {
089     return newStartNode;
090   }
091 
092   /**
093    * Returns the new end offset
094    @return <tt>long</tt> value.
095    */
096   public long getNewEndNode() {
097     return newEndNode;
098   }
099 
100   /**
101    * Sets the old start offset
102    @param node
103    */
104   public void setOldStartNode(long node) {
105     oldStartNode = node;
106   }
107 
108   /**
109    * Sets the old end offset
110    @param node
111    */
112   public void setOldEndNode(long node) {
113     oldEndNode = node;
114   }
115 
116   /**
117    * sets the new start offset
118    @param node
119    */
120   public void setNewStartNode(long node) {
121     newStartNode = node;
122   }
123 
124   /**
125    * Sets the new end offset
126    @param node
127    */
128   public void setNewEndNode(long node) {
129     newEndNode = node;
130   }
131 
132   /**
133    * Sets the deducted spaces
134    @param space
135    */
136   public void setDeductedSpaces(long space) {
137     deductedSpaces = space;
138   }
139 
140   /**
141    * Returns the total deducted spaces
142    @return <tt>long</tt> value.
143    */
144   public long getDeductedSpaces() {
145     return deductedSpaces;
146   }
147 }