MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / append

Method append

src/main/java/wycc/util/Trie.java:199–220  ·  view source on GitHub ↗
(final String component)

Source from the content-addressed store, hash-verified

197 }
198
199 public Trie append(final String component) {
200 int index = binarySearch(children, nchildren, component);
201 if(index >= 0) {
202 return children[index];
203 }
204
205 Trie nt = new Trie(this,component);
206 index = -index - 1; // calculate insertion point
207
208 if((nchildren+1) < children.length) {
209 System.arraycopy(children, index, children, index+1, nchildren - index);
210 } else {
211 Trie[] tmp = new Trie[children.length * 2];
212 System.arraycopy(children, 0, tmp, 0, index);
213 System.arraycopy(children, index, tmp, index+1, nchildren - index);
214 children = tmp;
215 }
216
217 children[index] = nt;
218 nchildren++;
219 return nt;
220 }
221
222 public Trie append(final Trie t) {
223 Trie r = this;

Callers 15

subpathMethod · 0.95
fromStringMethod · 0.95
fromStringsMethod · 0.95
fromNativeStringMethod · 0.95
mainMethod · 0.95
putUnitMethod · 0.45
putExternMethod · 0.45
addAttributeMethod · 0.45
writeTypeMangleMethod · 0.45
writeTypeMangleArrayMethod · 0.45
writeTypeMangleRecordMethod · 0.45

Calls 3

binarySearchMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected