public boolean containsOffset(int i) { return getStartOffset() <= i && i < getEndOffset(); }
public int getEndOffset() { // our startOffset take into account our parent, and our start return getStartOffset() + getLength(); }
public int getEndOffset(ITextRegion containedRegion) { return getStartOffset(containedRegion) + containedRegion.getLength(); }
public boolean containsOffset(ITextRegion containedRegion, int offset) { return getStartOffset(containedRegion) <= offset && offset < getEndOffset(containedRegion); }
public int getStartOffset(ITextRegion containedRegion) { // it is an error to pass null to this method // ISSUE: need better "spec" on error behavior: // for now will return zero as this will roughly // work for some cases (and avoid NPE). if (containedRegion == null) { return getStartOffset(); } return getStartOffset() + containedRegion.getStart(); }
public int getTextEndOffset() { ITextRegion region = regions.get(regions.size() - 1); // our startOffset take into account our parent, and our start // (pa) 10/4 changed to be based on text end // it used to return incorrect value for embedded region containers // // TODO CRITICAL -- need to re-work this work around, so doesn't // depend on XMLRegionContext // // this is a workaround for 226823/////////// // for (int i = regions.size() - 1; i >= 0 && region.getType() == // XMLRegionContext.WHITE_SPACE; i--) // region = (ITextRegion) regions.get(i); // ///////////////////////////////////////////// return getStartOffset() + region.getTextEnd(); }
public int getTextEndOffset(ITextRegion containedRegion) { int result = 0; if (regions != null) { int length = getRegions().size(); for (int i = 0; i < length; i++) { ITextRegion region = getRegions().get(i); if (region == containedRegion) { result = getStartOffset(region) + region.getTextEnd(); break; } } } return result; }
if ((getStartOffset(region) <= offset) && (offset < getEndOffset(region))) { result = region; break;