E
- Element typepublic abstract class AbstractPathConnector<E extends AbstractPathConnector.ConnectableElement<E>> extends Object
AbstractPathConnector.ConnectableElement
specific for the objects being connected.
The connection algorithm proceeds as follows:
AbstractPathConnector.ConnectableElement
s.AbstractPathConnector.ConnectableElement.getConnectionSearchKey()
and
using the returned instance to locate a search start location in the sorted element list.AbstractPathConnector.ConnectableElement.canConnectTo(AbstractPathConnector.ConnectableElement)
. Collect possible
connections in a list. Terminate the search when
AbstractPathConnector.ConnectableElement.shouldContinueConnectionSearch(AbstractPathConnector.ConnectableElement, boolean)
returns false.
selectPointConnection(AbstractPathConnector.ConnectableElement, List)
and/or selectConnection(AbstractPathConnector.ConnectableElement, List)
when multiple possibilities
are found.This class is not thread-safe.
AbstractPathConnector.ConnectableElement
Modifier and Type | Class and Description |
---|---|
static class |
AbstractPathConnector.ConnectableElement<E extends AbstractPathConnector.ConnectableElement<E>>
Class used to represent connectable path elements for use with
AbstractPathConnector . |
Constructor and Description |
---|
AbstractPathConnector() |
Modifier and Type | Method and Description |
---|---|
protected void |
addPathElement(E element)
Add a single path element to the connector, leaving it unconnected until a later call to
to
connectPathElements(Iterable) or computePathRoots() . |
protected List<E> |
computePathRoots()
Compute all connected paths and return a list of path elements representing
the roots (start locations) of each.
|
protected void |
connectPathElements(Iterable<E> elements)
Add a collection of path elements to the connector and attempt to connect each new element
with previously added ones.
|
protected abstract E |
selectConnection(E incoming,
List<E> outgoing)
Method called to select a connection to use for a given segment when multiple non-length-zero
connections are available.
|
protected E |
selectPointConnection(E incoming,
List<E> outgoingList)
Method called to select a connection to use for a given element when multiple zero-length connections are
available.
|
public AbstractPathConnector()
protected void connectPathElements(Iterable<E> elements)
elements
- path elements to connectprotected void addPathElement(E element)
connectPathElements(Iterable)
or computePathRoots()
.element
- value to add to the connectorconnectPathElements(Iterable)
,
computePathRoots()
protected List<E> computePathRoots()
The connector is reset after this call. Further calls to add elements will result in new paths being generated.
protected E selectPointConnection(E incoming, List<E> outgoingList)
incoming
- the incoming elementoutgoingList
- list of available outgoing point-like connectionsprotected abstract E selectConnection(E incoming, List<E> outgoing)
incoming
- the incoming segmentoutgoing
- list of available outgoing connections; will always contain at least
two elementsCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.