Returning flags from enums
I hope this is possible ( i guess it is but i don't know how)
I hava an enumerated class mirrorflags
Code:
*/
public enum mirrorflags {
DIAMIRROR,
VERTMIRROR,
HORMIRROR
}
And a enumerated class rotations
Code:
*/
public enum Rotations {
NOTURN,
HALFTURN,
HORTURN,
VERTURN,
RDIATURN,
LDIATURN,
RIGHTTURN,
LEFTURN
}
now i want a function Rotation.<name of rotation>.mirrors
that returns the mirrors(can be more than one) related to that Rotation
I know i will need to hardcode this in the program but i have no idea where to start.
More complications.
i need a function that is the opposite of rotation.ordinal()
is there a build in function for this or do i need to write something for myself?
something like
Code:
public rotation Rotation(int ordinal) {
for(Rotation i : Rotation) {if (i.ordinal() == ordinal) return i;}
}