/** * Creates and returns a new line. * * @param createAndUpdateSeparately if true, creates a line, then sets the attributes as a * separate operation. Otherwise, sets them all at once. We want to test both scenarios. */ Line create(int index, Type type, int indent, boolean createAndUpdateSeparately) { // info("Creating @" + index + " " + // type + " " + indent + " " + createAndUpdateSeparately); Point<ContentNode> loc = doc.locate(index * 2 + 1); Line l; if (createAndUpdateSeparately) { l = Line.fromLineElement(doc.createElement(loc, "line", Attributes.EMPTY_MAP)); update(index, type, indent); } else { l = Line.fromLineElement( doc.createElement(loc, "line", attributes(type, indent, false, true))); } assertNotNull(l); return l; }
/** @return the line element for the given index. */ ContentElement getLineElement(int index) { return doc.locate(index * 2 + 1).getNodeAfter().asElement(); }