@Override public int getFirstOffset() { return e.getBegin(); }
@Override public int getFirstOffset() { return e.getBegin(); }
/** * Returns the character used to quote the value. * <p> * The return value is either a double-quote (<code>"</code>), a single-quote (<code>'</code>), or a space. * * @return the character used to quote the value, or a space if the value is not quoted or this attribute has no value. */ public char getQuoteChar() { if (valueSegment==valueSegmentIncludingQuotes) return ' '; // no quotes return source.charAt(valueSegmentIncludingQuotes.getBegin()); }
/** * Constructs a new <code>BlankOutputSegment</code> with the same span as the specified {@link Segment}. * @param segment a {@link Segment} defining the begin and end character positions of the new <code>OutputSegment</code>. */ public BlankOutputSegment(final Segment segment) { this(segment.getBegin(),segment.getEnd()); }
/** * Return the number of the line currently processed in the HTML * * @return The number of the current line being processed or empty */ public Optional<Integer> getCurrentLine() { if (currentSegment == null) { return Optional.empty(); } return Optional.of(currentSegment.getSource().getRow(currentSegment.getBegin())); }
private void error(Segment segment, String message) { diagnostics.add(new Diagnostic(segment.getBegin(), segment.getEnd(), message)); } }
private void error(String message) { diagnostics.add(new Diagnostic(segment.getBegin(), segment.getEnd(), message)); }
private void error(Segment segment, String message) { diagnostics.add(new Diagnostic(segment.getBegin(), segment.getEnd(), message)); } }
/** * Replaces the specified {@linkplain Segment segment} in this output document with the specified text. * <p> * Specifying a <code>null</code> argument to the <code>text</code> parameter is exactly equivalent to specifying an empty string, * and results in the segment being completely removed from the output document. * * @param segment the segment to replace. * @param text the replacement text, or <code>null</code> to remove the segment. */ public void replace(final Segment segment, final CharSequence text) { replace(segment.getBegin(),segment.getEnd(),text); }
private void error(String message) { diagnostics.add(new Diagnostic(segment.getBegin(), segment.getEnd(), message)); }
private GenericMethod findSetter(Segment segment, GenericClass cls, String name) { String methodName = "set" + Character.toUpperCase(name.charAt(0)) + name.substring(1); GenericMethod[] candidates = typeNavigator.findMethods(cls, methodName, 1); if (candidates.length == 0) { diagnostics.add(new Diagnostic(segment.getBegin(), segment.getEnd(), "Setter not found for key: " + name)); return null; } else if (candidates.length > 1) { diagnostics.add(new Diagnostic(segment.getBegin(), segment.getEnd(), "Ambiguous key: " + name)); return null; } else { return candidates[0]; } }
public static Span getSpan(Segment e) { return new Span(e.getBegin(), e.getEnd()); }
@Override public int getFirstLine() { return e.getSource().getRowColumnVector(e.getBegin()).getRow(); }
@Override public int getFirstLine() { return e.getSource().getRowColumnVector(e.getBegin()).getRow(); }
public int offset() { if (element != null) { if (element.getName().equalsIgnoreCase(CF.CFSCRIPT)) { return element.getStartTag().getEnd(); } else if (element.getName().equalsIgnoreCase(CF.CFSET)) { return element.getStartTag().getTagContent().getBegin() + 1; } return element.getBegin(); } else { return 0; } }
public int offset() { if (element != null) { if (element.getName().equalsIgnoreCase(CF.CFSCRIPT)) { return element.getStartTag().getEnd(); } else if (element.getName().equalsIgnoreCase(CF.CFSET)) { return element.getStartTag().getTagContent().getBegin() + 1; } return element.getBegin(); } else { return 0; } }
public Pair<Integer, String> getBodyText() { Segment content = innerElement.getContent(); Integer lineNum = innerElement.getSource().getRow(content.getBegin()); String nl = content.getSource().getNewLine(); String body = nl==null? content.toString(): content.toString().replace(nl, "\n"); return Pair.make(lineNum, body); }
public Pair<Integer, String> getBodyText() { Segment content = innerElement.getContent(); Integer lineNum = innerElement.getSource().getRow(content.getBegin()); String nl = content.getSource().getNewLine(); String body = nl==null? content.toString(): content.toString().replace(nl, "\n"); return Pair.make(lineNum, body); }
private void checkCFName(final Element element, final Context context, final BugList bugs, final int begLine, int offset, final String name) { if (element.getAttributeValue(name) != null) { final Attribute attribute = element.getAttributes().get(name); String varName; if (attribute != null) { varName = attribute.getValue(); offset = attribute.getValueSegment().getBegin(); } else { varName = ""; } checkNameForBugs(context, varName, varName, context.getFilename(), context.getFunctionName(), begLine, offset, bugs,null); } }
private void checkCFName(final Element element, final Context context, final BugList bugs, final int begLine, int offset, final String name) { if (element.getAttributeValue(name) != null) { final Attribute attribute = element.getAttributes().get(name); String varName; if (attribute != null) { varName = attribute.getValue(); offset = attribute.getValueSegment().getBegin(); } else { varName = ""; } checkNameForBugs(context, varName, varName, context.getFilename(), context.getFunctionName(), begLine, offset, bugs,null); } }