Package org.goplanit.mode
Class ModeImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.mode.ModeImpl
-
- All Implemented Interfaces:
Comparable<IdAble>,ExternalIdAble,IdAble,ManagedId,Mode
- Direct Known Subclasses:
PredefinedModeImpl
public class ModeImpl extends ExternalIdAbleImpl implements Mode
A Mode is a user class feature representing a single form of transport (car, truck etc.).- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static LongDEFAULT_EXTERNAL_ID-
Fields inherited from interface org.goplanit.utils.mode.Mode
DEFAULT_XML_ID, GLOBAL_DEFAULT_MAXIMUM_SPEED_KMH, GLOBAL_DEFAULT_PCU, MODE_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedModeImpl(ModeImpl other, boolean deepCopy)Copy constructorprotectedModeImpl(IdGroupingToken groupId, double maxSpeed, String name, double pcu)Constructor, using all defaults for non-provided parametersprotectedModeImpl(IdGroupingToken tokenId, String name, double maxSpeed, double pcu, PhysicalModeFeaturesImpl physicalFeatures, UsabilityModeFeaturesImpl usabilityFeatures)Constructor, using all defaults for non-provided parameters
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ModeImpldeepClone()An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.protected static longgenerateId(IdGroupingToken tokenId)Generate id for this instancedoublegetMaximumSpeedKmH()maximum speed for this modeStringgetName()Name of this modedoublegetPcu()Passenger car unit conversion factor for this modePhysicalModeFeaturesgetPhysicalFeatures()collect the physical features of this modeUsabilityModeFeaturesgetUseFeatures()collect the features of how this mode is used (public, private etc.)longrecreateManagedIds(IdGroupingToken tokenId)recreate the internal id(s) and set them including the Idable idModeImplshallowClone()Create a shallow copy of this entity-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, generateId, getId, hashCode, setId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.mode.Mode
containsExternalId, getIdClass, getPredefinedModeType, hasName, hasPhysicalFeatures, hasUseFeatures, isPredefinedModeType
-
-
-
-
Field Detail
-
DEFAULT_EXTERNAL_ID
public static final Long DEFAULT_EXTERNAL_ID
-
-
Constructor Detail
-
ModeImpl
protected ModeImpl(IdGroupingToken groupId, double maxSpeed, String name, double pcu)
Constructor, using all defaults for non-provided parameters- Parameters:
groupId- contiguous id generation within this group for instances of this classname- the name of this modemaxSpeed- this mode takes onpcu- the PCU value of this mode
-
ModeImpl
protected ModeImpl(IdGroupingToken tokenId, String name, double maxSpeed, double pcu, PhysicalModeFeaturesImpl physicalFeatures, UsabilityModeFeaturesImpl usabilityFeatures)
Constructor, using all defaults for non-provided parameters- Parameters:
tokenId- contiguous id generation within this group for instances of this classname- the name of this modemaxSpeed- this mode takes onpcu- the PCU value of this modephysicalFeatures- physical features of the modeusabilityFeatures- usability features of the mode
-
ModeImpl
protected ModeImpl(ModeImpl other, boolean deepCopy)
Copy constructor- Parameters:
other- to copydeepCopy- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
generateId
protected static long generateId(IdGroupingToken tokenId)
Generate id for this instance- Parameters:
tokenId- to use- Returns:
- generated id
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIdsin interfaceManagedId- Parameters:
tokenId- to use (may be null in case managed id entity does not rely on token to recreate its managed id(s))- Returns:
- the updated internal id
-
getName
public String getName()
Name of this mode
-
getMaximumSpeedKmH
public double getMaximumSpeedKmH()
maximum speed for this mode- Specified by:
getMaximumSpeedKmHin interfaceMode- Returns:
- maximum speed
-
getPcu
public double getPcu()
Passenger car unit conversion factor for this mode
-
getPhysicalFeatures
public final PhysicalModeFeatures getPhysicalFeatures()
collect the physical features of this mode- Specified by:
getPhysicalFeaturesin interfaceMode- Returns:
- the physical mode features
-
getUseFeatures
public final UsabilityModeFeatures getUseFeatures()
collect the features of how this mode is used (public, private etc.)- Specified by:
getUseFeaturesin interfaceMode- Returns:
- the use features of this mode
-
shallowClone
public ModeImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Overrides:
shallowClonein classExternalIdAbleImpl- Returns:
- shallow copy of entity
-
deepClone
public ModeImpl deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code- Specified by:
deepClonein interfaceIdAble- Overrides:
deepClonein classExternalIdAbleImpl- Returns:
- deep copy of entity
-
-