enumeration java
public enum Feu {
VERT(0), ORANGE(1), ROUGE(2);
private int value;
private Feu( int value ) {
this.value = value;
}
public int toInt() {
return value;
}
public static Feu fromInt( int value ) {
switch( value ) {
case 0: return VERT;
case 1: return ORANGE;
default: return ROUGE;
}
}
}