Using enums...
Hi! I have some problems with enum. :(
Part of program:
Should be pretty clear... I want to add element (basically to change "private State state" to the next one: from EARTH to FOUNDATION, from FOUNDATION to FLOOR etc and if it succeeded - return true; else - return false).
But I got problems with changing element to the next one (red color). I tried many times, read manuals, books, googled etc but without any success. I hope someone could help me with this easy (I guess) task. Thanks in advance!
Part of program:
public enum State {EARTH, FOUNDATION, FLOOR, WALL, ROOF);
private State state;
public boolean addElement(){
//state = (state.ordinal()++);
if(state.compareTo(State.ROOF)>=0)return false;
else return true;
}//boolean addElementShould be pretty clear... I want to add element (basically to change "private State state" to the next one: from EARTH to FOUNDATION, from FOUNDATION to FLOOR etc and if it succeeded - return true; else - return false).
But I got problems with changing element to the next one (red color). I tried many times, read manuals, books, googled etc but without any success. I hope someone could help me with this easy (I guess) task. Thanks in advance!
