Package org.goplanit.mode
Class ModesImpl
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.id.ManagedIdEntitiesImpl<Mode>
-
- org.goplanit.mode.ModesImpl
-
- All Implemented Interfaces:
Iterable<Mode>
,ManagedIdEntities<Mode>
,Modes
,LongMapWrapper<Mode>
,MapWrapper<Long,Mode>
public class ModesImpl extends ManagedIdEntitiesImpl<Mode> implements Modes
Implementation of the Modes interface to create and register modes- Author:
- mark
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Constructor Description ModesImpl(ModesImpl other, boolean deepCopy, BiConsumer<Mode,Mode> mapper)
Copy Constructor, also creates a new factory with reference to this containerModesImpl(IdGroupingToken groupId)
ConstructorModesImpl(ModeFactory modeFactory)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsPredefinedMode(PredefinedModeType modeType)
verify if predefined mode is registeredModesImpl
deepClone()
Deep clone implementationModesImpl
deepCloneWithMapping(BiConsumer<Mode,Mode> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperPredefinedMode
get(PredefinedModeType modeType)
get predefined mode if it is registeredMode
getByXmlId(String xmlId)
Retrieve a Mode by its XML IdModeFactory
getFactory()
Collect the mode factory to use for creating instancesModesImpl
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.id.ManagedIdEntitiesImpl
getManagedIdClass, recreateIds, reset, 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 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, recreateIds, reset, 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
-
ModesImpl
public ModesImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- to use for creating ids for instances
-
ModesImpl
public ModesImpl(ModeFactory modeFactory)
Constructor- Parameters:
modeFactory
- factory to use
-
ModesImpl
public ModesImpl(ModesImpl other, boolean deepCopy, BiConsumer<Mode,Mode> mapper)
Copy Constructor, also creates a new factory with reference to this container- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwisemapper
- to apply in case of deep copy to each original to copy combination (when provided, may be null)
-
-
Method Detail
-
containsPredefinedMode
public boolean containsPredefinedMode(PredefinedModeType modeType)
verify if predefined mode is registered- Specified by:
containsPredefinedMode
in interfaceModes
- Parameters:
modeType
- to verify- Returns:
- true when available, false otherwise
-
get
public PredefinedMode get(PredefinedModeType modeType)
get predefined mode if it is registered
-
getByXmlId
public Mode getByXmlId(String xmlId)
Retrieve a Mode by its XML Id- Specified by:
getByXmlId
in interfaceModes
- Parameters:
xmlId
- the XML Id of the specified mode- Returns:
- the retrieved mode, or null if no mode was found
-
shallowClone
public ModesImpl 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 interfaceManagedIdEntities<Mode>
- Specified by:
shallowClone
in interfaceMapWrapper<Long,Mode>
- Specified by:
shallowClone
in interfaceModes
- Specified by:
shallowClone
in classManagedIdEntitiesImpl<Mode>
- Returns:
- copy
-
deepClone
public ModesImpl deepClone()
Deep clone implementation- Specified by:
deepClone
in interfaceManagedIdEntities<Mode>
- Specified by:
deepClone
in interfaceModes
- Specified by:
deepClone
in classManagedIdEntitiesImpl<Mode>
- Returns:
- deep copy of entities
-
deepCloneWithMapping
public ModesImpl deepCloneWithMapping(BiConsumer<Mode,Mode> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMapping
in interfaceManagedIdEntities<Mode>
- Specified by:
deepCloneWithMapping
in interfaceModes
- Specified by:
deepCloneWithMapping
in classManagedIdEntitiesImpl<Mode>
- Parameters:
mapper
- to apply to each mapping between original and copy- Returns:
- copy
-
getFactory
public ModeFactory getFactory()
Collect the mode factory to use for creating instances- Specified by:
getFactory
in interfaceManagedIdEntities<Mode>
- Specified by:
getFactory
in interfaceModes
- Returns:
- modeFactory to create modes for this container
-
-