MCPcopy Create free account
hub / github.com/davidgiven/luje / Node

Class Node

lib/java/util/TreeMap.java:123–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 }
122
123 static class Node <K,V> implements Cloneable {
124 static final int NODE_SIZE = 64;
125 Node<K, V> prev, next;
126 Node<K, V> parent, left, right;
127 V[] values;
128 K[] keys;
129 int left_idx = 0;
130 int right_idx = -1;
131 int size = 0;
132 boolean color;
133
134 public Node() {
135 keys = (K[]) new Object[NODE_SIZE];
136 values = (V[]) new Object[NODE_SIZE];
137 }
138
139 @SuppressWarnings("unchecked")
140 Node<K, V> clone(Node<K, V> parent) throws CloneNotSupportedException {
141 Node<K, V> clone = (Node<K, V>) super.clone();
142 clone.keys = (K[]) new Object[NODE_SIZE];
143 clone.values = (V[]) new Object[NODE_SIZE];
144 System.arraycopy(keys, 0, clone.keys, 0, keys.length);
145 System.arraycopy(values, 0, clone.values, 0, values.length);
146 clone.left_idx = left_idx;
147 clone.right_idx = right_idx;
148 clone.parent = parent;
149 if (left != null) {
150 clone.left = left.clone(clone);
151 }
152 if (right != null) {
153 clone.right = right.clone(clone);
154 }
155 clone.prev = null;
156 clone.next = null;
157 return clone;
158 }
159 }
160
161 @SuppressWarnings("unchecked")
162 private static <T> Comparable<T> toComparable(T obj) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected