Package net.infonode.util
Class Direction
java.lang.Object
net.infonode.util.Enum
net.infonode.util.Direction
- All Implemented Interfaces:
Serializable
,Writable
An enum class for directions, up, down, left, right.
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Direction
Decodes a direction from a stream.static Direction[]
Gets all directions.Returns the direction that is one quarter of a revolution counter clock wise.Returns the direction that is one quarter of a revolution clock wise.Returns the opposite direction.boolean
Returns true if the direction is horizontal.
-
Field Details
-
UP
Up direction. -
RIGHT
Right direction. -
DOWN
Down direction. -
LEFT
Left direction. -
DIRECTIONS
Array containing all directions.
-
-
Method Details
-
getNextCW
Returns the direction that is one quarter of a revolution clock wise.- Returns:
- the direction that is one quarter of a revolution clock wise
-
getNextCCW
Returns the direction that is one quarter of a revolution counter clock wise.- Returns:
- the direction that is one quarter of a revolution counter clock wise
-
isHorizontal
public boolean isHorizontal()Returns true if the direction is horizontal.- Returns:
- true if the direction is horizontal
-
getOpposite
Returns the opposite direction.- Returns:
- the opposite direction
-
getDirections
Gets all directions.- Returns:
- all directions
- Since:
- 1.1.0
-
decode
Decodes a direction from a stream.- Parameters:
in
- the stream containing the direction- Returns:
- the direction
- Throws:
IOException
- if there is a stream error
-