Enum Edge2
- java.lang.Object
-
- java.lang.Enum<Edge2>
-
- de.extio.spacecraft.shared.model.world.Edge2
-
- All Implemented Interfaces:
Serializable
,Comparable<Edge2>
public enum Edge2 extends Enum<Edge2>
Identifies a vertex or a side
-
-
Field Summary
Fields Modifier and Type Field Description static Edge2[]
VALUES_CACHED
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Edge2
fromBit(int bit)
int
getBit()
static int
rotate(int edges, Edge2 dest)
Rotates edges represented by bit mask (Edge2::getBit)Edge2
rotate(Edge2 dest)
Rotates edge from RIGHT to destination clock-wise.static String
toString(int edges)
static CoordD2
toVectorD(Edge2 edge2)
Returns a vector with length 1 pointing to the direction edge2 representatesstatic CoordI2
toVectorI(Edge2 edge2)
Returns a vector with length 1 pointing to the direction edge2 representatesstatic Edge2
valueOf(String name)
Returns the enum constant of this type with the specified name.static Edge2[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Field Detail
-
VALUES_CACHED
public static final Edge2[] VALUES_CACHED
-
-
Method Detail
-
values
public static Edge2[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Edge2 c : Edge2.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Edge2 valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
fromBit
public static Edge2 fromBit(int bit)
-
rotate
public Edge2 rotate(Edge2 dest)
Rotates edge from RIGHT to destination clock-wise. BOTTOM rotates by 1 stop, LEFT by 2 and TOP by 3.- Parameters:
dest
- stops- Returns:
- Rotated edge2
-
rotate
public static int rotate(int edges, Edge2 dest)
Rotates edges represented by bit mask (Edge2::getBit)- Parameters:
edges
- Bit mask of edgesdest
- Rotate from RIGHT to destination clock-wise. BOTTOM rotates by 1 stop, LEFT by 2 and TOP by 3.- Returns:
- Rotated bit mask
-
toVectorD
public static CoordD2 toVectorD(Edge2 edge2)
Returns a vector with length 1 pointing to the direction edge2 representates- Parameters:
edge2
-- Returns:
- Vector
-
toVectorI
public static CoordI2 toVectorI(Edge2 edge2)
Returns a vector with length 1 pointing to the direction edge2 representates- Parameters:
edge2
-- Returns:
- Vector
-
toString
public static String toString(int edges)
-
getBit
public int getBit()
-
-