Commit e12a51e1 authored by Felix RABADAN's avatar Felix RABADAN
Browse files

avancement parser

parent 76e6339b
......@@ -22,20 +22,16 @@ public class Parser {
String position = lineScanner.findInLine("[A-Z]");//on cherche la prochaine lettre, correspond a la position
float score = Float.parseFloat(lineScanner.next());
//TODO cas ou pas de score
Player.Position playposition;
if(position.equals("G")){
if(position.equals("G")){//G is goalkeeper
playposition= Player.Position.GOAL_KEEPER;
}else{
playposition= Player.Position.COURT_FIELD_PLAYER;
}
//TODO verify
Player player = playerController.addPlayer(name,playposition,score);
club.addPlayer(player);
// while (lineScanner.hasNext()) {
// System.out.print(lineScanner.next() + "|");
// }
Player player = playerController.addPlayer(name,playposition,score);//if player exist => update score
club.addPlayer(player);//add only if the player is not in the club
lineScanner.close();
}
fileScanner.close();
......
......@@ -11,11 +11,11 @@ public class Player {
private String name;
private Position position;
private float score;
private HashMap<String, Card> cards;
private int nbCommonCards;
private int nbLessCommonCards;
private int nbRareCards;
public float score;
public Player(String name, Position position, float score) {
this.name = name;
......
......@@ -26,7 +26,9 @@ public final class PlayerController {
return newPlayer;
} else {
System.err.println("Le player existe deja");
return players.get(name);
Player player = players.get(name);
player.score = score;//update score
return player;
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment