Class NodesImpl
- 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<Node>
-
- org.goplanit.network.layer.physical.NodesImpl
-
- All Implemented Interfaces:
Cloneable,Iterable<Node>,GraphEntities<Node>,ManagedGraphEntities<Node>,ManagedIdEntities<Node>,Nodes,LongMapWrapper<Node>,MapWrapper<Long,Node>
public class NodesImpl extends ManagedGraphEntitiesImpl<Node> implements Nodes
Nodes primary managed container implementation- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Constructor Description NodesImpl(NodesImpl other, boolean deepCopy, BiConsumer<Node,Node> mapper)Copy constructor, also creates new factory with this as its underlying containerNodesImpl(IdGroupingToken groupId)ConstructorNodesImpl(IdGroupingToken groupId, NodeFactory nodeFactory)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodesImpldeepClone()Deep clone implementationNodesImpldeepCloneWithMapping(BiConsumer<Node,Node> mapper)Deep clone implementation where the mapping for its internal copies is captured by the provided mapperNodeFactorygetFactory()Factory to create instance of graph entity (for this container class)voidrecreateIds(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 indicatedvoidreset()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.NodesImplshallowClone()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
-
NodesImpl
public NodesImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId- to use for creating ids for instances
-
NodesImpl
public NodesImpl(IdGroupingToken groupId, NodeFactory nodeFactory)
Constructor- Parameters:
groupId- to use for creating ids for instancesnodeFactory- the factory to use
-
NodesImpl
public NodesImpl(NodesImpl other, boolean deepCopy, BiConsumer<Node,Node> 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 NodeFactory getFactory()
Factory to create instance of graph entity (for this container class)- Specified by:
getFactoryin interfaceGraphEntities<Node>- Specified by:
getFactoryin interfaceManagedIdEntities<Node>- Specified by:
getFactoryin interfaceNodes- Returns:
- entity factory
-
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:
recreateIdsin interfaceManagedIdEntities<Node>- Overrides:
recreateIdsin classManagedIdEntitiesImpl<Node>- 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 NodesImpl 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:
shallowClonein interfaceGraphEntities<Node>- Specified by:
shallowClonein interfaceManagedGraphEntities<Node>- Specified by:
shallowClonein interfaceManagedIdEntities<Node>- Specified by:
shallowClonein interfaceMapWrapper<Long,Node>- Specified by:
shallowClonein interfaceNodes- Specified by:
shallowClonein classManagedGraphEntitiesImpl<Node>- Returns:
- copy
-
deepClone
public NodesImpl deepClone()
Deep clone implementation- Specified by:
deepClonein interfaceGraphEntities<Node>- Specified by:
deepClonein interfaceManagedGraphEntities<Node>- Specified by:
deepClonein interfaceManagedIdEntities<Node>- Specified by:
deepClonein interfaceNodes- Specified by:
deepClonein classManagedGraphEntitiesImpl<Node>- Returns:
- deep copy of entities
-
deepCloneWithMapping
public NodesImpl deepCloneWithMapping(BiConsumer<Node,Node> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMappingin interfaceGraphEntities<Node>- Specified by:
deepCloneWithMappingin interfaceManagedGraphEntities<Node>- Specified by:
deepCloneWithMappingin interfaceManagedIdEntities<Node>- Specified by:
deepCloneWithMappingin interfaceNodes- Specified by:
deepCloneWithMappingin classManagedGraphEntitiesImpl<Node>- 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:
resetin interfaceManagedIdEntities<Node>- Overrides:
resetin classManagedIdEntitiesImpl<Node>
-
-