Package org.goplanit.network.virtual
Class CentroidVerticesImpl
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.id.ManagedIdEntitiesImpl<E>
-
- org.goplanit.utils.graph.ManagedGraphEntitiesImpl<CentroidVertex>
-
- org.goplanit.network.virtual.CentroidVerticesImpl
-
- All Implemented Interfaces:
Cloneable
,Iterable<CentroidVertex>
,GraphEntities<CentroidVertex>
,ManagedGraphEntities<CentroidVertex>
,ManagedIdEntities<CentroidVertex>
,CentroidVertices
,LongMapWrapper<CentroidVertex>
,MapWrapper<Long,CentroidVertex>
public class CentroidVerticesImpl extends ManagedGraphEntitiesImpl<CentroidVertex> implements CentroidVertices
Centroid vertices managed container implementation- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Constructor Description CentroidVerticesImpl(CentroidVerticesImpl other, boolean deepCopy, BiConsumer<CentroidVertex,CentroidVertex> mapper)
Copy constructor, also creates new factory with this as its underlying containerCentroidVerticesImpl(IdGroupingToken groupId)
ConstructorCentroidVerticesImpl(IdGroupingToken groupId, CentroidVertexFactory centroidVertexFactory)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CentroidVerticesImpl
deepClone()
Deep clone implementationCentroidVerticesImpl
deepCloneWithMapping(BiConsumer<CentroidVertex,CentroidVertex> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperCentroidVertexFactory
getFactory()
Collect the vertex factory to use for creating instancesvoid
recreateIds(boolean resetManagedIdClass)
Recreate the ids for all registered entities with or without resetting, this includes child managed ids, i.e., nested magedidentities containers if so indicatedvoid
reset()
When reset it called, it not only clears the entries, but also resets the managedids, such that when the container is reused the managed ids start from zero again.CentroidVerticesImpl
shallowClone()
Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created-
Methods inherited from class org.goplanit.utils.graph.ManagedGraphEntitiesImpl
getByXmlId
-
Methods inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
getManagedIdClass, updateIdMapping
-
Methods inherited from class org.goplanit.utils.wrapper.LongMapWrapperImpl
containsKey, get, remove
-
Methods inherited from class org.goplanit.utils.wrapper.MapWrapperImpl
clear, containsValue, createEmptyInstance, firstMatch, get, getKeyByValue, getMap, getValueToKey, isEmpty, iterator, register, remove, removeIf, setMap, size, toCollection, valuesAsNewSet
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.graph.GraphEntities
forEachMatchingIdIn, getByExternalId, getByXmlId
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.goplanit.utils.wrapper.LongMapWrapper
get, remove
-
Methods inherited from interface org.goplanit.utils.id.ManagedIdEntities
containsKey, getManagedIdClass, groupBy, recreateIds, streamSortedBy
-
Methods inherited from interface org.goplanit.utils.wrapper.MapWrapper
addAll, clear, containsValue, firstMatch, forEachIn, get, getFirst, getKeyByValue, isEmpty, register, remove, removeAll, removeIf, size, stream, streamSorted, toCollection, toMap, valuesAsNewSet
-
-
-
-
Constructor Detail
-
CentroidVerticesImpl
public CentroidVerticesImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- to use for creating ids for instances
-
CentroidVerticesImpl
public CentroidVerticesImpl(IdGroupingToken groupId, CentroidVertexFactory centroidVertexFactory)
Constructor- Parameters:
groupId
- to use for creating ids for instancescentroidVertexFactory
- the factory to use
-
CentroidVerticesImpl
public CentroidVerticesImpl(CentroidVerticesImpl other, boolean deepCopy, BiConsumer<CentroidVertex,CentroidVertex> mapper)
Copy constructor, also creates new factory with this as its underlying container- Parameters:
other
- to copydeepCopy
- when true, create a deep cpy, shallow copy otherwisemapper
- apply to each mapping from original to copy
-
-
Method Detail
-
getFactory
public CentroidVertexFactory getFactory()
Collect the vertex factory to use for creating instances- Specified by:
getFactory
in interfaceCentroidVertices
- Specified by:
getFactory
in interfaceGraphEntities<CentroidVertex>
- Specified by:
getFactory
in interfaceManagedIdEntities<CentroidVertex>
- Returns:
- vertexFactory to create edges for this container
-
recreateIds
public void recreateIds(boolean resetManagedIdClass)
Recreate the ids for all registered entities with or without resetting, this includes child managed ids, i.e., nested magedidentities containers if so indicated- Specified by:
recreateIds
in interfaceManagedIdEntities<CentroidVertex>
- Overrides:
recreateIds
in classManagedIdEntitiesImpl<CentroidVertex>
- Parameters:
resetManagedIdClass
- when true we reset the managedId's counter to zero (via its id class) before recreating the ids, otherwise we simply recreate the managed id by starting with the next available id without resetting
-
shallowClone
public CentroidVerticesImpl shallowClone()
Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created- Specified by:
shallowClone
in interfaceCentroidVertices
- Specified by:
shallowClone
in interfaceGraphEntities<CentroidVertex>
- Specified by:
shallowClone
in interfaceManagedGraphEntities<CentroidVertex>
- Specified by:
shallowClone
in interfaceManagedIdEntities<CentroidVertex>
- Specified by:
shallowClone
in interfaceMapWrapper<Long,CentroidVertex>
- Specified by:
shallowClone
in classManagedGraphEntitiesImpl<CentroidVertex>
- Returns:
- copy
-
deepClone
public CentroidVerticesImpl deepClone()
Deep clone implementation- Specified by:
deepClone
in interfaceCentroidVertices
- Specified by:
deepClone
in interfaceGraphEntities<CentroidVertex>
- Specified by:
deepClone
in interfaceManagedGraphEntities<CentroidVertex>
- Specified by:
deepClone
in interfaceManagedIdEntities<CentroidVertex>
- Specified by:
deepClone
in classManagedGraphEntitiesImpl<CentroidVertex>
- Returns:
- deep copy of entities
-
deepCloneWithMapping
public CentroidVerticesImpl deepCloneWithMapping(BiConsumer<CentroidVertex,CentroidVertex> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMapping
in interfaceCentroidVertices
- Specified by:
deepCloneWithMapping
in interfaceGraphEntities<CentroidVertex>
- Specified by:
deepCloneWithMapping
in interfaceManagedGraphEntities<CentroidVertex>
- Specified by:
deepCloneWithMapping
in interfaceManagedIdEntities<CentroidVertex>
- Specified by:
deepCloneWithMapping
in classManagedGraphEntitiesImpl<CentroidVertex>
- Parameters:
mapper
- to apply to each mapping between original and copy- Returns:
- copy
-
reset
public void reset()
When reset it called, it not only clears the entries, but also resets the managedids, such that when the container is reused the managed ids start from zero again. If any entries are managedEntities themselves or contain managed entities themselves, they are reset as well- Specified by:
reset
in interfaceManagedIdEntities<CentroidVertex>
- Overrides:
reset
in classManagedIdEntitiesImpl<CentroidVertex>
-
-