示例#1
0
 /**
  * Creates binary tree from the linked list.
  *
  * @param linkedList    Orderer ByteData as linked list
  */
 public void createBinaryTreeFromLinkedList(ByteDataLinkedList linkedList)
 {
     linkedList.startIteration();
     while (linkedList.checkObject() != null)
     {
         this.root = new ByteData((byte)0);
         ByteData left  = linkedList.nextObject();
         ByteData right = linkedList.nextObject();
         this.root.setLeftChild(left);
         this.root.setRightChild(right);
         left.setParent(this.root);
         right.setParent(this.root);
         this.root.setCount(left.getCount() + right.getCount());
         linkedList.add(this.root);
     }
 }
示例#2
0
 public void afterInitialization()
 {
     byteDataLinkedList.startIteration();
     Assert.Equal(null, byteDataLinkedList.checkObject());
 }