- java.lang.Object
-
- java.lang.Enum<Direction1D>
-
- org.arakhne.afc.math.geometry.d1.Direction1D
-
- All Implemented Interfaces:
Serializable
,Comparable<Direction1D>
public enum Direction1D extends Enum<Direction1D>
This class represents a direction in a 1D or 1.5D coordinate space.A 1D direction is related to a
Segment1D
.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BOTH_DIRECTIONS
Both directions of aSegment1D
.REVERTED_DIRECTION
Reverted direction then aSegment1D
.SEGMENT_DIRECTION
Same direction as aSegment1D
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Direction1D
fromInteger(int value)
Replies the direction according to the given integer value.boolean
isRevertedSegmentDirection()
Replies if the reverted segment direction is allowed.boolean
isSegmentDirection()
Replies if the segment direction is allowed.int
toInteger()
Replies integer value that is corresponding to the direction.static Direction1D
valueOf(String name)
Returns the enum constant of this type with the specified name.static Direction1D[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SEGMENT_DIRECTION
public static final Direction1D SEGMENT_DIRECTION
Same direction as aSegment1D
.
-
REVERTED_DIRECTION
public static final Direction1D REVERTED_DIRECTION
Reverted direction then aSegment1D
.
-
BOTH_DIRECTIONS
public static final Direction1D BOTH_DIRECTIONS
Both directions of aSegment1D
.
-
-
Method Detail
-
values
public static Direction1D[] 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 (Direction1D c : Direction1D.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Direction1D 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
-
isSegmentDirection
@Pure public boolean isSegmentDirection()
Replies if the segment direction is allowed.- Returns:
true
if the segment direction is allowed, otherwisefalse
-
isRevertedSegmentDirection
@Pure public boolean isRevertedSegmentDirection()
Replies if the reverted segment direction is allowed.- Returns:
true
if the reverted segment direction is allowed, otherwisefalse
-
fromInteger
@Pure public static Direction1D fromInteger(int value)
Replies the direction according to the given integer value.The value is mapped to
SEGMENT_DIRECTION
if positive. It is mapped toREVERSED_SEGMENT_DIRECTION
if negative. And it is mapped toBOTH_DIRECTIONS
if nul.- Parameters:
value
- the value to convert.- Returns:
- the direction which is corresponding to the given value.
-
toInteger
@Pure public int toInteger()
Replies integer value that is corresponding to the direction.The returned value is positive if
SEGMENT_DIRECTION
. It is negative ifREVERSED_DIRECTION
if negative. And it is zero ifBOTH_DIRECTIONS
.- Returns:
- the direction which is corresponding to the given value.
-
-