public interface INodeEdgeConnector extends Serializable
table
of INodeConnectorItem
which hold the two Strings
of the start and the end location. Each
INodeConnectorItem
is describing for example the time, distance etc. between two nodes.
By default the Table
is implemented as TreeBasedTable
which is used to store the connection items.
The INodeConnectorItem
can be populated with realistic data on distance and time
needed between two locations. If not populated, the IBackupElementConnector
is used to
create missing connections. The default DefaultFlatEarthAverageSpeedBackupElementConnector
uses the haversine formula to calculate the
distance between two points. Further it uses an average speed to calculate the driving time
between two points based on the previously calculated distance.
Recommendation: The connections of two Nodes
should be filtered before the INodeconnector
is being populated. If one Node
is only accessible in December and
another one only in January the Optimizer
most likely never puts them in the same Route
in the final result which is more efficient and the specific data on the distance between
these Nodes
does not need to be acquired.
INodeConnectorItem getNodeConnection(IOptimizationElement from, IOptimizationElement to, IResource visitor)
from
- the starting IOptimizationElement
of the connectionto
- the termination IOptimizationElement
of the connectionvisitor
- the IResource
visitorINodeConnectorItem getNodeConnection(IOptimizationElement from, IOptimizationElement to, ILogicEntityRoute contextRoute)
List<INodeConnectorItem> getNodeConnections()
void setNodeConnections(com.google.common.collect.Table<String,String,INodeConnectorItem> table)
table
- the tablevoid putNodeConnections(List<INodeConnectorItem> connections)
IOptimizationElement
) are replaced.connections
- the connectionsvoid putNodeConnection(INodeConnectorItem connection)
IOptimizationElement
) is replaced.connection
- the connectionvoid putNodeConnectionIfNotExisting(INodeConnectorItem connection)
IOptimizationElement
) is kept.connection
- the connection@Deprecated void putNodeConnection(String from, String too, INodeConnectorItem connection)
putNodeConnection(INodeConnectorItem)
or putNodeConnections(List)
insteadfrom
- the string the start of the connectiontoo
- the string the end of the connectionconnection
- the iNodeConnectorItem where the distance is saved@Deprecated void putNodeConnectionIfNotExisting(String from, String too, INodeConnectorItem connection)
putNodeConnectionIfNotExisting(INodeConnectorItem)
insteadfrom
- the string the start of the connectiontoo
- the string the end of the connectionconnection
- the iNodeConnectorItem where the distance is savedINodeConnectorItem getNodeConnection(String fromId, String tooId)
IOptimizationElement
ids. In case the
connections was not provided by the user the IBackupElementConnector
is used to create
the connection.fromId
- the fromtooId
- the tooSet<String> cleanUp(List<IOptimizationElement> presentItems, List<String> presentIdemIds)
presentItems
- the present items to be keptpresentIdemIds
- the present items ids to be kept.boolean removeConnection(IOptimizationElement removeElement)
removeElement
- the remove elementboolean removeConnection(IOptimizationElement removeElement, Optional<Set<String>> protectedIdsOpt)
removeElement
- the remove elementprotectedIdsOpt
- the protected ids optvoid setBackupElementConnector(IBackupElementConnector backUpConnector)
IBackupElementConnector
which is used if the INodeEdgeConnector
cannot
find a requested connection. The IBackupElementConnector
defines how the item is
created.
By default the DefaultFlatEarthAverageSpeedBackupElementConnector
is used.
backUpConnector
- the iBackupElementConnector which is used as a fall backIBackupElementConnector getBackupElementConnector()
void setExternalConnectionProvider(IExternalConnectionProvider externalConnectionProvider)
Optional<IExternalConnectionProvider> getExternalConnectionProvider()
void attachSeparatedTestConnectionProvider(ISeparatedTestConnectionProvider separatedTestConnectionProvider)
Optional<ISeparatedTestConnectionProvider> getSeparatedTestConnectionProvider()
void dropSeparatedTestConnectionProvider()
void removeConnectionFromElements(IOptimizationElement removeElement)
void putNodeConnectionsIfNotExisting(List<INodeConnectorItem> connections)
void refactorNodeConnectorConnection(IOptimizationElement oldElement, IOptimizationElement newElement, boolean reAddConnections)
boolean hasConnectionToOrFrom(String elementId)
Copyright © 2017–2023 DNA Evolutions GmbH. All rights reserved.