KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > samples > solitaire > Run


1 package org.objectweb.jac.samples.solitaire;
2
3 import org.objectweb.jac.lib.java.util.Vector;
4 import java.util.*;
5 import org.objectweb.jac.core.*;
6 import org.objectweb.jac.aspects.naming.*;
7
8 public class Run{
9     public static void main(String JavaDoc[] args) {
10
11         ((ACManager)ACManager.get()).declareAC(
12             "optimization",
13             "org.objectweb.jac.samples.solitaire.optimization.OptimizingAC");
14
15         Application app = new Application("solitaire",null,
16                                           "Run",null);
17
18         app.addAcConfiguration(
19             new ACConfiguration( app, "deployment",
20                                  "file:deployment.acc", true ) );
21
22         app.addAcConfiguration(
23             new ACConfiguration( app, "optimization",
24                                  null, false ) );
25
26         app.addAcConfiguration(
27             new ACConfiguration( app, "tracing",
28                                  "file:tracing.acc", true ) );
29
30         ApplicationRepository.get().addApplication( app );
31
32
33         byte[][] game = new byte[][] {
34             new byte[] {2,2,2,2,2,2,2,2,2,2,2} ,
35             new byte[] {2,2,2,2,2,2,2,2,2,2,2} ,
36             new byte[] {2,2,2,2,0,0,0,2,2,2,2} ,
37             new byte[] {2,2,2,2,0,0,0,2,2,2,2} ,
38             new byte[] {2,2,0,0,0,1,0,0,0,2,2} ,
39             new byte[] {2,2,0,0,1,1,1,0,0,2,2} ,
40             new byte[] {2,2,0,0,1,1,1,0,0,2,2} ,
41             new byte[] {2,2,2,2,0,0,0,2,2,2,2} ,
42             new byte[] {2,2,2,2,0,0,0,2,2,2,2} ,
43             new byte[] {2,2,2,2,2,2,2,2,2,2,2} ,
44             new byte[] {2,2,2,2,2,2,2,2,2,2,2}
45         } ;
46         Vector v = new Vector();
47         Configuration root= new Configuration(32,game,null);
48         Date d3 = new Date();
49         root.createChildren();
50         Date d4 = new Date();
51         System.out.println("Temps total mis : " + (d4.getTime()-d3.getTime()));
52
53         root.printTree();
54
55         System.out.println("-------- END ---------");
56         //root.printTree();
57

58       // if ( true ) return;
59

60       /* new Vector().add( new Vector() );
61
62       java.util.Vector v = new java.util.Vector();
63       
64       Date d3 = new Date();
65       for ( int i=0; i<1000; i ++ ) {
66          v.add( new Vector() );
67       }
68       Date d4 = new Date();
69       System.out.println("Temps total mis : " + (d4.getTime()-d3.getTime()));*/

70       /*
71       Vector current = new Vector();
72       System.out.println( "********************************" );
73       current.add( new Configuration(32,game,null) );
74       System.out.println( "********************************" );
75       Vector next = new Vector();
76       int x = 0;
77       boolean finish = true;
78       do {
79          x++;
80          Date d1 = new Date();
81          //System.out.println( "******************************** Next step for :" );
82           // System.out.println( current );
83          for ( int i=0; i < current.size(); i++ ) {
84             Configuration curC = (Configuration)current.get(i);
85             System.out.println("creating childrens for ");
86             curC.printGame();
87             next.addAll ( curC.createChildren() );
88             //System.out.println( "****************** taille : " + next.size() );
89          }
90          //System.out.println( next.toString() );
91          Date d2 = new Date();
92          System.out.println( next.size() );
93          System.out.println("Temps total mis : " + (d2.getTime()-d1.getTime()));
94          finish = true;
95          if (next.size() > 0) {
96             current = next;
97             finish = false;
98          }
99          next = new Vector();
100       } while ( finish == false );
101       // System.out.println( current );
102             
103       Configuration affichage = new Configuration(0, game , null);*/

104       
105       /* for (int b=0; b < current.size(); b++) {
106          affichage = (Configuration)current.get(b);
107          System.out.println("--------------------------------------------------" );
108          for ( int a=0; a < x; a++ ) {
109             System.out.println( affichage );
110             affichage = affichage.parent;
111          }
112          }*/

113     }
114    
115 }
116
117
118
Popular Tags