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
| public Integer récupérerNbMaisonsJoueur1()
{
Integer compteurMaison = 0;
List list = racine.getChildren("partie");
valeursPositions = new ArrayList<Integer>();
//On crée un Iterator sur notre liste
Iterator i = list.iterator();
while(i.hasNext())
{
Element courantPartie = (Element)i.next();
List list2 = courantPartie.getChildren("joueurs");
Iterator i2 = list2.iterator();
while(i2.hasNext())
{
Element courantJoueurs = (Element)i2.next();
List list3 = courantJoueurs.getChildren("joueur");
Iterator i3 = list3.iterator();
while(i3.hasNext())
{
Element courantJoueur = (Element)i3.next();
List list4 = courantJoueur.getChildren("proprietes");
Iterator i4 = list4.iterator();
while(i4.hasNext())
{
Element courantProprietes = (Element)i4.next();
List list5 = courantProprietes.getChildren("propriete");
Iterator i5 = list5.iterator();
while(i5.hasNext())
{
Element courantPropriete = (Element)i5.next();
System.out.println(courantPropriete.getName());
//System.out.println(courantPropriete.getChild());
List list6 = courantPropriete.getChildren();
Iterator i6 = list6.iterator();
while(i6.hasNext())
{
Element courantMaison = (Element)i6.next();
System.out.println(courantMaison.getName());
if(courantMaison.getName().equals("maison"))
{
compteurMaison++;
}
}
}
}
}
}
}
return compteurMaison;
} |