/** * 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; }