1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
| public static void afficheenteteLigne()throws JDOMException, IOException
{
TestXml xml = new TestXml() ;
Element root = xml.getRoot("C:\\Users\\faten\\Desktop\\Tentative FiNALParcTool\\xmlparser\\src\\default.editeurparctool.xml") ;
ArrayList<ContainTask> TaskC = xml.getContainTask(root);
ArrayList<Place> Places = xml.getPlaces(root);
ArrayList <ArrayList> Matrice = new ArrayList<ArrayList>();
Matrice.add(0,TaskC);
Matrice.add(1,Places);
ArrayList<Place> Procstab = new ArrayList<Place>();
ArrayList<Place> TitoTi = new ArrayList<Place>(); // if (p.getIplace == p.getJplaace) ==> titoTi
ArrayList<Place> TitoTj = new ArrayList<Place>();
int nbTache= TaskC.size();
int nbLigne=15;
int nbPlaces=Places.size();
//System.out.println();
for(int i = 0; i <= 1; i++)
{
ArrayList s = Matrice.get(i);
if(i==1)
{
for (int j = 0; j < s.size(); j++)
{
Place p = new Place();
p = (Place) s.get(j) ;
if(p.getTypePlace()==9) // proc
{
Procstab.add(p) ;
}//System.out.print(Procstab);
if(p.getTypePlace()==10)
{
TitoTi.add(p) ;
}//System.out.print(TitoTi);
if(p.getTypePlace()==11)
{
TitoTj.add(p) ;
}
// System.out.print(TitoTj);
}
}
}
for ( int i = 0 ; i < nbTache; i++ ) //ligne
{
for ( int l = 0 ; l <nbLigne; l++ )
{if (l ==0){System.out.println("P" +(i+1)+"Uncreated " );}
if (l ==1){System.out.println("P" +(i+1)+"DeadLine " );}
if (l ==2){System.out.println("P" +(i+1)+"RemainingPeriod" );}
if (l ==3){System.out.println("P" +(i+1)+"Created " );}
if (l ==4){System.out.println("P" +(i+1)+"ElapsedPeriod " );}
if (l ==5){System.out.println("P" +(i+1)+"ReceivedData " );}
if (l ==6){System.out.println("P" +(i+1)+"Ready " );}
if (l ==7){System.out.println("P" +(i+1)+"Disabled " );}
if (l ==8){System.out.println("P" +(i+1)+"Activated " );}
if (l ==9){System.out.println("P" +(i+1)+"GetProc " );}
if (l ==10){System.out.println("P" +(i+1)+"IncreExec " ); }
if (l ==11){System.out.println("P" +(i+1)+"Maker " ); }
if (l ==12){System.out.println("P" +(i+1)+"e" +(i+1)+" " ); }
if (l ==13){System.out.println("P" +(i+1)+"ReleaseProc " );}
if (l ==14){System.out.println("P" +(i+1)+"DataToSend " );}
}
}
//System.out.println();
for ( int l = nbTache*nbLigne ; l <=nbTache*nbLigne+nbPlaces ; l++ )
{int tailleProcstab =Procstab.size();
int tailleTitoTi=TitoTi.size();
int tailleTitoTj=TitoTj.size();
//affichage des lignes string normal
/*ordre dont j'ai fait le traitement indice place/task/xml
l'ordre: "uncreated""DeadLine" "RemainingPeriod" "Ready" "GetProc" "Releasing" "DataToSend" "ReceivedData"*/
int nb = nbTache*nbLigne+tailleTitoTi;
int nb1 =nb+tailleProcstab ;
if(l>=nbTache*nbLigne && l <(nbTache*nbLigne+tailleTitoTi)) //TitoTi
{
for(l=nbTache*nbLigne;l <(nbTache*nbLigne+tailleTitoTi);l++)
{
System.out.println(TitoTi.get(l-nbTache*nbLigne)+" " );//T1toT1.....T1toT13
}
}
if(l>=nb && l < (nb + tailleProcstab+1)&& l <nb1) // Proc
{
for(l=nb;l <(nb + tailleTitoTi+1)&& l <nb1;l++)
{
System.out.println(Procstab.get(l-nb)+" ");//proc 1/2/3/4
}
}
if(l>=nb1 && l < (nb1+tailleTitoTj))//TitoTj
{
for(l=nb1;l <(nb1+tailleTitoTj);l++)
{
System.out.println(TitoTj.get(l-nb1)+" ");
}
}
}
}
public static void afficheenteteColonne()throws JDOMException, IOException{
TestXml xml = new TestXml() ;
Element root = xml.getRoot("C:\\Users\\faten\\Desktop\\Tentative FiNALParcTool\\xmlparser\\src\\default.editeurparctool.xml") ;
ArrayList<ContainTask> TaskC = xml.getContainTask(root);
int nbTache= TaskC.size();
int nbColonne=9;
System.out.print(" ");
for ( int j = 0 ; j < nbTache; j++ ) //colonne
{ System.out.print(" ");
for ( int k = 0 ; k <nbColonne; k++ )
{
System.out.print(" ");
if (k ==0){System.out.print("T"+(j+1)+"Creation" );}
if (k ==1) {System.out.print("T" +(j+1)+"IncremtPeriod" );}
if (k ==2) {System.out.print("T" +(j+1)+"Reset" );}
if (k ==3) {System.out.print("T" +(j+1)+"Activation" );}
if (k ==4) {System.out.print("T" +(j+1)+"Execution" );}
if (k ==5) {System.out.print("T" +(j+1)+"Incrementing " );}
if (k ==6) {System.out.print("T" +(j+1)+"Receiving" );}
if (k ==7) {System.out.print("T" +(j+1)+"Releasing" );}
if (k ==8) {System.out.print("T" +(j+1)+"Sending" );}
}
}System.out.println();
}
public static void affiche(int mat[][], int n, int m)throws JDOMException, IOException
{
afficheenteteColonne();
for (int i=0;i<n;i++)
{System.out.print(" ");
for (int j=0;j<m;j++)
{
System.out.print(mat[i][j]);
}
System.out.println();
}
} |
Partager