TestTree.java 730 B

12345678910111213141516171819202122232425262728
  1. package oram;
  2. import java.math.BigInteger;
  3. import util.Util;
  4. public class TestTree {
  5. public static void main(String[] args) {
  6. Metadata md = new Metadata();
  7. Tree tree = new Tree(2, md, null);
  8. long tupleCounter = 0;
  9. for (long i = 0; i < tree.getNumBuckets(); i++) {
  10. Bucket bucket = tree.getBucket(i);
  11. for (int j = 0; j < bucket.getNumTuples(); j++) {
  12. bucket.getTuple(j).setA(Util.rmSignBit(BigInteger.valueOf(tupleCounter).toByteArray()));
  13. tupleCounter++;
  14. }
  15. }
  16. BigInteger L = new BigInteger("0110011", 2);
  17. System.out.println(L.toString(2));
  18. Bucket[] pathBuckets = tree.getBucketsOnPath(L.longValue());
  19. for (int i = 0; i < pathBuckets.length; i++)
  20. System.out.println(pathBuckets[i]);
  21. }
  22. }