You are on page 1of 3

public class TestMaman18 {

public static void main (String[] args) {
TaxiQueue tq = new TaxiQueue();
System.out.println (tq);
System.out.println ("enqueue");
tq.enqueue (new Taxi (13, "driverC"));
System.out.println (tq);
System.out.println ("enqueue");
tq.enqueue (new Taxi (11, "driverA"));
System.out.println (tq);
System.out.println ("enqueue");
tq.enqueue (new Taxi (12, "driverB"));
System.out.println (tq);
System.out.println ("enqueue");
tq.enqueue (new Taxi (15, "driverE"));
System.out.println (tq);
tq.enqueue (new Taxi (14, "driverD"));
System.out.println (tq);
System.out.println ("sort");
tq.sort();
System.out.println (tq);
System.out.println ("topQueue");
Taxi t1 = tq.topQueue ();
System.out.println (t1);
System.out.println (tq);
System.out.println ("dequeue");
t1 = tq.dequeue ();
System.out.println (t1);
System.out.println (tq);
System.out.println ("dequeue");
t1 = tq.dequeue ();
System.out.println (t1);
System.out.println (tq);
System.out.println ("dequeue");
t1 = tq.dequeue ();
System.out.println (t1);
System.out.println (tq);
System.out.println ("dequeue");
t1 = tq.dequeue ();
System.out.println (tq);
System.out.println ("dequeue");
t1 = tq.dequeue ();
System.out.println (t1);
System.out.println (tq);
System.out.println ("dequeue");
t1 = tq.dequeue ();
System.out.println (t1);
System.out.println (tq);
Node [] n = new Node [10];
n[1] = new Node (2,null,null);
n[2] = new Node (35,n[1],null);
n[3] = new Node (23,null,n[2]);
n[4] = new Node (12,null,null);
n[5] = new Node (5,null,n[4]);
n[6] = new Node (18,n[5],null);
n[7] = new Node (20,n[6],n[3]);
n[8] = new Node (10,null,null);
n[0] = new Node (15,n[8],n[7]);
System.out.println ("method h():");
for (int i=0;i < 9; i++)

System.out.println ("h(" + n[i].getNumber()+") = " + Bin
aryTree.h(n[i]));
System.out.println ("\nmethod something():");
for (int i=0;i < 9; i++)
System.out.println ("something(" + n[i].getNumber()+") =
" + BinaryTree.something(n[i]));
System.out.println ("\nmethod what():");
for (int i=0;i < 9; i++)
System.out.println ("what(" + n[i].getNumber()+") = " +
BinaryTree.what(n[i]));
System.out.println ("\nBinary tree:");
BinaryTree.level (n[0]);
n[1] = new Node (2,null,null);
n[2] = new Node (5,null,n[1]);
n[3] = new Node (1,null,null);
n[4] = new Node (2,null,null);
n[5] = new Node (3,n[3],n[4]);
n[0] = new Node (13,n[5],n[2]);
System.out.println ("\nBinary tree:");
BinaryTree.level (n[0]);
for (int i=0;i < 6; i++)
System.out.println ("isSigma(" + n[i].getNumber()+ ") =
" + BinaryTree.isSigma(n[i]));
n[1] = new Node (2,null,null);
n[2] = new Node (5,null,n[1]);
n[3] = new Node (1,null,null);
n[4] = new Node (3,null,null);
n[5] = new Node (3,n[3],n[4]);
n[0] = new Node (13,n[5],n[2]);
System.out.println ("\nBinary tree:");
BinaryTree.level (n[0]);
for (int i=0;i < 6; i++)
System.out.println ("isSigma(" + n[i].getNumber()+ ") =
" + BinaryTree.isSigma(n[i]));
n[1] = new Node (1,null,null);
n[2] = new Node (4,null,n[1]);
n[3] = new Node (3,null,null);
n[4] = new Node (2,null,null);
n[5] = new Node (4,n[3],n[4]);
n[0] = new Node (13,n[5],n[2]);
System.out.println ("\nBinary tree:");
BinaryTree.level (n[0]);
for (int i=0;i < 6; i++)
System.out.println ("isSigma(" + n[i].getNumber()+ ") =
" + BinaryTree.isSigma(n[i]));
n[1] = new Node (1,null,null);
n[2] = new Node (4,null,n[1]);
n[3] = new Node (3,null,null);
n[4] = new Node (2,null,null);
n[5] = new Node (5,n[3],n[4]);
n[0] = new Node (13,n[5],n[2]);
System.out.println ("\nBinary tree:");
BinaryTree.level (n[0]);
for (int i=0;i < 6; i++)
System.out.println ("isSigma(" + n[i].getNumber()+ ") =
" + BinaryTree.isSigma(n[i]));
n[1] = new Node (1,null,null);
n[2] = new Node (4,null,n[1]);
n[3] = new Node (3,null,null);
n[4] = new Node (2,null,null);

n[5] = new Node (5,n[3],n[4]);
n[0] = new Node (15,n[5],n[2]);
System.out.println ("\nBinary tree:");
BinaryTree.level (n[0]);
for (int i=0;i < 6; i++)
System.out.println ("isSigma(" + n[i].getNumber()+ ") =
" + BinaryTree.isSigma(n[i]));
n[1] = new Node (5,null,null);
n[2] = new Node (4,null,n[1]);
n[3] = new Node (3,null,null);
n[4] = new Node (2,null,null);
n[5] = new Node (5,n[3],n[4]);
n[0] = new Node (15,n[5],n[2]);
System.out.println ("\nBinary tree:");
BinaryTree.level (n[0]);
for (int i=0;i < 6; i++)
System.out.println ("isSigma(" + n[i].getNumber()+ ") =
" + BinaryTree.isSigma(n[i]));
}
}