First version
This commit is contained in:
64
src/Player.java
Normal file
64
src/Player.java
Normal file
@ -0,0 +1,64 @@
|
||||
public class Player implements Comparable<Player> {
|
||||
|
||||
enum Type {
|
||||
DEFENDER,
|
||||
FORWARD,
|
||||
GOALIE,
|
||||
NONE
|
||||
|
||||
}
|
||||
|
||||
private String name;
|
||||
private int age;
|
||||
private Type type;
|
||||
|
||||
|
||||
public int getAge() {
|
||||
|
||||
return this.age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public void setType(Type type) {
|
||||
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public Player() {
|
||||
|
||||
this.name = "";
|
||||
this.age = 0;
|
||||
this.type = Type.NONE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(Player another) {
|
||||
if (this.age < another.age) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user