comparison dwtx/jface/text/link/LinkedPositionGroup.d @ 136:6dcb0baaa031

Regex removal of throws decls, some instanceof
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 02:20:40 +0200
parents 51e6e63f930e
children 75302ef3f92f
comparison
equal deleted inserted replaced
135:65801ad2b265 136:6dcb0baaa031
110 * @throws BadLocationException if the position is invalid or conflicts with 110 * @throws BadLocationException if the position is invalid or conflicts with
111 * other positions in the group 111 * other positions in the group
112 * @throws IllegalStateException if the group has already been added to a 112 * @throws IllegalStateException if the group has already been added to a
113 * model 113 * model
114 */ 114 */
115 public void addPosition(LinkedPosition position) throws BadLocationException { 115 public void addPosition(LinkedPosition position) {
116 /* 116 /*
117 * Enforces constraints and sets the custom iteration flag. If the 117 * Enforces constraints and sets the custom iteration flag. If the
118 * position is already in this group, nothing happens. 118 * position is already in this group, nothing happens.
119 */ 119 */
120 Assert.isNotNull(position); 120 Assert.isNotNull(position);
134 * Enforces the invariant that all positions must contain the same string. 134 * Enforces the invariant that all positions must contain the same string.
135 * 135 *
136 * @param position the position to check 136 * @param position the position to check
137 * @throws BadLocationException if the equal content check fails 137 * @throws BadLocationException if the equal content check fails
138 */ 138 */
139 private void enforceEqualContent(LinkedPosition position) throws BadLocationException { 139 private void enforceEqualContent(LinkedPosition position) {
140 if (fPositions.size() > 0) { 140 if (fPositions.size() > 0) {
141 LinkedPosition groupPosition= cast(LinkedPosition) fPositions.get(0); 141 LinkedPosition groupPosition= cast(LinkedPosition) fPositions.get(0);
142 String groupContent= groupPosition.getContent(); 142 String groupContent= groupPosition.getContent();
143 String positionContent= position.getContent(); 143 String positionContent= position.getContent();
144 if (!groupContent.equals(positionContent)) 144 if (!groupContent.equals(positionContent))
152 * Enforces the invariant that all positions must be disjoint. 152 * Enforces the invariant that all positions must be disjoint.
153 * 153 *
154 * @param position the position to check 154 * @param position the position to check
155 * @throws BadLocationException if the disjointness check fails 155 * @throws BadLocationException if the disjointness check fails
156 */ 156 */
157 private void enforceDisjoint(LinkedPosition position) throws BadLocationException { 157 private void enforceDisjoint(LinkedPosition position) {
158 for (Iterator it= fPositions.iterator(); it.hasNext(); ) { 158 for (Iterator it= fPositions.iterator(); it.hasNext(); ) {
159 LinkedPosition p= cast(LinkedPosition) it.next(); 159 LinkedPosition p= cast(LinkedPosition) it.next();
160 if (p.overlapsWith(position)) 160 if (p.overlapsWith(position))
161 throw new BadLocationException(); 161 throw new BadLocationException();
162 } 162 }
166 * Enforces the disjointness for another group 166 * Enforces the disjointness for another group
167 * 167 *
168 * @param group the group to check 168 * @param group the group to check
169 * @throws BadLocationException if the disjointness check fails 169 * @throws BadLocationException if the disjointness check fails
170 */ 170 */
171 void enforceDisjoint(LinkedPositionGroup group) throws BadLocationException { 171 void enforceDisjoint(LinkedPositionGroup group) {
172 Assert.isNotNull(group); 172 Assert.isNotNull(group);
173 for (Iterator it= group.fPositions.iterator(); it.hasNext(); ) { 173 for (Iterator it= group.fPositions.iterator(); it.hasNext(); ) {
174 LinkedPosition p= cast(LinkedPosition) it.next(); 174 LinkedPosition p= cast(LinkedPosition) it.next();
175 enforceDisjoint(p); 175 enforceDisjoint(p);
176 } 176 }
310 docs[i]= pos.getDocument(); 310 docs[i]= pos.getDocument();
311 } 311 }
312 return docs; 312 return docs;
313 } 313 }
314 314
315 void register(LinkedModeModel model) throws BadLocationException { 315 void register(LinkedModeModel model) {
316 for (Iterator it= fPositions.iterator(); it.hasNext(); ) { 316 for (Iterator it= fPositions.iterator(); it.hasNext(); ) {
317 LinkedPosition pos= cast(LinkedPosition) it.next(); 317 LinkedPosition pos= cast(LinkedPosition) it.next();
318 model.register(pos); 318 model.register(pos);
319 } 319 }
320 } 320 }
327 * @return a position in the receiver that contains all positions in <code>group</code>, 327 * @return a position in the receiver that contains all positions in <code>group</code>,
328 * or <code>null</code> if none can be found 328 * or <code>null</code> if none can be found
329 * @throws BadLocationException if more than one position are affected by 329 * @throws BadLocationException if more than one position are affected by
330 * <code>group</code> 330 * <code>group</code>
331 */ 331 */
332 LinkedPosition adopt(LinkedPositionGroup group) throws BadLocationException { 332 LinkedPosition adopt(LinkedPositionGroup group) {
333 LinkedPosition found= null; 333 LinkedPosition found= null;
334 for (Iterator it= group.fPositions.iterator(); it.hasNext(); ) { 334 for (Iterator it= group.fPositions.iterator(); it.hasNext(); ) {
335 LinkedPosition pos= cast(LinkedPosition) it.next(); 335 LinkedPosition pos= cast(LinkedPosition) it.next();
336 LinkedPosition localFound= null; 336 LinkedPosition localFound= null;
337 for (Iterator it2= fPositions.iterator(); it2.hasNext(); ) { 337 for (Iterator it2= fPositions.iterator(); it2.hasNext(); ) {