I've been attempting to implement an interface in my enums in order to have rules for a simulation I'm making.
I am trying to access enum-methods such as values() and ordinal() (on objects).
However, even with upper-bounding my classes with my interface name, I still cannot access these methods without overriding them in my interface, which won't work.
public interface State{
public static void setTileSize(int size){
return;
}
public void draw(PApplet app, int x, int y);
public Object updateState(int[] allNeighbours);
public int getColour();
}
enum WireWorld implements State{ // WireWorld
WIRE(new Color(100, 100, 100)) {
public WireWorld updateState(int[] allNeighbours){
if (allNeighbours[1] >= 1){
return TIP;
}
return WIRE;
}
}, ...
public class Tile<T extends State> {
public Tile() {
int enumCount = T.values().length;
}
}
I'm trying to call the constructor on Tile and it doesn't work.