public Element getElement(int index) { if (index < 0) { throw new IndexOutOfBoundsException("Invalid line index=" + index + " < 0"); // NOI18N } int elementCount = getElementCount(); if (index >= elementCount) { throw new IndexOutOfBoundsException("Invalid line index=" + index // NOI18N + " >= lineCount=" + elementCount); // NOI18N } LineElement elem = (LineElement)super.getElement(index); assert (elem != null); return elem; }
public static String lineInfosToString(Document doc) { StringBuffer sb = new StringBuffer(); LineRootElement lineRoot = getLineRoot(doc); int lineCount = lineRoot.getElementCount(); for (int i = 0; i < lineCount; i++) { LineElement elem = (LineElement)lineRoot.getElement(i); sb.append("[" + i + "]: lineStartOffset=" + elem.getStartOffset() // NOI18N + ", info: " + elem.getSyntaxStateInfo() + "\n"); // NOI18N } return sb.toString(); }
private static void checkConsistency(Document doc) { // Check whether all syntax state infos (except for the first line) are non-null LineRootElement lineRoot = getLineRoot(doc); int lineCount = lineRoot.getElementCount(); for (int i = 1; i < lineCount; i++) { // skip the very first line LineElement elem = (LineElement)lineRoot.getElement(i); assert (elem.getSyntaxStateInfo() != null) : "Syntax state null at line " + i + " of " + lineCount; // NOI18N } }
static void invalidateAllSyntaxStateInfos(BaseDocument doc) { LineRootElement lineRoot = getLineRoot(doc); int elemCount = lineRoot.getElementCount(); for (int i = elemCount - 1; i >= 0; i--) { LineElement line = (LineElement)lineRoot.getElement(i); line.clearSyntaxStateInfo(); } }
private void checkConsistency() { int lineCount = getElementCount(); assert (lineCount > 0); // Should be 1 or greater int prevLineEndOffset = 0; for (int i = 0; i < lineCount; i++) { LineElement elem = (LineElement)getElement(i); assert (prevLineEndOffset == elem.getStartOffset()); assert (prevLineEndOffset < elem.getEndOffset()) : "Line " + i + " of " + lineCount + ": " + lineToString(elem); // NOI18N prevLineEndOffset = elem.getEndOffset(); } assert (prevLineEndOffset == (doc.getLength() + 1)); }
int lineCount = lineRoot.getElementCount(); while (++lineIndex < lineCount) { lineElem = lineRoot.getElement(lineIndex);
int lineCount = lineRoot.getElementCount(); DocumentEvent.ElementChange lineChange = evt.getChange(lineRoot); int lineIndex;