Enum Class StructureRotation
- All Implemented Interfaces:
Serializable, Comparable<StructureRotation>, Constable
A quarter-turn rotation around the vertical axis, as used by structure templates and jigsaw pieces.
- Since:
- 0.1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable StructureRotationstatic StructureRotationofQuarterTurns(int quarterTurns) intintrotate(int value, int steps) Rotates a value expressed on a circle ofstepspositions, such as the 16 sign rotations.then(StructureRotation other) Appliesotherafter this rotation.static StructureRotationReturns the enum constant of this class with the specified name.static StructureRotation[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
-
CLOCKWISE_90
-
CLOCKWISE_180
-
COUNTERCLOCKWISE_90
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
quarterTurns
public int quarterTurns()- Returns:
- the number of clockwise quarter turns, from 0 to 3
-
ofQuarterTurns
- Parameters:
quarterTurns- clockwise quarter turns, any integer- Returns:
- the matching rotation
-
then
Appliesotherafter this rotation.- Parameters:
other- the rotation to add- Returns:
- the combined rotation
-
rotate
public int rotate(int value, int steps) Rotates a value expressed on a circle ofstepspositions, such as the 16 sign rotations.- Parameters:
value- the current valuesteps- the number of positions on the circle- Returns:
- the rotated value
-
serializedName
- Returns:
- the lowercase name used by commands, e.g.
clockwise_90
-
byName
-