Package de.xima.fc.common.graphdot
Class LengthPoint<L extends Length>
- java.lang.Object
-
- de.xima.fc.common.graphdot.LengthPoint<L>
-
- Type Parameters:
L
- Type of the length.
- All Implemented Interfaces:
Serializable
,CharSequence
public final class LengthPoint<L extends Length> extends Object
A graphviz 2D or 3D point with a length unit. 3D is valid only when the attributedim
is set to 3.3.4,-7.4 3.4,-7.4! 3.4,-7.4,5.0 3.4,-7.4,5.0!
- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LengthPoint.LengthPointFactory<L extends Length>
A factory for creatingLengthPoint
from values in a given unit.
-
Constructor Summary
Constructors Constructor Description LengthPoint(boolean fixed, L x, L y, L z)
Creates a new point with the given coordinates.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description default char
charAt(int index)
default IntStream
chars()
default IntStream
codePoints()
boolean
equals(Object obj)
static <L extends Length>
LengthPoint<L>fixed(L x, L y)
Creates a new fixed 2D point with the given coordinates.static <L extends Length>
LengthPoint<L>fixed(L x, L y, L z)
Creates a new fixed 3D point with the given coordinates.L
getX()
Gets the X position of the point.L
getY()
Gets the Y position of the point.Optional<L>
getZ()
Gets the Z position of the point.int
hashCode()
boolean
is2D()
Checks whether this is a 2D point.boolean
is3D()
Checks whether this is a 3D point.boolean
isFixed()
Get the flag that indicates that the node position should not change.default int
length()
static <L extends Length>
LengthPoint<L>loose(L x, L y)
Creates a new loose 2D point with the given coordinates.static <L extends Length>
LengthPoint<L>loose(L x, L y, L z)
Creates a new loose 3D point with the given coordinates.default CharSequence
subSequence(int start, int end)
static LengthPoint.LengthPointFactory<Length.Inches>
toInches()
Gets a factory for creating length points from inch values.static LengthPoint.LengthPointFactory<Length.Points>
toPoints()
Gets a factory for creating length points from point values.String
toString()
-
-
-
Method Detail
-
getX
public L getX()
Gets the X position of the point.- Returns:
- The X position of the point.
-
getY
public L getY()
Gets the Y position of the point.- Returns:
- The Y position of the point.
-
getZ
public Optional<L> getZ()
Gets the Z position of the point.- Returns:
- The Z position of the point.
-
is2D
public boolean is2D()
Checks whether this is a 2D point.- Returns:
- Whether this is a 2D point.
-
is3D
public boolean is3D()
Checks whether this is a 3D point.- Returns:
- Whether this is a 3D point.
-
isFixed
public boolean isFixed()
Get the flag that indicates that the node position should not change.- Returns:
- Indicates that the node position should not change.
-
toString
public String toString()
- Specified by:
toString
in interfaceCharSequence
-
fixed
public static <L extends Length> LengthPoint<L> fixed(L x, L y)
Creates a new fixed 2D point with the given coordinates.- Type Parameters:
L
- Type of the length.- Parameters:
x
- The X position of the point.y
- The Y position of the point.- Returns:
- A new fixed 2D point.
-
fixed
public static <L extends Length> LengthPoint<L> fixed(L x, L y, L z)
Creates a new fixed 3D point with the given coordinates.- Type Parameters:
L
- Type of the length.- Parameters:
x
- The X position of the point.y
- The Y position of the point.z
- The Z position of the point.- Returns:
- A new fixed 3D point.
-
loose
public static <L extends Length> LengthPoint<L> loose(L x, L y)
Creates a new loose 2D point with the given coordinates.- Type Parameters:
L
- Type of the length.- Parameters:
x
- The X position of the point.y
- The Y position of the point.- Returns:
- A new loose 2D point.
-
loose
public static <L extends Length> LengthPoint<L> loose(L x, L y, L z)
Creates a new loose 3D point with the given coordinates.- Type Parameters:
L
- Type of the length.- Parameters:
x
- The X position of the point.y
- The Y position of the point.z
- The Z position of the point.- Returns:
- A new loose 3D point.
-
toInches
public static LengthPoint.LengthPointFactory<Length.Inches> toInches()
Gets a factory for creating length points from inch values.- Returns:
- A factory for creating length points from inch values.
-
toPoints
public static LengthPoint.LengthPointFactory<Length.Points> toPoints()
Gets a factory for creating length points from point values.- Returns:
- A factory for creating length points from point values.
-
charAt
public default char charAt(int index)
- Specified by:
charAt
in interfaceCharSequence
-
chars
public default IntStream chars()
- Specified by:
chars
in interfaceCharSequence
-
codePoints
public default IntStream codePoints()
- Specified by:
codePoints
in interfaceCharSequence
-
length
public default int length()
- Specified by:
length
in interfaceCharSequence
-
subSequence
public default CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfaceCharSequence
-
-