| NodePosition.java |
1 /*
2 * NodePosition.java
3 *
4 * Copyright (c) 2004, The University of Sheffield.
5 *
6 * This file is part of GATE (see http://gate.ac.uk/), and is free
7 * software, licenced under the GNU Library General Public License,
8 * Version 2, June1991.
9 *
10 * A copy of this licence is included in the distribution in the file
11 * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
12 *
13 * Niraj Aswani 02/2002
14 *
15 */
16
17 package gate.creole.gazetteer;
18
19 /**
20 * <p>Title: NodePosition.java </p>
21 * <p>Description: This class is used to store the information about the
22 * changes in the text and the addition or the substraction of the spaces.
23 * It is used by FlexibleGazetteer. </p>
24 * @author Niraj Aswani
25 * @version 1.0
26 */
27
28 public class NodePosition {
29
30 /** The original start offset before changes */
31 private long oldStartNode;
32
33 /** The original end offset before changes */
34 private long oldEndNode;
35
36 /** The new start offset after the changes */
37 private long newStartNode;
38
39 /** The new end offset after the changes */
40 private long newEndNode;
41
42 /** total deducted spaces due to change in the text before the start
43 * offset in the document
44 */
45 private long deductedSpaces;
46
47 /** Constructor */
48 public NodePosition() {
49 }
50
51 /**
52 * constructor
53 * @param osn - old start offset
54 * @param oen - old end offset
55 * @param nsn - new start offset
56 * @param nen - new end offset
57 * @param space - total deducted spaces due to change in the text before
58 * the start offset in the document
59 */
60 public NodePosition(long osn, long oen, long nsn, long nen, long space) {
61 oldStartNode = osn;
62 oldEndNode = oen;
63 newStartNode = nsn;
64 newEndNode = nen;
65 deductedSpaces = space;
66 }
67
68 /**
69 * Returns the old start offset
70 * @return a <tt>long</tt> value.
71 */
72 public long getOldStartNode() {
73 return oldStartNode;
74 }
75
76 /**
77 * Returns the old end offset
78 * @return a <tt>long</tt> value.
79 */
80 public long getOldEndNode() {
81 return oldEndNode;
82 }
83
84 /**
85 * Returns new start offset
86 * @return a <tt>long</tt> value.
87 */
88 public long getNewStartNode() {
89 return newStartNode;
90 }
91
92 /**
93 * Returns the new end offset
94 * @return a <tt>long</tt> value.
95 */
96 public long getNewEndNode() {
97 return newEndNode;
98 }
99
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 a <tt>long</tt> value.
143 */
144 public long getDeductedSpaces() {
145 return deductedSpaces;
146 }
147 }