Package org.goplanit.utils.graph
Interface GraphEntities<E extends GraphEntity>
-
- Type Parameters:
E
- type of graph entity
- All Superinterfaces:
Cloneable
,Iterable<E>
,LongMapWrapper<E>
,MapWrapper<Long,E>
- All Known Subinterfaces:
ConnectoidEdges
,ConnectoidSegments
,DirectedEdges
,DirectedVertices
,Edges
,EdgeSegments
,Links
,LinkSegments
,MacroscopicLinkSegments
,ManagedGraphEntities<E>
,Nodes
,ServiceLegs
,ServiceLegSegments
,ServiceNodes
,Vertices
- All Known Implementing Classes:
ConnectoidEdgesImpl
,ConnectoidSegmentsImpl
,DirectedEdgesImpl
,DirectedVerticesImpl
,EdgeSegmentsImpl
,EdgesImpl
,GraphEntitiesImpl
,LinkSegmentsImpl
,LinksImpl
,MacroscopicLinkSegmentsImpl
,NodesImpl
,ServiceLegSegmentsImpl
,ServiceLegsImpl
,ServiceNodesImpl
,VerticesImpl
public interface GraphEntities<E extends GraphEntity> extends LongMapWrapper<E>, Cloneable
Container class for any graph entities and a factory to create them- Author:
- markr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description GraphEntities<E>
clone()
Force clone implementationdefault <T extends IdAble>
voidforEachMatchingIdIn(Collection<T> values, Consumer<T> consumer)
Apply provided consumer to each element in values as long as that element is registered under the same id.default Collection<E>
getByExternalId(String externalId)
Collect all entities based on a matching external id.default E
getByXmlId(String xmlId)
Return an entity by its XML id Note: not an efficient implementation since it loops over all entities in linear time to identify the correct one, preferably useMapWrapper.get(Object)
instead whenever possible.GraphEntityFactory<E>
getFactory()
Factory to create instance of graph entity (for this container class)-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.goplanit.utils.wrapper.LongMapWrapper
containsKey, get, remove
-
Methods inherited from interface org.goplanit.utils.wrapper.MapWrapper
addAll, clear, contains, findFirst, forEachIn, get, getFirst, getKeyByValue, isEmpty, register, remove, size, toCollection, valuesAsNewSet
-
-
-
-
Method Detail
-
getFactory
GraphEntityFactory<E> getFactory()
Factory to create instance of graph entity (for this container class)- Returns:
- entity factory
-
clone
GraphEntities<E> clone()
Force clone implementation- Specified by:
clone
in interfaceMapWrapper<Long,E extends GraphEntity>
- Returns:
- clone of entities
-
getByXmlId
default E getByXmlId(String xmlId)
Return an entity by its XML id Note: not an efficient implementation since it loops over all entities in linear time to identify the correct one, preferably useMapWrapper.get(Object)
instead whenever possible.- Parameters:
xmlId
- the XML id of the entity- Returns:
- the specified entity instance
-
getByExternalId
default Collection<E> getByExternalId(String externalId)
Collect all entities based on a matching external id. Entities are not indexed by external id so this is a very inefficient linear search through all registered entities.- Parameters:
externalId
- to match- Returns:
- found matching links
-
forEachMatchingIdIn
default <T extends IdAble> void forEachMatchingIdIn(Collection<T> values, Consumer<T> consumer)
Apply provided consumer to each element in values as long as that element is registered under the same id.- Type Parameters:
T
- values type- Parameters:
values
- to apply consumer to when they are registered in this wrapperconsumer
- to apply
-
-