Class AbstractLinePathConnector.ConnectableLineSubset
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.internal.AbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
-
- org.apache.commons.geometry.euclidean.twod.path.AbstractLinePathConnector.ConnectableLineSubset
-
- All Implemented Interfaces:
java.lang.Comparable<AbstractLinePathConnector.ConnectableLineSubset>
- Enclosing class:
- AbstractLinePathConnector
protected static class AbstractLinePathConnector.ConnectableLineSubset extends AbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
Internal class used to connect line subsets together.
-
-
Field Summary
Fields Modifier and Type Field Description private Vector2D
start
Line subset start point.private LineConvexSubset
subset
Line subset for the entry.
-
Constructor Summary
Constructors Modifier Constructor Description ConnectableLineSubset(LineConvexSubset subset)
Create a new instance from the given line subset.ConnectableLineSubset(Vector2D start)
Create a new instance with the given start point.private
ConnectableLineSubset(Vector2D start, LineConvexSubset subset)
Create a new instance with the given start point and line subset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canConnectTo(AbstractLinePathConnector.ConnectableLineSubset next)
Return true if this instance's end point can be connected to the argument's start point.int
compareTo(AbstractLinePathConnector.ConnectableLineSubset other)
boolean
endPointsEq(AbstractLinePathConnector.ConnectableLineSubset other)
Return true if the end point of this instance should be considered equivalent to the end point of the argument.boolean
equals(java.lang.Object obj)
AbstractLinePathConnector.ConnectableLineSubset
getConnectionSearchKey()
Get a new instance used as a search key to help locate other elements with start points matching this instance's end point.LineConvexSubset
getLineSubset()
Get the line subset for this instance.double
getRelativeAngle(AbstractLinePathConnector.ConnectableLineSubset next)
Return the relative angle between this element and the argument.protected AbstractLinePathConnector.ConnectableLineSubset
getSelf()
Return the current instance as the generic type.boolean
hasEnd()
Return true if this instance has an end point that can be connected to another element's start point.int
hashCode()
boolean
hasStart()
Return true if this instance has a start point that can be connected to another element's end point.boolean
hasZeroSize()
Return true if this instance has a size equivalent to zero.boolean
shouldContinueConnectionSearch(AbstractLinePathConnector.ConnectableLineSubset candidate, boolean ascending)
Return true if the search for possible connections should continue through the sorted set of possible path elements given the current candidate element and search direction.-
Methods inherited from class org.apache.commons.geometry.euclidean.internal.AbstractPathConnector.ConnectableElement
connectTo, exportPath, getNext, getPrevious, hasNext, hasPrevious, markExported, setNext, setPrevious
-
-
-
-
Field Detail
-
start
private final Vector2D start
Line subset start point. This will be used to connect to other path elements.
-
subset
private final LineConvexSubset subset
Line subset for the entry.
-
-
Constructor Detail
-
ConnectableLineSubset
public ConnectableLineSubset(Vector2D start)
Create a new instance with the given start point. This constructor is intended only for performing searches for other path elements.- Parameters:
start
- start point
-
ConnectableLineSubset
public ConnectableLineSubset(LineConvexSubset subset)
Create a new instance from the given line subset.- Parameters:
subset
- subset instance
-
ConnectableLineSubset
private ConnectableLineSubset(Vector2D start, LineConvexSubset subset)
Create a new instance with the given start point and line subset.- Parameters:
start
- start pointsubset
- line subset instance
-
-
Method Detail
-
getLineSubset
public LineConvexSubset getLineSubset()
Get the line subset for this instance.- Returns:
- the line subset for this instance
-
hasStart
public boolean hasStart()
Return true if this instance has a start point that can be connected to another element's end point.- Specified by:
hasStart
in classAbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
- Returns:
- true if this instance has a start point that can be connected to another element's end point
-
hasEnd
public boolean hasEnd()
Return true if this instance has an end point that can be connected to another element's start point.- Specified by:
hasEnd
in classAbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
- Returns:
- true if this instance has an end point that can be connected to another element's start point
-
hasZeroSize
public boolean hasZeroSize()
Return true if this instance has a size equivalent to zero.- Returns:
- true if this instance has a size equivalent to zero.
-
endPointsEq
public boolean endPointsEq(AbstractLinePathConnector.ConnectableLineSubset other)
Return true if the end point of this instance should be considered equivalent to the end point of the argument.- Specified by:
endPointsEq
in classAbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
- Parameters:
other
- element to compare end points with- Returns:
- true if this instance has an end point equivalent to that of the argument
-
canConnectTo
public boolean canConnectTo(AbstractLinePathConnector.ConnectableLineSubset next)
Return true if this instance's end point can be connected to the argument's start point.- Specified by:
canConnectTo
in classAbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
- Parameters:
next
- candidate for the next element in the path; this value is guaranteed to not be null and to contain a start point- Returns:
- true if this instance's end point can be connected to the argument's start point
-
getRelativeAngle
public double getRelativeAngle(AbstractLinePathConnector.ConnectableLineSubset next)
Return the relative angle between this element and the argument.- Specified by:
getRelativeAngle
in classAbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
- Parameters:
next
- element to compute the angle with- Returns:
- the relative angle between this element and the argument
-
getConnectionSearchKey
public AbstractLinePathConnector.ConnectableLineSubset getConnectionSearchKey()
Get a new instance used as a search key to help locate other elements with start points matching this instance's end point. The only restriction on the returned instance is that it be compatible with the implementation class'Comparable.compareTo(Object)
method.- Specified by:
getConnectionSearchKey
in classAbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
- Returns:
- a new instance used to help locate other path elements with start points equivalent to this instance's end point
-
shouldContinueConnectionSearch
public boolean shouldContinueConnectionSearch(AbstractLinePathConnector.ConnectableLineSubset candidate, boolean ascending)
Return true if the search for possible connections should continue through the sorted set of possible path elements given the current candidate element and search direction. The search operation stops for the given direction when this method returns false.- Specified by:
shouldContinueConnectionSearch
in classAbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
- Parameters:
candidate
- last tested candidate connection elementascending
- true if the search is proceeding in an ascending direction; false otherwise- Returns:
- true if the connection search should continue
-
compareTo
public int compareTo(AbstractLinePathConnector.ConnectableLineSubset other)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getSelf
protected AbstractLinePathConnector.ConnectableLineSubset getSelf()
Return the current instance as the generic type.- Specified by:
getSelf
in classAbstractPathConnector.ConnectableElement<AbstractLinePathConnector.ConnectableLineSubset>
- Returns:
- the current instance as the generic type.
-
-