Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 package utils;
00025
00026 import java.util.*;
00027
00028 public class TwoDTreeExample
00029 {
00030
00031 public static void main (String[] args) {
00032 TwoDTree top;
00033 Object obj;
00034
00035 top = new TwoDTree("n0",10,3);
00036 top.addElement("n1",10,4);
00037 top.addElement("n2",10,2);
00038 top.addElement("n3",8,5);
00039 top.addElement("n4",12,2);
00040
00041 System.out.println("TREE: ");
00042 System.out.println(top.toString());
00043 System.out.println("size = " + (new Integer(top.size())).toString());
00044 System.out.println("Elements ..." + (top.elementsVector()).toString());
00045
00046 obj = top.get(10,2);
00047 if (obj == null) {
00048 System.out.println("(10,2) NULL");
00049 } else {
00050 System.out.println("(10,2) " + obj.toString());
00051 }
00052
00053 obj = top.get(10,3);
00054 if (obj == null) {
00055 System.out.println("(10,3) NULL");
00056 } else {
00057 System.out.println("(10,3) " + obj.toString());
00058 }
00059
00060 obj = top.get(12,1);
00061 if (obj == null) {
00062 System.out.println("(12,1) NULL");
00063 } else {
00064 System.out.println("(12,1) " + obj.toString());
00065 }
00066
00067 obj = top.get(12,2);
00068 if (obj == null) {
00069 System.out.println("(12,2) NULL");
00070 } else {
00071 System.out.println("(12,2) " + obj.toString());
00072 }
00073
00074 Vector result = top.getAll(10,2,10,3);
00075 System.out.println(result.toString());
00076
00077 result = top.getAll(0,0,10,10);
00078 System.out.println(result.toString());
00079
00080 result = top.getAll(12,2,12,2);
00081 System.out.println(result.toString());
00082
00083 result = top.getAll(1,2,9,4);
00084 System.out.println(result.toString());
00085
00086 }
00087
00088 }