/** * Returns <code>true</code> if the receiver contains <code>position</code>. * * @param position the position to check * @return <code>true</code> if the receiver contains <code>position</code> */ boolean contains(Position position) { for (LinkedPosition p : fPositions) { if (position.equals(p)) return true; } return false; } }
@Override public boolean equals(Object obj) { if (!(obj instanceof PDECompletionProposal)) { return false; } PDECompletionProposal proposal = (PDECompletionProposal) obj; return proposal.fPosition.equals(fPosition) && proposal.fResolution.equals(fResolution); }
private int getIndex(Position position) { Entry entry; int length= fList.size(); for (int i= 0; i < length; i++) { entry= fList.get(i); if (entry.fPosition.equals(position)) return i; } return -1; }
private int getIndex(Position position) { Entry entry; int length= fList.size(); for (int i= 0; i < length; i++) { entry= fList.get(i); if (entry.fPosition.equals(position)) return i; } return -1; }
@Override public boolean equals(Object other) { if (other instanceof ExtraPosition) { ExtraPosition rp = (ExtraPosition) other; return (rp.offset == offset) && (rp.length == length) && (rp.markerId == markerId) && Objects.equals(rp.message, message) && Objects.equals(rp.previous, previous); } return super.equals(other); }
private int getIndex(Position position) { Entry entry; int length= fList.size(); for (int i= 0; i < length; i++) { entry= (Entry) fList.get(i); if (entry.fPosition.equals(position)) return i; } return -1; }
public Object get(Position position) { Entry entry; // behind anchor int length= fList.size(); for (int i= fAnchor; i < length; i++) { entry= fList.get(i); if (entry.fPosition.equals(position)) { fAnchor= i; return entry.fValue; } } // before anchor for (int i= 0; i < fAnchor; i++) { entry= fList.get(i); if (entry.fPosition.equals(position)) { fAnchor= i; return entry.fValue; } } return null; }
/** * Returns <code>true</code> if the receiver contains <code>position</code>. * * @param position the position to check * @return <code>true</code> if the receiver contains <code>position</code> */ boolean contains(Position position) { for (Iterator<LinkedPosition> it= fPositions.iterator(); it.hasNext(); ) { LinkedPosition p= it.next(); if (position.equals(p)) return true; } return false; } }
public Object get(Position position) { Entry entry; // behind anchor int length= fList.size(); for (int i= fAnchor; i < length; i++) { entry= fList.get(i); if (entry.fPosition.equals(position)) { fAnchor= i; return entry.fValue; } } // before anchor for (int i= 0; i < fAnchor; i++) { entry= fList.get(i); if (entry.fPosition.equals(position)) { fAnchor= i; return entry.fValue; } } return null; }
public Object get(Position position) { Entry entry; // behind anchor int length= fList.size(); for (int i= fAnchor; i < length; i++) { entry= (Entry) fList.get(i); if (entry.fPosition.equals(position)) { fAnchor= i; return entry.fValue; } } // before anchor for (int i= 0; i < fAnchor; i++) { entry= (Entry) fList.get(i); if (entry.fPosition.equals(position)) { fAnchor= i; return entry.fValue; } } return null; }
@Override public boolean equals(Object o) { if (o instanceof TypedPosition) { if (super.equals(o)) { TypedPosition p= (TypedPosition) o; return (fType == null && p.getType() == null) || fType.equals(p.getType()); } } return false; }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object arg) { return arg instanceof ConsoleHyperlinkPosition && super.equals(arg) && getHyperLink().equals(((ConsoleHyperlinkPosition)arg).getHyperLink()); }
@Override public boolean equals(Object o) { if (o instanceof TypedPosition) { if (super.equals(o)) { TypedPosition p= (TypedPosition) o; return (fType == null && p.getType() == null) || fType.equals(p.getType()); } } return false; }
/** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object arg) { return arg instanceof ConsoleHyperlinkPosition && super.equals(arg) && getHyperLink().equals(((ConsoleHyperlinkPosition)arg).getHyperLink()); }
if (prior == null || !nextP.equals(prior)){ if (testSolution(nextP, p, visited)){
public List<Position> findPath(Set<Position> closedSet, Position from, Position to) { if (from.equals(to)) return List.of(to); while (from.hasNeighboursNotIn(closedSet)) { Position pos = from.getRandomNeighbourNotIn(closedSet); closedSet.add(pos); List<Position> path = findPath(closedSet, pos, to); if (!path.isEmpty()) return List.of(pos, path); } closedSet.add(from); return Collection.EMPTY_LIST; }
/** * Returns the partitioners positions. * * @return the partitioners positions * @throws BadPositionCategoryException if getting the positions from the * document fails */ protected final Position[] getPositions() throws BadPositionCategoryException { if (fCachedPositions == null) { fCachedPositions= fDocument.getPositions(fPositionCategory); } else if (CHECK_CACHE_CONSISTENCY) { Position[] positions= fDocument.getPositions(fPositionCategory); int len= Math.min(positions.length, fCachedPositions.length); for (int i= 0; i < len; i++) { if (!positions[i].equals(fCachedPositions[i])) System.err.println("FastPartitioner.getPositions(): cached position is not up to date: from document: " + toString(positions[i]) + " in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ //$NON-NLS-2$ } for (int i= len; i < positions.length; i++) System.err.println("FastPartitioner.getPositions(): new position in document: " + toString(positions[i])); //$NON-NLS-1$ for (int i= len; i < fCachedPositions.length; i++) System.err.println("FastPartitioner.getPositions(): stale position in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ } return fCachedPositions; }
/** * Returns the partitioners positions. * * @return the partitioners positions * @throws BadPositionCategoryException if getting the positions from the * document fails */ protected final Position[] getPositions() throws BadPositionCategoryException { if (fCachedPositions == null) { fCachedPositions= fDocument.getPositions(fPositionCategory); } else if (CHECK_CACHE_CONSISTENCY) { Position[] positions= fDocument.getPositions(fPositionCategory); int len= Math.min(positions.length, fCachedPositions.length); for (int i= 0; i < len; i++) { if (!positions[i].equals(fCachedPositions[i])) System.err.println("FastPartitioner.getPositions(): cached position is not up to date: from document: " + toString(positions[i]) + " in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ //$NON-NLS-2$ } for (int i= len; i < positions.length; i++) System.err.println("FastPartitioner.getPositions(): new position in document: " + toString(positions[i])); //$NON-NLS-1$ for (int i= len; i < fCachedPositions.length; i++) System.err.println("FastPartitioner.getPositions(): stale position in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ } return fCachedPositions; }
/** * Returns the partitioners positions. * * @return the partitioners positions * @throws BadPositionCategoryException * if getting the positions from the document fails * @since 2.2 */ protected final Position[] getPositions() throws BadPositionCategoryException { if (fCachedPositions == null) { fCachedPositions = fDocument.getPositions(fPositionCategory); } else if (CHECK_CACHE_CONSISTENCY) { Position[] positions = fDocument.getPositions(fPositionCategory); int len = Math.min(positions.length, fCachedPositions.length); for (int i = 0; i < len; i++) { if (!positions[i].equals(fCachedPositions[i])) System.err .println("FastPartitioner.getPositions(): cached position is not up to date: from document: " + toString(positions[i]) + " in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ //$NON-NLS-2$ } for (int i = len; i < positions.length; i++) System.err .println("FastPartitioner.getPositions(): new position in document: " + toString(positions[i])); //$NON-NLS-1$ for (int i = len; i < fCachedPositions.length; i++) System.err .println("FastPartitioner.getPositions(): stale position in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ } return fCachedPositions; }
/** * Returns the existing codemining annotation with the given position information and null * otherwise. * * @param pos the position * @return the existing codemining annotation with the given position information and null * otherwise. */ @SuppressWarnings("unchecked") public <T extends AbstractInlinedAnnotation> T findExistingAnnotation(Position pos) { if (fInlinedAnnotations == null) { return null; } for (AbstractInlinedAnnotation ann : fInlinedAnnotations) { if (pos.equals(ann.getPosition()) && !ann.getPosition().isDeleted()) { try { return (T) ann; } catch (ClassCastException e) { // Do nothing } } } return null; }