public static boolean areInOrder(Node a, Node b){ return (a.getBeginLine()<b.getBeginLine()) || (a.getBeginLine()==b.getBeginLine() && a.getBeginColumn()<b.getBeginColumn() ); } }
public boolean isPositionedAfter(int line, int column){ if (line==ABSOLUTE_BEGIN_LINE) return true; if (getBeginLine()>line){ return true; } else if (getBeginLine()==line){ return getBeginColumn()>column; } else { return false; } }
public boolean contains(Node other){ if (getBeginLine()>other.getBeginLine()) return false; if (getBeginLine()==other.getBeginLine() && getBeginColumn()>other.getBeginColumn()) return false; if (getEndLine()<other.getEndLine()) return false; if (getEndLine()==other.getEndLine() && getEndColumn()<other.getEndColumn()) return false; return true; }
final String clip(Node node) { CU cu = getCU(); // Get offset of the fragment int from = cu.sb.offset(Position.get(node.getBeginLine() - 1, 0)); int to = cu.sb.offset(Position.get(node.getEndLine() - 1, node.getEndColumn())); // Get relevant chars return cu.source.substring(from, to); }