TwoDTreeExample.java
Go to the documentation of this file.
00001 /*
00002  * (c) copyright 2008, Technische Universitaet Graz and Technische Universitaet Wien
00003  *
00004  * This file is part of jdiagengine.
00005  *
00006  * jdiagengine is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * jdiagengine is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * You should have received a copy of the GNU General Public License
00016  * along with jdiagengine. If not, see <http://www.gnu.org/licenses/>.
00017  *
00018  * Authors: Joerg Weber, Franz Wotawa
00019  * Contact: jweber@ist.tugraz.at (preferred), or fwotawa@ist.tugraz.at
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 }


tug_ist_diagnosis_engine
Author(s): Safdar Zaman, Gerald Steinbauer
autogenerated on Mon Jan 6 2014 11:51:16