void put(String s, int idx, E value) { if (idx == s.length()) { result = value; return; } char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { // copy and add final int oldLength = matches.length; final char[] newMatches = Arrays.copyOf(matches, oldLength + 1); final TrieNode<E>[] newChildren = Arrays.copyOf(children, oldLength + 1); // i is the negated insertion index final int insertIndex = -i - 1; System.arraycopy(newMatches, insertIndex, newMatches, insertIndex + 1, oldLength - insertIndex); System.arraycopy(newChildren, insertIndex, newChildren, insertIndex + 1, oldLength - insertIndex); newMatches[insertIndex] = c; final TrieNode<E> newNode = new TrieNode<>(); newChildren[insertIndex] = newNode; matches = newMatches; children = newChildren; newNode.put(s, idx + 1, value); } else { children[i].put(s, idx + 1, value); } }
if (i == length || Character.isWhitespace(c) || c == ',') { final E action = rootNode.get(actionString, start, i); if (action == null) { throw permission.invalidAction(actionString.substring(start, i), start, actionString);
if (i == length || Character.isWhitespace(c) || c == ',') { final E action = rootNode.get(actionString, start, i); if (action == null) { throw permission.invalidAction(actionString.substring(start, i), start, actionString);
if (i == length || Character.isWhitespace(c) || c == ',') { final E action = rootNode.get(actionString, start, i); if (action == null) { throw permission.invalidAction(actionString.substring(start, i), start, actionString);
if (i == length || Character.isWhitespace(c) || c == ',') { final E action = rootNode.get(actionString, start, i); if (action == null) { throw permission.invalidAction(actionString.substring(start, i), start, actionString);
if (i == length || Character.isWhitespace(c) || c == ',') { final E action = rootNode.get(actionString, start, i); if (action == null) { throw permission.invalidAction(actionString.substring(start, i), start, actionString);
void put(String s, int idx, E value) { if (idx == s.length()) { result = value; return; } char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { // copy and add final int oldLength = matches.length; final char[] newMatches = Arrays.copyOf(matches, oldLength + 1); final TrieNode<E>[] newChildren = Arrays.copyOf(children, oldLength + 1); // i is the negated insertion index final int insertIndex = -i - 1; System.arraycopy(newMatches, insertIndex, newMatches, insertIndex + 1, oldLength - insertIndex); System.arraycopy(newChildren, insertIndex, newChildren, insertIndex + 1, oldLength - insertIndex); newMatches[insertIndex] = c; final TrieNode<E> newNode = new TrieNode<>(); newChildren[insertIndex] = newNode; matches = newMatches; children = newChildren; newNode.put(s, idx + 1, value); } else { children[i].put(s, idx + 1, value); } }
void put(String s, int idx, E value) { if (idx == s.length()) { result = value; return; } char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { // copy and add final int oldLength = matches.length; final char[] newMatches = Arrays.copyOf(matches, oldLength + 1); final TrieNode<E>[] newChildren = Arrays.copyOf(children, oldLength + 1); // i is the negated insertion index final int insertIndex = -i - 1; System.arraycopy(newMatches, insertIndex, newMatches, insertIndex + 1, oldLength - insertIndex); System.arraycopy(newChildren, insertIndex, newChildren, insertIndex + 1, oldLength - insertIndex); newMatches[insertIndex] = c; final TrieNode<E> newNode = new TrieNode<>(); newChildren[insertIndex] = newNode; matches = newMatches; children = newChildren; newNode.put(s, idx + 1, value); } else { children[i].put(s, idx + 1, value); } }
void put(String s, int idx, E value) { if (idx == s.length()) { result = value; return; } char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { // copy and add final int oldLength = matches.length; final char[] newMatches = Arrays.copyOf(matches, oldLength + 1); final TrieNode<E>[] newChildren = Arrays.copyOf(children, oldLength + 1); // i is the negated insertion index final int insertIndex = -i - 1; System.arraycopy(newMatches, insertIndex, newMatches, insertIndex + 1, oldLength - insertIndex); System.arraycopy(newChildren, insertIndex, newChildren, insertIndex + 1, oldLength - insertIndex); newMatches[insertIndex] = c; final TrieNode<E> newNode = new TrieNode<>(); newChildren[insertIndex] = newNode; matches = newMatches; children = newChildren; newNode.put(s, idx + 1, value); } else { children[i].put(s, idx + 1, value); } }
void put(String s, int idx, E value) { if (idx == s.length()) { result = value; return; } char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { // copy and add final int oldLength = matches.length; final char[] newMatches = Arrays.copyOf(matches, oldLength + 1); final TrieNode<E>[] newChildren = Arrays.copyOf(children, oldLength + 1); // i is the negated insertion index final int insertIndex = -i - 1; System.arraycopy(newMatches, insertIndex, newMatches, insertIndex + 1, oldLength - insertIndex); System.arraycopy(newChildren, insertIndex, newChildren, insertIndex + 1, oldLength - insertIndex); newMatches[insertIndex] = c; final TrieNode<E> newNode = new TrieNode<>(); newChildren[insertIndex] = newNode; matches = newMatches; children = newChildren; newNode.put(s, idx + 1, value); } else { children[i].put(s, idx + 1, value); } }
E get(String s, int idx, int end) { if (idx == end) { return result; } final char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { return null; } return children[i].get(s, idx + 1, end); } }
E get(String s, int idx, int end) { if (idx == end) { return result; } final char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { return null; } return children[i].get(s, idx + 1, end); } }
E get(String s, int idx, int end) { if (idx == end) { return result; } final char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { return null; } return children[i].get(s, idx + 1, end); } }
E get(String s, int idx, int end) { if (idx == end) { return result; } final char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { return null; } return children[i].get(s, idx + 1, end); } }
E get(String s, int idx, int end) { if (idx == end) { return result; } final char c = s.charAt(idx); final int i = Arrays.binarySearch(matches, c); if (i < 0) { return null; } return children[i].get(s, idx + 1, end); } }