+ * This is to avoid ambiguity as node ranges tend to 'join'
+ * together so that the end region of one node coincides with
+ * the start region of the next node. By treating node ranges
+ * as 'half open' intervals every offset is typically only
+ * part of two different nodes if those nodes effectively
+ * have overlapping ranges (i.e. only if one node contains
+ * the other). Thus, an operation like finding the smallest
+ * node that contains an offset is unambgious.
+ */
+ public static boolean contains(Node node, int offset) {
+ return getStart(node)<=offset && offset