Interface INodeEdgeConnector
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractNodeEdgeConnector
,NodeEdgeConnector
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.
- Since:
- 06/09/2019
- Version:
- 19/09/2019
- Author:
- DNA
-
Method Summary
Modifier and TypeMethodDescriptionvoid
attachSeparatedTestConnectionProvider
(ISeparatedTestConnectionProvider separatedTestConnectionProvider) cleanUp
(List<IOptimizationElement> presentItems, List<String> presentIdemIds) Cleans up the connections table by removing connections with no present items.void
Gets the systems default or user provided backup element connector.getNodeConnection
(IOptimizationElement from, IOptimizationElement to, ILogicEntityRoute contextRoute) getNodeConnection
(IOptimizationElement from, IOptimizationElement to, IResource visitor) Gets a specific node connection.getNodeConnection
(String fromId, String tooId) Gets a specific node connection between twoIOptimizationElement
ids.Gets all connections as a list instead of a table.boolean
hasConnectionToOrFrom
(String elementId) void
putNodeConnection
(INodeConnectorItem connection) Puts a single node connection.void
putNodeConnection
(String from, String too, INodeConnectorItem connection) Deprecated.void
putNodeConnectionIfNotExisting
(INodeConnectorItem connection) Put node connection if not existing.void
putNodeConnectionIfNotExisting
(String from, String too, INodeConnectorItem connection) Deprecated.please useputNodeConnectionIfNotExisting(INodeConnectorItem)
insteadvoid
putNodeConnections
(List<INodeConnectorItem> connections) Puts a list of connections to be stored in the table.void
putNodeConnectionsIfNotExisting
(List<INodeConnectorItem> connections) void
refactorNodeConnectorConnection
(IOptimizationElement oldElement, IOptimizationElement newElement, boolean reAddConnections) boolean
removeConnection
(IOptimizationElement removeElement) Removes a connection.boolean
removeConnection
(IOptimizationElement removeElement, Optional<Set<String>> protectedIdsOpt) Removes the connection.void
removeConnectionFromElements
(IOptimizationElement removeElement) void
setBackupElementConnector
(IBackupElementConnector backUpConnector) Sets theIBackupElementConnector
which is used if theINodeEdgeConnector
cannot find a requested connection.void
setExternalConnectionProvider
(IExternalConnectionProvider externalConnectionProvider) void
setNodeConnections
(com.google.common.collect.Table<String, String, INodeConnectorItem> table) Sets the node connections table.
-
Method Details
-
getNodeConnection
INodeConnectorItem getNodeConnection(IOptimizationElement from, IOptimizationElement to, IResource visitor) Gets a specific node connection. This call will ignore connections hooks.- Parameters:
from
- the startingIOptimizationElement
of the connectionto
- the terminationIOptimizationElement
of the connectionvisitor
- theIResource
visitor- Returns:
- the node connection
-
getNodeConnection
INodeConnectorItem getNodeConnection(IOptimizationElement from, IOptimizationElement to, ILogicEntityRoute contextRoute) -
getNodeConnections
List<INodeConnectorItem> getNodeConnections()Gets all connections as a list instead of a table.- Returns:
- the node connections
-
setNodeConnections
Sets the node connections table.- Parameters:
table
- the table
-
putNodeConnections
Puts a list of connections to be stored in the table. Already present connections (identified via the unique ids of the connection memberIOptimizationElement
) are replaced.- Parameters:
connections
- the connections
-
putNodeConnection
Puts a single node connection. An already present connection (identified via the unique ids of the connection memberIOptimizationElement
) is replaced.- Parameters:
connection
- the connection
-
putNodeConnectionIfNotExisting
Put node connection if not existing. An already present connection (identified via the unique ids of the connection memberIOptimizationElement
) is kept.- Parameters:
connection
- the connection
-
putNodeConnection
Deprecated.please useputNodeConnection(INodeConnectorItem)
orputNodeConnections(List)
insteadDeprecated method.- Parameters:
from
- the string the start of the connectiontoo
- the string the end of the connectionconnection
- the iNodeConnectorItem where the distance is saved
-
putNodeConnectionIfNotExisting
@Deprecated void putNodeConnectionIfNotExisting(String from, String too, INodeConnectorItem connection) Deprecated.please useputNodeConnectionIfNotExisting(INodeConnectorItem)
insteadDeprecated method.- Parameters:
from
- the string the start of the connectiontoo
- the string the end of the connectionconnection
- the iNodeConnectorItem where the distance is saved
-
getNodeConnection
Gets a specific node connection between twoIOptimizationElement
ids. In case the connections was not provided by the user theIBackupElementConnector
is used to create the connection.- Parameters:
fromId
- the fromtooId
- the too- Returns:
- the node connection
-
cleanUp
Cleans up the connections table by removing connections with no present items.- Parameters:
presentItems
- the present items to be keptpresentIdemIds
- the present items ids to be kept.- Returns:
- the set strings of the removed nodeConnectorIds
-
removeConnection
Removes a connection.- Parameters:
removeElement
- the remove element- Returns:
- true, if successful
-
removeConnection
Removes the connection. A connections is only protected, if both (from and too element) are on the list of protected ids.- Parameters:
removeElement
- the remove elementprotectedIdsOpt
- the protected ids opt- Returns:
- true, if successful
-
setBackupElementConnector
Sets theIBackupElementConnector
which is used if theINodeEdgeConnector
cannot find a requested connection. TheIBackupElementConnector
defines how the item is created.By default the
DefaultFlatEarthAverageSpeedBackupElementConnector
is used.- Parameters:
backUpConnector
- the iBackupElementConnector which is used as a fall back
-
getBackupElementConnector
IBackupElementConnector getBackupElementConnector()Gets the systems default or user provided backup element connector.- Returns:
- the backup element connector
-
setExternalConnectionProvider
-
getExternalConnectionProvider
Optional<IExternalConnectionProvider> getExternalConnectionProvider() -
attachSeparatedTestConnectionProvider
void attachSeparatedTestConnectionProvider(ISeparatedTestConnectionProvider separatedTestConnectionProvider) -
getSeparatedTestConnectionProvider
Optional<ISeparatedTestConnectionProvider> getSeparatedTestConnectionProvider() -
dropSeparatedTestConnectionProvider
void dropSeparatedTestConnectionProvider() -
removeConnectionFromElements
-
putNodeConnectionsIfNotExisting
-
refactorNodeConnectorConnection
void refactorNodeConnectorConnection(IOptimizationElement oldElement, IOptimizationElement newElement, boolean reAddConnections) -
hasConnectionToOrFrom
-
putNodeConnection(INodeConnectorItem)
orputNodeConnections(List)
instead