1 21 22 package org.apache.derby.impl.store.access.sort; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 import org.apache.derby.iapi.types.DataValueDescriptor; 26 import org.apache.derby.impl.sql.execute.RowUtil; 27 28 33 34 final class Node 35 { 36 public int balance; 37 public Node leftLink; 38 public Node rightLink; 39 public DataValueDescriptor[] key; 40 public int id; 41 public Node dupChain; 42 public int aux; 43 44 public Node(int id) 45 { 46 this.id = id; 47 reset(); 48 } 49 50 public void reset() 51 { 52 balance = 0; 53 leftLink = null; 54 rightLink = null; 55 key = null; 56 dupChain = null; 57 aux = 0; 58 } 60 61 public Node link(int which) 62 { 63 if (which < 0) 64 return leftLink; 65 else 66 return rightLink; 67 } 68 69 public void setLink(int which, Node l) 70 { 71 if (which < 0) 72 leftLink = l; 73 else 74 rightLink = l; 75 } 76 77 DataValueDescriptor[] getKey() 78 { 79 return key; 80 } 81 82 public String toString() 83 { 84 if (SanityManager.DEBUG) 85 { 86 int lid = (leftLink == null) ? -1 : leftLink.id; 87 int rid = (rightLink == null) ? -1 : rightLink.id; 88 int did = (dupChain == null) ? -1 : dupChain.id; 89 return "{" 90 + " id=" + id 91 + " key=" + RowUtil.toString(key) 92 + " left=" + lid 93 + " right=" + rid 94 + " balance=" + balance 95 + " dupChain=" + did 96 + " aux= " + aux 97 + " }"; 98 } 99 else 100 { 101 return(null); 102 } 103 } 104 } 105 | Popular Tags |