MCPcopy Create free account
hub / github.com/ReadyTalk/avian / query

Method query

test/extra/QueryDump.java:80–109  ·  view source on GitHub ↗
(Map<Integer, Node> nodes, Record[] query,
                            List<Instance> stack, int index)

Source from the content-addressed store, hash-verified

78 }
79
80 private static void query(Map<Integer, Node> nodes, Record[] query,
81 List<Instance> stack, int index)
82 {
83 Node node = nodes.get(peek(stack, index).key);
84 if (node != null) {
85 int base = node.index();
86 for (int i = base + 1; i < query.length; ++i) {
87 int peek = index + i - base;
88 if (peek < stack.size()) {
89 Instance instance = peek(stack, peek);
90 if (query[i] == instance.record) {
91 TreeNode next = (TreeNode) nodes.get(instance);
92 if (next == null) {
93 nodes.put(instance.key, next = new TreeNode(instance, i));
94 }
95 next.children.add(node);
96 node = next;
97 } else {
98 return;
99 }
100 } else {
101 return;
102 }
103 }
104
105 if (index + query.length - base < stack.size()) {
106 nodes(peek(stack, index + query.length - base).record).add(node);
107 }
108 }
109 }
110
111 private static void query(Map<Integer, Node> nodes, Record[] query,
112 List<Instance> stack)

Callers 1

readMethod · 0.95

Calls 7

peekMethod · 0.95
indexMethod · 0.95
nodesMethod · 0.95
getMethod · 0.65
sizeMethod · 0.65
putMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected