/** * Interns {@link #label} */ /* package */void dedup(final Map<String, char[]> table) { String l = getLabel(); char[] v = table.get(l); if (v != null) { label = v; } else { table.put(l, label); } }
/** * Inserts a new node between this node and its parent, and returns the * newly inserted node. * <p> * This operation doesn't change the string representation of this node. */ /* package */TreeString split(final String prefix) { assert getLabel().startsWith(prefix); char[] suffix = new char[label.length - prefix.length()]; System.arraycopy(label, prefix.length(), suffix, 0, suffix.length); TreeString middle = new TreeString(parent, prefix); label = suffix; parent = middle; return middle; }
/** * Inserts a new node between this node and its parent, and returns that * node. Newly inserted 'middle' node will have this node as its sole * child. */ private Child split(final String prefix) { String suffix = node.getLabel().substring(prefix.length()); Child middle = new Child(node.split(prefix)); middle.makeWritable(); middle.children.put(suffix, this); return middle; }
/** * Interns {@link #label} */ /* package */void dedup(final Map<String, char[]> table) { String l = getLabel(); char[] v = table.get(l); if (v != null) { label = v; } else { table.put(l, label); } }
/** * Inserts a new node between this node and its parent, and returns the * newly inserted node. * <p> * This operation doesn't change the string representation of this node. */ /* package */TreeString split(final String prefix) { assert getLabel().startsWith(prefix); char[] suffix = new char[label.length - prefix.length()]; System.arraycopy(label, prefix.length(), suffix, 0, suffix.length); TreeString middle = new TreeString(parent, prefix); label = suffix; parent = middle; return middle; }
/** * Inserts a new node between this node and its parent, and returns that * node. Newly inserted 'middle' node will have this node as its sole * child. */ private Child split(final String prefix) { String suffix = node.getLabel().substring(prefix.length()); Child middle = new Child(node.split(prefix)); middle.makeWritable(); middle.children.put(suffix, this); return middle; }