Class LinksImpl<L extends Link>
- 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<L>
-
- org.goplanit.network.layer.physical.LinksImpl<L>
-
- All Implemented Interfaces:
Cloneable
,Iterable<L>
,GraphEntities<L>
,ManagedGraphEntities<L>
,ManagedIdEntities<L>
,Links<L>
,LongMapWrapper<L>
,MapWrapper<Long,L>
- Direct Known Subclasses:
MacroscopicLinksImpl
public class LinksImpl<L extends Link> extends ManagedGraphEntitiesImpl<L> implements Links<L>
Links primary managed container implementation- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkFactory
linkFactory
factory to use-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Modifier Constructor Description LinksImpl(LinksImpl linksImpl, boolean deepCopy, BiConsumer<L,L> mapper)
Copy constructor, also creates new factory with this as its underlying containerLinksImpl(IdGroupingToken groupId)
Constructorprotected
LinksImpl(IdGroupingToken groupId, LinkFactory linkFactory)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LinksImpl
deepClone()
Deep clone implementationLinksImpl
deepCloneWithMapping(BiConsumer<L,L> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperLinkFactory
getFactory()
Factory to create instance of graph entity (for this container class)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 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.LinksImpl
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
-
-
-
-
Field Detail
-
linkFactory
protected LinkFactory linkFactory
factory to use
-
-
Constructor Detail
-
LinksImpl
protected LinksImpl(IdGroupingToken groupId, LinkFactory linkFactory)
Constructor- Parameters:
groupId
- to use for creating ids for instanceslinkFactory
- to use
-
LinksImpl
public LinksImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- to use for creating ids for instances
-
LinksImpl
public LinksImpl(LinksImpl linksImpl, boolean deepCopy, BiConsumer<L,L> mapper)
Copy constructor, also creates new factory with this as its underlying container- Parameters:
linksImpl
- to copydeepCopy
- when true, create a deep cpy, shallow copy otherwisemapper
- to apply in case of deep copy to each original to copy combination (when provided, may be null)
-
-
Method Detail
-
getFactory
public LinkFactory getFactory()
Factory to create instance of graph entity (for this container class)- Specified by:
getFactory
in interfaceGraphEntities<L extends Link>
- Specified by:
getFactory
in interfaceLinks<L extends Link>
- Specified by:
getFactory
in interfaceManagedIdEntities<L extends Link>
- Returns:
- entity factory
-
shallowClone
public LinksImpl 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 interfaceGraphEntities<L extends Link>
- Specified by:
shallowClone
in interfaceLinks<L extends Link>
- Specified by:
shallowClone
in interfaceManagedGraphEntities<L extends Link>
- Specified by:
shallowClone
in interfaceManagedIdEntities<L extends Link>
- Specified by:
shallowClone
in interfaceMapWrapper<Long,L extends Link>
- Specified by:
shallowClone
in classManagedGraphEntitiesImpl<L extends Link>
- Returns:
- copy
-
deepClone
public LinksImpl deepClone()
Deep clone implementation- Specified by:
deepClone
in interfaceGraphEntities<L extends Link>
- Specified by:
deepClone
in interfaceLinks<L extends Link>
- Specified by:
deepClone
in interfaceManagedGraphEntities<L extends Link>
- Specified by:
deepClone
in interfaceManagedIdEntities<L extends Link>
- Specified by:
deepClone
in classManagedGraphEntitiesImpl<L extends Link>
- Returns:
- deep copy of entities
-
deepCloneWithMapping
public LinksImpl deepCloneWithMapping(BiConsumer<L,L> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMapping
in interfaceGraphEntities<L extends Link>
- Specified by:
deepCloneWithMapping
in interfaceLinks<L extends Link>
- Specified by:
deepCloneWithMapping
in interfaceManagedGraphEntities<L extends Link>
- Specified by:
deepCloneWithMapping
in interfaceManagedIdEntities<L extends Link>
- Specified by:
deepCloneWithMapping
in classManagedGraphEntitiesImpl<L extends Link>
- Parameters:
mapper
- to apply to each mapping between original and copy- Returns:
- copy
-
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<L extends Link>
- Overrides:
recreateIds
in classManagedIdEntitiesImpl<L extends Link>
- 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
-
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<L extends Link>
- Overrides:
reset
in classManagedIdEntitiesImpl<L extends Link>
-
-