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 TypeMethodDescriptionvoidattachSeparatedTestConnectionProvider(ISeparatedTestConnectionProvider separatedTestConnectionProvider) cleanUp(List<IOptimizationElement> presentItems, List<String> presentIdemIds) Cleans up the connections table by removing connections with no present items.voidGets 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 twoIOptimizationElementids.Gets all connections as a list instead of a table.booleanhasConnectionToOrFrom(String elementId) voidputNodeConnection(INodeConnectorItem connection) Puts a single node connection.voidputNodeConnection(String from, String too, INodeConnectorItem connection) Deprecated.voidputNodeConnectionIfNotExisting(INodeConnectorItem connection) Put node connection if not existing.voidputNodeConnectionIfNotExisting(String from, String too, INodeConnectorItem connection) Deprecated.please useputNodeConnectionIfNotExisting(INodeConnectorItem)insteadvoidputNodeConnections(List<INodeConnectorItem> connections) Puts a list of connections to be stored in the table.voidputNodeConnectionsIfNotExisting(List<INodeConnectorItem> connections) voidrefactorNodeConnectorConnection(IOptimizationElement oldElement, IOptimizationElement newElement, boolean reAddConnections) booleanremoveConnection(IOptimizationElement removeElement) Removes a connection.booleanremoveConnection(IOptimizationElement removeElement, Optional<Set<String>> protectedIdsOpt) Removes the connection.voidremoveConnectionFromElements(IOptimizationElement removeElement) voidsetBackupElementConnector(IBackupElementConnector backUpConnector) Sets theIBackupElementConnectorwhich is used if theINodeEdgeConnectorcannot find a requested connection.voidsetExternalConnectionProvider(IExternalConnectionProvider externalConnectionProvider) voidsetNodeConnections(com.google.common.collect.Table<String, String, INodeConnectorItem> table) Sets the node connections table.voidsetZoneManager(IZoneManager zoneManager)
-
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 startingIOptimizationElementof the connectionto- the terminationIOptimizationElementof the connectionvisitor- theIResourcevisitor- 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 twoIOptimizationElementids. In case the connections was not provided by the user theIBackupElementConnectoris 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 theIBackupElementConnectorwhich is used if theINodeEdgeConnectorcannot find a requested connection. TheIBackupElementConnectordefines how the item is created.By default the
DefaultFlatEarthAverageSpeedBackupElementConnectoris 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
-
setZoneManager
-
getZoneManager
IZoneManager getZoneManager()
-
putNodeConnection(INodeConnectorItem)orputNodeConnections(List)instead