@Override public boolean isAvailable(Object impl) { SourceSection section = (SourceSection) impl; return section.isAvailable(); }
@Override public boolean isAvailable(Object impl) { SourceSection section = (SourceSection) impl; return section.isAvailable(); }
/** @since 0.8 or earlier */ @Override public int hashCode() { if (!isAvailable()) { return System.identityHashCode(this); } final int prime = 31; int result = 1; result = prime * result + charIndex; result = prime * result + charLength; result = prime * result + source.hashCode(); return result; }
/** * Returns whether the source section is in bounds of the {@link #getSource() source} * {@link Source#getCharacters() code}. Please note that calling this method causes the * {@link Source#getCharacters() code} of the {@link #getSource() source} to be loaded if it was * not yet loaded. */ boolean isValid() { return isAvailable() ? (charIndex + charLength <= getSource().getCharacters().length()) : false; }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (sourceSection == null || !sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartLine(); for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherStart)) { return true; } } return false; }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (!sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartColumn(); for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherStart)) { return true; } } return false; }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (sourceSection == null || !sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartLine(); for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherStart)) { return true; } } return false; }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (!sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartColumn(); for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherStart)) { return true; } } return false; }
/** * Returns an implementation-defined string representation of this source section to be used for * debugging purposes only. * * @see #getCharacters() * @since 0.8 or earlier */ @Override public String toString() { StringBuilder b = new StringBuilder(); b.append("SourceSection(source=").append(getSource().getName()); if (isAvailable()) { b.append(", index=").append(getCharIndex()); b.append(", length=").append(getCharLength()); if (isValid()) { b.append(", characters=").append(getCharacters().toString().replaceAll("\\n", "\\\\n")); } else { b.append(", valid=false"); } } else { b.append(" available=false"); } b.append(")"); return b.toString(); }
private static boolean isIndexIn(SourceSection sourceSection, IndexRange[] ranges) { if (sourceSection == null || !sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getCharIndex(); int otherEnd = otherStart + sourceSection.getCharLength(); for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherEnd)) { return true; } } return false; }
private static boolean isIndexIn(SourceSection sourceSection, IndexRange[] ranges) { if (sourceSection == null || !sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getCharIndex(); int otherEnd = otherStart + sourceSection.getCharLength(); for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherEnd)) { return true; } } return false; }
StringBuilder b = new StringBuilder(); b.append("SourceSection(source=").append(getSource().getName()); if (isAvailable()) { if (hasLines()) { b.append(" [").append(getStartLine());
static boolean isColumnIn(SourceSection sourceSection, IndexRange[] ranges) { if (!sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartColumn(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndColumn(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherEnd)) { return true; } } return false; }
static boolean isLineIn(SourceSection sourceSection, IndexRange[] ranges) { if (sourceSection == null || !sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartLine(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndLine(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherEnd)) { return true; } } return false; }
static boolean isLineIn(SourceSection sourceSection, IndexRange[] ranges) { if (sourceSection == null || !sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartLine(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndLine(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherEnd)) { return true; } } return false; }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (sourceSection == null || !sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartLine(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndLine(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherEnd, otherEnd)) { return true; } } return false; }
static boolean isColumnIn(SourceSection sourceSection, IndexRange[] ranges) { if (!sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartColumn(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndColumn(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherEnd)) { return true; } } return false; }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (sourceSection == null || !sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartLine(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndLine(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherEnd, otherEnd)) { return true; } } return false; }
if (!section.isAvailable()) { return rSource.createUnavailableSection(); } else if (section.hasCharIndex()) {