static protected void assertValidGetKey(String key) throws NullPointerException, IllegalArgumentException { assertValidKey(key); int len = key.length(); for (int i = 0; i < len; i++) { char c = key.charAt(i); int index = toNodeArrayIndex(c); if (index < 0 || index >= 10) { throw new IllegalArgumentException("Illegal key [" + key + "]: unsupported char [" + c + "] at index [" + i + "]"); } } }
/** * Prints out a dump of the hierarchy of this AddressTree * to the specified PrintStream. */ public void debug(java.io.PrintStream out) { // start at parent node... dumpNode(root, 0, -2, out); }
printSpaces(level, out); dumpNode(node.getNode(index), level + 1, index, out);
@Override public V get(String key) throws IllegalArgumentException { assertValidGetKey(key); index = toNodeArrayIndex(c);
assertValidPutKey(key); index = toNodeArrayIndex(c);
printSpaces(level, out); dumpNode(node.getNode(index), level + 1, index, out);
@Override public V get(String key) throws IllegalArgumentException { assertValidGetKey(key); index = toNodeArrayIndex(c);
assertValidPutKey(key); index = toNodeArrayIndex(c);
static protected void assertValidGetKey(String key) throws NullPointerException, IllegalArgumentException { assertValidKey(key); int len = key.length(); for (int i = 0; i < len; i++) { char c = key.charAt(i); int index = toNodeArrayIndex(c); if (index < 0 || index >= 10) { throw new IllegalArgumentException("Illegal key [" + key + "]: unsupported char [" + c + "] at index [" + i + "]"); } } }
/** * Prints out a dump of the hierarchy of this AddressTree * to the specified PrintStream. */ public void debug(java.io.PrintStream out) { // start at parent node... dumpNode(root, 0, -2, out); }
static protected void assertValidPutKey(String key) throws NullPointerException, IllegalArgumentException { assertValidKey(key); int len = key.length(); for (int i = 0; i < len; i++) { char c = key.charAt(i); int index = toNodeArrayIndex(c); if (index < 0) { throw new IllegalArgumentException("Illegal key [" + key + "]: unsupported char [" + c + "] at index [" + i + "]"); } else if (index == 10 && (i+1) != len) { throw new IllegalArgumentException("Illegal key [" + key + "]: [*] can only be the last char in key"); } } }
static protected void assertValidPutKey(String key) throws NullPointerException, IllegalArgumentException { assertValidKey(key); int len = key.length(); for (int i = 0; i < len; i++) { char c = key.charAt(i); int index = toNodeArrayIndex(c); if (index < 0) { throw new IllegalArgumentException("Illegal key [" + key + "]: unsupported char [" + c + "] at index [" + i + "]"); } else if (index == 10 && (i+1) != len) { throw new IllegalArgumentException("Illegal key [" + key + "]: [*] can only be the last char in key"); } } }