public boolean isPositionedBefore(int line, int column){ if (line==ABSOLUTE_END_LINE) return true; if (getEndLine()<line){ return true; } else if (getEndLine()==line){ return getEndColumn()<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); }