@Override public int getStartLine(Object impl) { SourceSection section = (SourceSection) impl; return section.getStartLine(); }
@Override public int getStartLine(Object impl) { SourceSection section = (SourceSection) impl; return section.getStartLine(); }
@Override public int getLineNumber() { return sourceSection.getStartLine(); }
private static boolean intersectsLines(SourceSection section1, SourceSection section2) { int x1 = section1.getStartLine(); int x2 = section1.getEndLine(); int y1 = section2.getStartLine(); int y2 = section2.getEndLine(); return x2 >= y1 && y2 >= x1; }
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 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 public void breakpointResolved(Breakpoint brkp, SourceSection section) { resolvedIndexPtr[0] = section.getCharIndex() + 1; if (TRACE) { trace("BREAKPOINT resolved to " + section.getStartLine() + ":" + section.getStartColumn()); } } }).build());
@Override public void breakpointResolved(Breakpoint brkp, SourceSection section) { resolvedIndexPtr[0] = section.getCharIndex() + 1; if (TRACE) { trace("BREAKPOINT resolved to " + section.getStartLine() + ":" + section.getStartColumn()); } } }).build());
@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; }
private static String formatLocation(SourceSection sourceSection) { if (sourceSection == null) { return ""; } if (sourceSection.getSource() == null) { // TODO we can remove this block if SourceSection#createUnavailable was removed, because // then source cannot become null anymore. return "at <Unknown>"; } else { return "at " + String.format("%s:%d", sourceSection.getSource().getName(), sourceSection.getStartLine()); } }
private static String formatSourceSection(SourceSection sourceSection) { if (sourceSection == null || sourceSection.getSource() == null) { return "n/a"; } return String.format("%s:%d", sourceSection.getSource().getName(), sourceSection.getStartLine()); }
private static String formatLocation(SourceSection sourceSection) { if (sourceSection == null) { return ""; } if (sourceSection.getSource() == null) { // TODO we can remove this block if SourceSection#createUnavailable was removed, because // then source cannot become null anymore. return "at <Unknown>"; } else { return "at " + String.format("%s:%d", sourceSection.getSource().getName(), sourceSection.getStartLine()); } }
@Override public String getDescription() { return sourceSection.getSource().getURI() + " " + sourceSection.getStartLine() + ":" + sourceSection.getStartColumn(); }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSourceSectionsHierachical(rootNodeBits) && rootSection != null && rootSection.getStartLine() == rootSection.getEndLine()) { return ColumnIn.isColumnIn(rootSection, ranges); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSourceSectionsHierachical(rootNodeBits) && rootSection != null && rootSection.getStartLine() == rootSection.getEndLine()) { return ColumnIn.isColumnIn(rootSection, ranges); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSourceSectionsHierachical(rootNodeBits) && rootSection != null && rootSection.getStartLine() == rootSection.getEndLine()) { return isColumnIn(rootSection, ranges); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSourceSectionsHierachical(rootNodeBits) && rootSection != null && rootSection.getStartLine() == rootSection.getEndLine()) { return isColumnIn(rootSection, ranges); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSourceSectionsHierachical(rootNodeBits) && rootSection != null && rootSection.getStartLine() == rootSection.getEndLine()) { return ColumnIn.isColumnIn(rootSection, ranges); } return true; }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSection, RootNode rootNode, int rootNodeBits) { if (RootNodeBits.isNoSourceSection(rootNodeBits)) { return false; } if (RootNodeBits.isSourceSectionsHierachical(rootNodeBits) && rootSection != null && rootSection.getStartLine() == rootSection.getEndLine()) { return ColumnIn.isColumnIn(rootSection, ranges); } 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 ""; }