Package org.goplanit.userclass
Class UserClass
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.userclass.UserClass
-
- All Implemented Interfaces:
Comparable<IdAble>,ExternalIdAble,IdAble,ManagedId
public class UserClass extends ExternalIdAbleImpl implements ManagedId
A user class defines a combination of one or more characteristics of users in an aggregate representation of traffic which partially dictate how they behave in traffic assignment.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_NAMEdefault namestatic StringDEFAULT_XML_IDDefault XML idstatic Class<UserClass>USERCLASS_ID_CLASSid class for generating ids
-
Constructor Summary
Constructors Constructor Description UserClass(UserClass other)Copy constructorUserClass(IdGroupingToken groupId, String name, Mode mode, TravellerType travelerType)Constructor of user class
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UserClassdeepClone()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 instances of this class based on the token and class identifierClass<? extends UserClass>getIdClass()Each managed id class is expected to generate its ids based on its class signature.ModegetMode()Return the mode of travel of this user classStringgetName()Get the name of this user classTravellerTypegetTravelerType()Get the traveler type of this user classbooleanhasName()check if it has a namelongrecreateManagedIds(IdGroupingToken tokenId)recreate the internal id(s) and set them including the Idable idvoidsetTravellerType(TravellerType travellerType)Set the traveler type of this user class.UserClassshallowClone()Create a shallow copy of this entityStringtoString()-
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, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, hasExternalId, hasXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
-
-
-
Field Detail
-
USERCLASS_ID_CLASS
public static final Class<UserClass> USERCLASS_ID_CLASS
id class for generating ids
-
DEFAULT_NAME
public static final String DEFAULT_NAME
default name- See Also:
- Constant Field Values
-
DEFAULT_XML_ID
public static final String DEFAULT_XML_ID
Default XML id- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UserClass
public UserClass(IdGroupingToken groupId, String name, Mode mode, TravellerType travelerType)
Constructor of user class- Parameters:
groupId- contiguous id generation within this group for instances of this classname- name of this user classmode- the mode of traveltravelerType- the travelerType
-
UserClass
public UserClass(UserClass other)
Copy constructor- Parameters:
other- to copy
-
-
Method Detail
-
generateId
protected static long generateId(IdGroupingToken tokenId)
Generate id for instances of this class based on the token and class identifier- 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
-
getIdClass
public Class<? extends UserClass> getIdClass()
Each managed id class is expected to generate its ids based on its class signature. To be able to generate the correct id the class used for id generation is to be provided via this method call.- Specified by:
getIdClassin interfaceManagedId- Returns:
- idClass to use for generating ids for instances of this idable derived class
-
getTravelerType
public TravellerType getTravelerType()
Get the traveler type of this user class- Returns:
- TravelerType of this user class
-
setTravellerType
public void setTravellerType(TravellerType travellerType)
Set the traveler type of this user class. Use with caution- Parameters:
travellerType- of this user class
-
hasName
public boolean hasName()
check if it has a name- Returns:
- true when name is present false otherwise
-
getName
public String getName()
Get the name of this user class- Returns:
- the name of this user class
-
getMode
public Mode getMode()
Return the mode of travel of this user class- Returns:
- Mode of this user class
-
shallowClone
public UserClass shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Overrides:
shallowClonein classExternalIdAbleImpl- Returns:
- shallow copy of entity
-
deepClone
public UserClass 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
-
-