bonjour a tous,
j'ai un problème dans mon matrice qui m'affiche rien, merci de m'aider
voici mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 public class modele1 { public static void main(String[] args) { ArrayList<String> attribut= new ArrayList<String>() ; attribut.add("lastName"); attribut.add("father"); attribut.add("mother"); attribut.add("sons"); attribut.add("daughters"); attribut.add("firstName"); int [][] matrice = new int [variable.attributsSource.size()][attribut.size()]; for(int j =0;j< attribut.size();j++){ for( int i =0;i< variable.attributsSource.size();i++){ int m=0; boolean t= false; while (m<variable.attributsSource.get(i).attributs.size()) {//for (int j=0;j<ListModel.get(i).attributs.size();j++) //System.out.print("att= "+att.get(m)); //System.out.print("rel = "+ListModel.get(i).Relations.get(j).name); if (variable.attributsSource.get(i).attributs.get(m).name.equals(attribut.get(j))){ t = true;m=variable.attributsSource.get(i).attributs.size()+1;} else {m++;} }if (t==false) { matrice[i][j]=0; } else { matrice[i][j]=1; }//////////////traitement pour les relations ///////////////// if (matrice [i][j]==0){m=0; t= false; while (m<variable.attributsSource.get(i).Relations.size()) {//for (int j=0;j<ListModel.get(i).attributs.size();j++) //System.out.print("att= "+att.get(m)); //System.out.print("rel = "+ListModel.get(i).Relations.get(j).name); if (variable.attributsSource.get(i).Relations.get(m).name.equals(attribut.get(j))){ t = true;m=variable.attributsSource.get(i).Relations.size()+1;} else {m++;} }if (t==false) { matrice[i][j]=0; } else { matrice[i][j]=1; } } } } //////////////////////////////////// for (int i=0; i<variable.attributsSource.size();i++){ for (int j=0; j<attribut.size();j++){ System.out.print(matrice[j][i]+" "); } } }}
Partager