65 lines
892 B
Java
65 lines
892 B
Java
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;
|
|
}
|
|
}
|
|
|
|
}
|