/**
* Updates the projection model of a class file or compilation unit.
- *
+ *
* @since 3.0
*/
-public class DefaultJavaFoldingStructureProvider implements IProjectionListener, IJavaFoldingStructureProvider {
+public class DefaultJavaFoldingStructureProvider implements
+ IProjectionListener, IJavaFoldingStructureProvider {
private static class JavaProjectionAnnotation extends ProjectionAnnotation {
private boolean fIsComment;
- public JavaProjectionAnnotation(IJavaElement element, boolean isCollapsed, boolean isComment) {
+ public JavaProjectionAnnotation(IJavaElement element,
+ boolean isCollapsed, boolean isComment) {
super(isCollapsed);
fJavaElement = element;
fIsComment = isComment;
processDelta(delta);
}
- private IJavaElementDelta findElement(IJavaElement target, IJavaElementDelta delta) {
+ private IJavaElementDelta findElement(IJavaElement target,
+ IJavaElementDelta delta) {
if (delta == null || target == null)
return null;
}
/**
- * Projection position that will return two foldable regions: one folding away
- * the region from after the '/**' to the beginning of the content, the other
- * from after the first content line until after the comment.
- *
+ * Projection position that will return two foldable regions: one folding
+ * away the region from after the '/**' to the beginning of the content, the
+ * other from after the first content line until after the comment.
+ *
* @since 3.1
*/
- private static final class CommentPosition extends Position implements IProjectionPosition {
+ private static final class CommentPosition extends Position implements
+ IProjectionPosition {
CommentPosition(int offset, int length) {
super(offset, length);
}
/*
* @see org.eclipse.jface.text.source.projection.IProjectionPosition#computeFoldingRegions(org.eclipse.jface.text.IDocument)
*/
- public IRegion[] computeProjectionRegions(IDocument document) throws BadLocationException {
- DocumentCharacterIterator sequence = new DocumentCharacterIterator(document, offset, offset + length);
+ public IRegion[] computeProjectionRegions(IDocument document)
+ throws BadLocationException {
+ DocumentCharacterIterator sequence = new DocumentCharacterIterator(
+ document, offset, offset + length);
int prefixEnd = 0;
int contentStart = findFirstContent(sequence, prefixEnd);
int captionLine = document.getLineOfOffset(offset + contentStart);
int lastLine = document.getLineOfOffset(offset + length);
- Assert.isTrue(firstLine <= captionLine, "first folded line is greater than the caption line"); //$NON-NLS-1$
- Assert.isTrue(captionLine <= lastLine, "caption line is greater than the last folded line"); //$NON-NLS-1$
+ Assert.isTrue(firstLine <= captionLine,
+ "first folded line is greater than the caption line"); //$NON-NLS-1$
+ Assert.isTrue(captionLine <= lastLine,
+ "caption line is greater than the last folded line"); //$NON-NLS-1$
IRegion preRegion;
if (firstLine < captionLine) {
- // preRegion= new Region(offset + prefixEnd, contentStart - prefixEnd);
+ // preRegion= new Region(offset + prefixEnd, contentStart -
+ // prefixEnd);
int preOffset = document.getLineOffset(firstLine);
- IRegion preEndLineInfo = document.getLineInformation(captionLine);
+ IRegion preEndLineInfo = document
+ .getLineInformation(captionLine);
int preEnd = preEndLineInfo.getOffset();
preRegion = new Region(preOffset, preEnd - preOffset);
} else {
if (captionLine < lastLine) {
int postOffset = document.getLineOffset(captionLine + 1);
- IRegion postRegion = new Region(postOffset, offset + length - postOffset);
+ IRegion postRegion = new Region(postOffset, offset + length
+ - postOffset);
if (preRegion == null)
return new IRegion[] { postRegion };
}
/**
- * Finds the offset of the first identifier part within <code>content</code>.
- * Returns 0 if none is found.
- *
+ * Finds the offset of the first identifier part within
+ * <code>content</code>. Returns 0 if none is found.
+ *
* @param content
- * the content to search
- * @return the first index of a unicode identifier part, or zero if none can
- * be found
+ * the content to search
+ * @return the first index of a unicode identifier part, or zero if none
+ * can be found
*/
private int findFirstContent(final CharSequence content, int prefixEnd) {
int lenght = content.length();
// * Returns 0 if none is found.
// *
// * @param content the content to search
- // * @return the first index of a unicode identifier part, or zero if none
+ // * @return the first index of a unicode identifier part, or zero if
+ // none
// can
// * be found
// */
// int i= 0;
// while (i < len && isWhiteSpace(content.charAt(i)))
// i++;
- // if (len >= i + 2 && content.charAt(i) == '/' && content.charAt(i + 1) ==
+ // if (len >= i + 2 && content.charAt(i) == '/' && content.charAt(i + 1)
+ // ==
// '*')
// if (len >= i + 3 && content.charAt(i + 2) == '*')
// return i + 3;
*/
public int computeCaptionOffset(IDocument document) {
// return 0;
- DocumentCharacterIterator sequence = new DocumentCharacterIterator(document, offset, offset + length);
+ DocumentCharacterIterator sequence = new DocumentCharacterIterator(
+ document, offset, offset + length);
return findFirstContent(sequence, 0);
}
}
/**
- * Projection position that will return two foldable regions: one folding away
- * the lines before the one containing the simple name of the java element,
- * one folding away any lines after the caption.
- *
+ * Projection position that will return two foldable regions: one folding
+ * away the lines before the one containing the simple name of the java
+ * element, one folding away any lines after the caption.
+ *
* @since 3.1
*/
- private static final class JavaElementPosition extends Position implements IProjectionPosition {
+ private static final class JavaElementPosition extends Position implements
+ IProjectionPosition {
private IMember fMember;
/*
* @see org.eclipse.jface.text.source.projection.IProjectionPosition#computeFoldingRegions(org.eclipse.jface.text.IDocument)
*/
- public IRegion[] computeProjectionRegions(IDocument document) throws BadLocationException {
+ public IRegion[] computeProjectionRegions(IDocument document)
+ throws BadLocationException {
int nameStart = offset;
try {
/*
- * The member's name range may not be correct. However, reconciling
- * would trigger another element delta which would lead to reentrant
- * situations. Therefore, we optimistically assume that the name range
- * is correct, but double check the received lines below.
+ * The member's name range may not be correct. However,
+ * reconciling would trigger another element delta which would
+ * lead to reentrant situations. Therefore, we optimistically
+ * assume that the name range is correct, but double check the
+ * received lines below.
*/
ISourceRange nameRange = fMember.getNameRange();
if (nameRange != null)
int lastLine = document.getLineOfOffset(offset + length);
/*
- * see comment above - adjust the caption line to be inside the entire
- * folded region, and rely on later element deltas to correct the name
- * range.
+ * see comment above - adjust the caption line to be inside the
+ * entire folded region, and rely on later element deltas to correct
+ * the name range.
*/
if (captionLine < firstLine)
captionLine = firstLine;
IRegion preRegion;
if (firstLine < captionLine) {
int preOffset = document.getLineOffset(firstLine);
- IRegion preEndLineInfo = document.getLineInformation(captionLine);
+ IRegion preEndLineInfo = document
+ .getLineInformation(captionLine);
int preEnd = preEndLineInfo.getOffset();
preRegion = new Region(preOffset, preEnd - preOffset);
} else {
if (captionLine < lastLine) {
int postOffset = document.getLineOffset(captionLine + 1);
- IRegion postRegion = new Region(postOffset, offset + length - postOffset);
+ IRegion postRegion = new Region(postOffset, offset + length
+ - postOffset);
if (preRegion == null)
return new IRegion[] { postRegion };
/*
* @see org.eclipse.jface.text.source.projection.IProjectionPosition#computeCaptionOffset(org.eclipse.jface.text.IDocument)
*/
- public int computeCaptionOffset(IDocument document) throws BadLocationException {
+ public int computeCaptionOffset(IDocument document)
+ throws BadLocationException {
int nameStart = offset;
try {
// need a reconcile here?
*/
public void projectionEnabled() {
// http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html
- // projectionEnabled messages are not always paired with projectionDisabled
+ // projectionEnabled messages are not always paired with
+ // projectionDisabled
// i.e. multiple enabled messages may be sent out.
// we have to make sure that we disable first when getting an enable
// message.
fHasHeaderComment = false;
if (fEditor instanceof PHPUnitEditor) {
- IWorkingCopyManager manager = PHPeclipsePlugin.getDefault().getWorkingCopyManager();
+ IWorkingCopyManager manager = PHPeclipsePlugin.getDefault()
+ .getWorkingCopyManager();
fInput = manager.getWorkingCopy(fEditor.getEditorInput());
}
// else if (fEditor instanceof ClassFileEditor) {
// }
if (fInput != null) {
- ProjectionAnnotationModel model = (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
+ ProjectionAnnotationModel model = (ProjectionAnnotationModel) fEditor
+ .getAdapter(ProjectionAnnotationModel.class);
if (model != null) {
fCachedModel = model;
if (fInput instanceof ICompilationUnit) {
ICompilationUnit unit = (ICompilationUnit) fInput;
synchronized (unit) {
try {
- // unit.reconcile(ICompilationUnit.NO_AST, false, null, null);
+ // unit.reconcile(ICompilationUnit.NO_AST,
+ // false, null, null);
unit.reconcile();
} catch (JavaModelException x) {
}
Map additions = computeAdditions((IParent) fInput);
/*
- * Minimize the events being sent out - as this happens in the UI
- * thread merge everything into one call.
+ * Minimize the events being sent out - as this happens in
+ * the UI thread merge everything into one call.
*/
List removals = new LinkedList();
Iterator existing = model.getAnnotationIterator();
while (existing.hasNext())
removals.add(existing.next());
- model.replaceAnnotations((Annotation[]) removals.toArray(new Annotation[removals.size()]), additions);
+ model.replaceAnnotations((Annotation[]) removals
+ .toArray(new Annotation[removals.size()]),
+ additions);
}
}
}
private void initializePreferences() {
- IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- fCollapseInnerTypes = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_INNERTYPES);
+ IPreferenceStore store = PHPeclipsePlugin.getDefault()
+ .getPreferenceStore();
+ fCollapseInnerTypes = store
+ .getBoolean(PreferenceConstants.EDITOR_FOLDING_INNERTYPES);
// fCollapseImportContainer =
// store.getBoolean(PreferenceConstants.EDITOR_FOLDING_IMPORTS);
- fCollapseJavadoc = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_JAVADOC);
- fCollapseMethods = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_METHODS);
- fCollapseHeaderComments = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_HEADERS);
+ fCollapseJavadoc = store
+ .getBoolean(PreferenceConstants.EDITOR_FOLDING_JAVADOC);
+ fCollapseMethods = store
+ .getBoolean(PreferenceConstants.EDITOR_FOLDING_METHODS);
+ fCollapseHeaderComments = store
+ .getBoolean(PreferenceConstants.EDITOR_FOLDING_HEADERS);
}
private Map computeAdditions(IParent parent) {
- Map map = new LinkedHashMap(); // use a linked map to maintain ordering of
+ Map map = new LinkedHashMap(); // use a linked map to maintain ordering
+ // of
// comments
try {
computeAdditions(parent.getChildren(), map);
return map;
}
- private void computeAdditions(IJavaElement[] elements, Map map) throws JavaModelException {
+ private void computeAdditions(IJavaElement[] elements, Map map)
+ throws JavaModelException {
for (int i = 0; i < elements.length; i++) {
IJavaElement element = elements[i];
// createProjection = true;
// break;
case IJavaElement.TYPE:
- collapse = fAllowCollapsing && fCollapseInnerTypes && isInnerType((IType) element);
+ collapse = fAllowCollapsing;
+ if (isInnerType((IType) element)) {
+ collapse = collapse && fCollapseInnerTypes;
+ } else {
+ collapse = false; // don't allow the most outer type to be
+ // folded, may be changed in future versions
+ }
createProjection = true;
break;
case IJavaElement.METHOD:
if (regions != null) {
// comments
for (int i = 0; i < regions.length - 1; i++) {
- Position position = createProjectionPosition(regions[i], null);
+ Position position = createProjectionPosition(regions[i],
+ null);
boolean commentCollapse;
if (position != null) {
- if (i == 0 && (regions.length > 2 || fHasHeaderComment) && element == fFirstType) {
- commentCollapse = fAllowCollapsing && fCollapseHeaderComments;
+ if (i == 0 && (regions.length > 2 || fHasHeaderComment)
+ && element == fFirstType) {
+ commentCollapse = fAllowCollapsing
+ && fCollapseHeaderComments;
} else {
- commentCollapse = fAllowCollapsing && fCollapseJavadoc;
+ commentCollapse = fAllowCollapsing
+ && fCollapseJavadoc;
}
- map.put(new JavaProjectionAnnotation(element, commentCollapse, true), position);
+ map.put(new JavaProjectionAnnotation(element,
+ commentCollapse, true), position);
}
}
// code
- Position position = createProjectionPosition(regions[regions.length - 1], element);
+ Position position = createProjectionPosition(
+ regions[regions.length - 1], element);
if (position != null)
- map.put(new JavaProjectionAnnotation(element, collapse, false), position);
+ map.put(new JavaProjectionAnnotation(element, collapse,
+ false), position);
}
}
}
* More than one range may be returned if the element has a leading comment
* which gets folded separately. If there are no foldable regions,
* <code>null</code> is returned.
- *
+ *
* @param element
- * the java element that can be folded
- * @return the regions to be folded, or <code>null</code> if there are none
+ * the java element that can be folded
+ * @return the regions to be folded, or <code>null</code> if there are
+ * none
*/
private IRegion[] computeProjectionRanges(IJavaElement element) {
return null;
List regions = new ArrayList();
+ // now add all comments first to the regions list
if (fFirstType == null && element instanceof IType) {
fFirstType = (IType) element;
IRegion headerComment = computeHeaderComment(fFirstType);
final int shift = range.getOffset();
int start = shift;
if (element instanceof IType) {
- Scanner scanner = ToolFactory.createScanner(true, false, false, false);
+ Scanner scanner = ToolFactory.createScanner(true, false,
+ false, false);
scanner.setSource(contents.toCharArray());
scanner.setPHPMode(true);
switch (token) {
case ITerminalSymbols.TokenNameCOMMENT_PHPDOC:
case ITerminalSymbols.TokenNameCOMMENT_BLOCK: {
- int end = shift + scanner.getCurrentTokenEndPosition() + 1;
+ int end = shift
+ + scanner.getCurrentTokenEndPosition() + 1;
regions.add(new Region(start, end - start));
}
case ITerminalSymbols.TokenNameCOMMENT_LINE:
}
}
}
- regions.add(new Region(start, shift + range.getLength() - start));
+ // at the end add the element region
+ regions.add(new Region(range.getOffset(), range.getLength()));
if (regions.size() > 0) {
IRegion[] result = new IRegion[regions.size()];
}
/*
- * code adapted from CommentFormattingStrategy: scan the header content up
- * to the first type. Once a comment is found, accumulate any additional
- * comments up to the stop condition. The stop condition is reaching a
- * package declaration, import container, or the end of the input.
+ * code adapted from CommentFormattingStrategy: scan the header
+ * content up to the first type. Once a comment is found, accumulate
+ * any additional comments up to the stop condition. The stop
+ * condition is reaching a package declaration, import container, or
+ * the end of the input.
*/
- IScanner scanner = ToolFactory.createScanner(true, false, false, false);
+ IScanner scanner = ToolFactory.createScanner(true, false, false,
+ false);
scanner.setSource(content.toCharArray());
int headerStart = -1;
boolean foundComment = false;
int terminal = scanner.getNextToken();
while (terminal != ITerminalSymbols.TokenNameEOF
- && !(terminal == ITerminalSymbols.TokenNameclass || terminal == ITerminalSymbols.TokenNameinterface || foundComment)) {
+ && !(terminal == ITerminalSymbols.TokenNameclass
+ || terminal == ITerminalSymbols.TokenNameinterface || foundComment)) {
- if (terminal == ITerminalSymbols.TokenNameCOMMENT_PHPDOC || terminal == ITerminalSymbols.TokenNameCOMMENT_BLOCK
+ if (terminal == ITerminalSymbols.TokenNameCOMMENT_PHPDOC
+ || terminal == ITerminalSymbols.TokenNameCOMMENT_BLOCK
|| terminal == ITerminalSymbols.TokenNameCOMMENT_LINE) {
if (!foundComment)
- headerStart = scanner.getCurrentTokenStartPosition();
+ headerStart = scanner
+ .getCurrentTokenStartPosition();
headerEnd = scanner.getCurrentTokenEndPosition();
foundComment = true;
}
return null;
}
- private Position createProjectionPosition(IRegion region, IJavaElement element) {
+ private Position createProjectionPosition(IRegion region,
+ IJavaElement element) {
if (fCachedDocument == null)
return null;
try {
int start = fCachedDocument.getLineOfOffset(region.getOffset());
- int end = fCachedDocument.getLineOfOffset(region.getOffset() + region.getLength());
+ int end = fCachedDocument.getLineOfOffset(region.getOffset()
+ + region.getLength());
if (start != end) {
int offset = fCachedDocument.getLineOffset(start);
int endOffset;
if (fCachedDocument.getNumberOfLines() > end + 1)
endOffset = fCachedDocument.getLineOffset(end + 1);
else if (end > start)
- endOffset = fCachedDocument.getLineOffset(end) + fCachedDocument.getLineLength(end);
+ endOffset = fCachedDocument.getLineOffset(end)
+ + fCachedDocument.getLineLength(end);
else
return null;
if (element instanceof IMember)
- return new JavaElementPosition(offset, endOffset - offset, (IMember) element);
+ return new JavaElementPosition(offset, endOffset - offset,
+ (IMember) element);
else
return new CommentPosition(offset, endOffset - offset);
}
if ((delta.getFlags() & (IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_CHILDREN)) == 0)
return;
- ProjectionAnnotationModel model = (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
+ ProjectionAnnotationModel model = (ProjectionAnnotationModel) fEditor
+ .getAdapter(ProjectionAnnotationModel.class);
if (model == null)
return;
Iterator e = updated.keySet().iterator();
while (e.hasNext()) {
- JavaProjectionAnnotation newAnnotation = (JavaProjectionAnnotation) e.next();
- IJavaElement element = newAnnotation.getElement();
+ JavaProjectionAnnotation newAnnotation = (JavaProjectionAnnotation) e
+ .next();
+//+
Position newPosition = (Position) updated.get(newAnnotation);
-
- List annotations = (List) previous.get(element);
- if (annotations == null) {
-
- additions.put(newAnnotation, newPosition);
-
- } else {
- Iterator x = annotations.iterator();
- boolean matched = false;
- while (x.hasNext()) {
- Tuple tuple = (Tuple) x.next();
- JavaProjectionAnnotation existingAnnotation = tuple.annotation;
- Position existingPosition = tuple.position;
- if (newAnnotation.isComment() == existingAnnotation.isComment()) {
- if (existingPosition != null && (!newPosition.equals(existingPosition))) {
- existingPosition.setOffset(newPosition.getOffset());
- existingPosition.setLength(newPosition.getLength());
- updates.add(existingAnnotation);
- }
- matched = true;
- x.remove();
- break;
- }
- }
- if (!matched)
- additions.put(newAnnotation, newPosition);
-
- if (annotations.isEmpty())
- previous.remove(element);
- }
+ additions.put(newAnnotation, newPosition);
+//-
+// IJavaElement element = newAnnotation.getElement();
+// Position newPosition = (Position) updated.get(newAnnotation);
+//
+// List annotations = (List) previous.get(element);
+// if (annotations == null) {
+//
+// additions.put(newAnnotation, newPosition);
+//
+// } else {
+// Iterator x = annotations.iterator();
+// boolean matched = false;
+// while (x.hasNext()) {
+// Tuple tuple = (Tuple) x.next();
+// JavaProjectionAnnotation existingAnnotation = tuple.annotation;
+// Position existingPosition = tuple.position;
+// if (newAnnotation.isComment() == existingAnnotation
+// .isComment()) {
+// if (existingPosition != null
+// && (!newPosition.equals(existingPosition))) {
+// existingPosition.setOffset(newPosition
+// .getOffset());
+// existingPosition.setLength(newPosition
+// .getLength());
+// updates.add(existingAnnotation);
+// }
+// matched = true;
+// x.remove();
+// break;
+// }
+// }
+// if (!matched)
+// additions.put(newAnnotation, newPosition);
+//
+// if (annotations.isEmpty())
+// previous.remove(element);
+// }
+//-
}
e = previous.values().iterator();
/**
* Matches deleted annotations to changed or added ones. A deleted
- * annotation/position tuple that has a matching addition / change is updated
- * and marked as changed. The matching tuple is not added (for additions) or
- * marked as deletion instead (for changes). The result is that more
- * annotations are changed and fewer get deleted/re-added.
+ * annotation/position tuple that has a matching addition / change is
+ * updated and marked as changed. The matching tuple is not added (for
+ * additions) or marked as deletion instead (for changes). The result is
+ * that more annotations are changed and fewer get deleted/re-added.
*/
private void match(List deletions, Map additions, List changes) {
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
Iterator deletionIterator = deletions.iterator();
while (deletionIterator.hasNext()) {
- JavaProjectionAnnotation deleted = (JavaProjectionAnnotation) deletionIterator.next();
+ JavaProjectionAnnotation deleted = (JavaProjectionAnnotation) deletionIterator
+ .next();
Position deletedPosition = fCachedModel.getPosition(deleted);
if (deletedPosition == null)
continue;
IJavaElement element = match.annotation.getElement();
deleted.setElement(element);
deletedPosition.setLength(match.position.getLength());
- if (deletedPosition instanceof JavaElementPosition && element instanceof IMember) {
+ if (deletedPosition instanceof JavaElementPosition
+ && element instanceof IMember) {
JavaElementPosition jep = (JavaElementPosition) deletedPosition;
jep.setMember((IMember) element);
}
}
/**
- * Finds a match for <code>tuple</code> in a collection of annotations. The
- * positions for the <code>JavaProjectionAnnotation</code> instances in
- * <code>annotations</code> can be found in the passed
+ * Finds a match for <code>tuple</code> in a collection of annotations.
+ * The positions for the <code>JavaProjectionAnnotation</code> instances
+ * in <code>annotations</code> can be found in the passed
* <code>positionMap</code> or <code>fCachedModel</code> if
* <code>positionMap</code> is <code>null</code>.
* <p>
- * A tuple is said to match another if their annotations have the same comment
- * flag and their position offsets are equal.
+ * A tuple is said to match another if their annotations have the same
+ * comment flag and their position offsets are equal.
* </p>
* <p>
* If a match is found, the annotation gets removed from
* <code>annotations</code>.
* </p>
- *
+ *
* @param tuple
- * the tuple for which we want to find a match
+ * the tuple for which we want to find a match
* @param annotations
- * collection of <code>JavaProjectionAnnotation</code>
+ * collection of <code>JavaProjectionAnnotation</code>
* @param positionMap
- * a <code>Map<Annotation, Position></code> or
- * <code>null</code>
+ * a <code>Map<Annotation, Position></code> or
+ * <code>null</code>
* @return a matching tuple or <code>null</code> for no match
*/
private Tuple findMatch(Tuple tuple, Collection annotations, Map positionMap) {
Iterator it = annotations.iterator();
while (it.hasNext()) {
- JavaProjectionAnnotation annotation = (JavaProjectionAnnotation) it.next();
+ JavaProjectionAnnotation annotation = (JavaProjectionAnnotation) it
+ .next();
if (tuple.annotation.isComment() == annotation.isComment()) {
- Position position = positionMap == null ? fCachedModel.getPosition(annotation) : (Position) positionMap.get(annotation);
+ Position position = positionMap == null ? fCachedModel
+ .getPosition(annotation) : (Position) positionMap
+ .get(annotation);
if (position == null)
continue;
Comparator comparator = new Comparator() {
public int compare(Object o1, Object o2) {
- return ((Tuple) o1).position.getOffset() - ((Tuple) o2).position.getOffset();
+ return ((Tuple) o1).position.getOffset()
+ - ((Tuple) o2).position.getOffset();
}
};
for (Iterator it = map.values().iterator(); it.hasNext();) {