private Builder(SourceSection key) { this(key.getSource()); Objects.requireNonNull(key); sourceSection = key; }
private Builder(SourceSection key) { this(key.getSource()); Objects.requireNonNull(key); sourceSection = key; }
@Override public String getLanguage() { return sourceSection.getSource().getLanguage(); } }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (sourceSection == null) { return false; } return isSourceIncluded(sourceSection.getSource()); }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (sourceSection == null) { return false; } return isSourceIncluded(sourceSection.getSource()); }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (sourceSection == null) { return false; } return isSourceIncluded(sourceSection.getSource()); }
@Override protected void visitInstrumentable(Node parentInstrumentable, SourceSection parentSourceSection, Node instrumentableNode, SourceSection sourceSection) { if (sourceSection != null) { adoptSource(sourceSection.getSource()); } }
public boolean visit(Node node) { final SourceSection sourceSection = node.getSourceSection(); if (sourceSection != null) { source = sourceSection.getSource(); return false; } return true; } }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (sourceSection == null) { return false; } return isSourceIncluded(sourceSection.getSource()); }
/** * 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; }
private static String getShortDescription(SourceSection sourceSection) { StringBuilder b = new StringBuilder(); b.append(sourceSection.getSource().getName()); b.append(":"); if (sourceSection.getStartLine() == sourceSection.getEndLine()) { b.append(sourceSection.getStartLine()); } else { b.append(sourceSection.getStartLine()).append("-").append(sourceSection.getEndLine()); } return b.toString(); }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSourceSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSameSource(rootNodeBits) && rootSourceSection != null) { return isSourceIncluded(rootSourceSection.getSource()); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSourceSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSameSource(rootNodeBits) && rootSourceSection != null) { return isSourceIncluded(rootSourceSection.getSource()); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSourceSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSameSource(rootNodeBits) && rootSourceSection != null) { return isSourceIncluded(rootSourceSection.getSource()); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSourceSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSameSource(rootNodeBits) && rootSourceSection != null) { return isSourceIncluded(rootSourceSection.getSource()); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSourceSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSameSource(rootNodeBits) && rootSourceSection != null) { return isSourceIncluded(rootSourceSection.getSource()); } return true; }
protected static String sourceInfo(Node node) { final SourceSection src = node.getSourceSection(); if (src != null) { if (src instanceof NullSourceSection) { final NullSourceSection nullSection = (NullSourceSection) src; return nullSection.getShortDescription(); } else { return src.getSource().getName() + ":" + src.getStartLine(); } } return ""; }
@Override public SourceSection getSourceSection() { if (super.getSourceSection() == null && sourceSectionBegin != null && sourceSectionEnd != null) { super.setSourceSection(sourceSectionBegin.getSource().createSection(sourceSectionBegin.getCharIndex(), sourceSectionEnd.getCharEndIndex() - sourceSectionBegin.getCharIndex())); } return super.getSourceSection(); }
@Override public SourceSection getSourceSection() { SourceSection src = super.getSourceSection(); if (src != null && !isEmpty()) { int endIndex = getLastTerm().getSourceSection().getCharEndIndex(); if (endIndex != src.getCharEndIndex()) { int startIndex = src.getCharIndex(); super.setSourceSection(src.getSource().createSection(startIndex, endIndex - startIndex)); } } return super.getSourceSection(); }