< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/share/gc/NonbranchyTree.java

Print this page

154      *
155      */
156     public void print(PrintStream out) {
157         print(out, root);
158     }
159 
160     // Print the sub-tree from the specified node and down
161     private void print(PrintStream out, Node node) {
162         node.print(out);
163         if (node.left != null)
164             print(out, node.left);
165         if (node.right != null)
166             print(out, node.right);
167     }
168 }
169 
170 // The class defines a node of a tree
171 class Node {
172     Node left;
173     Node right;
174     byte[] core;
175 
176     Node(int size) {
177         left = null;
178         right = null;
179         core = new byte[size];












180 
181         // Initizlize the core array
182         for (int i = 0; i < size; i++)
183             core[i] = (byte) i;
184     }
185 
186     // Print the node info
187     void print(PrintStream out) {
188         out.println("node = " + this + " (" + left + ", " + right + ")");
189     }
190 }

154      *
155      */
156     public void print(PrintStream out) {
157         print(out, root);
158     }
159 
160     // Print the sub-tree from the specified node and down
161     private void print(PrintStream out, Node node) {
162         node.print(out);
163         if (node.left != null)
164             print(out, node.left);
165         if (node.right != null)
166             print(out, node.right);
167     }
168 }
169 
170 // The class defines a node of a tree
171 class Node {
172     Node left;
173     Node right;
174     Object storage;
175 
176     Node(int size) {
177         left = null;
178         right = null;
179         // Initialize the core array
180         if (Memory.isValhallaEnabled()) {
181             Byte[] core = new Byte[size];
182             for (int i = 0; i < core.length; i++) {
183                 core[i] = (byte) i;
184             }
185             storage = core;
186         } else {
187             byte[] core = new byte[size];
188             for (int i = 0; i < size; i++)
189                 core[i] = (byte) i;
190             storage = core;
191         }
192 



193     }
194 
195     // Print the node info
196     void print(PrintStream out) {
197         out.println("node = " + this + " (" + left + ", " + right + ")");
198     }
199 }
< prev index next >