Let's say I created the following class:
public enum Position {
Dealer(1), //1
SB(2), //2
BB(3), //3
UTG(4), //4
UTG1(5), //5
UTG2(6), //6
UTG3(7), //7
HJ(8), //8
CO(9); //9
//Constructor
int code;
Position(int code) {
this.code = code;
}
}
How do I manipulate ENUM by using the numbers in parenthesis? For example, in my Poker Table class, I initiate new players. Each player passes the parameter Position. So initially,
player[1].getPosition() = Dealer
player[2].getPosition() = SB
player[3].getPosition() = BB
etc etc etc
After the hand is over, all the positions need to be shifted over by one.
So player[1] needs to have the CO(9) position.
player[2] needs to have the Dealer(1) position.
player[3] needs to have the SB(2) position.
etc etc
I understand that I can just make a for loop with a variable cycling through the numbers 1 through 9, but how do I access the position based on the integer inside the PositionENUM?
EDIT: I already have the getters and setters.
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
However the getters and the setters do not provide me with the correctly change the Positions of the players each round.
After every betting round, I need to change the Position of each player, so I need to figure out how to shift the ENUM Position of each player after each betting round.