Package org.goplanit.service.routed
Class RoutedServiceImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.service.routed.RoutedServiceImpl
-
- All Implemented Interfaces:
Comparable<IdAble>
,ExternalIdAble
,IdAble
,ManagedId
,RoutedService
public class RoutedServiceImpl extends ExternalIdAbleImpl implements RoutedService
Implementation of a RoutedService instance based on the RoutedService interface- Author:
- markr
-
-
Field Summary
-
Fields inherited from interface org.goplanit.utils.service.routed.RoutedService
ROUTED_SERVICE_ID_CLASS
-
-
Constructor Summary
Constructors Constructor Description RoutedServiceImpl(RoutedServiceImpl other, boolean deepCopy)
Copy constructorRoutedServiceImpl(IdGroupingToken tokenId, Mode mode)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RoutedServiceImpl
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.protected static long
generateId(IdGroupingToken tokenId)
Generate id for instances of this class based on the token and class identifierMode
getMode()
Access to the mode this routed service utilisesString
getName()
Name of the service, can be a number.String
getNameDescription()
Description of the name of the service, usually a short elaboration in addition to the name (number), for example for a bus the name could be 370 and the nameDescription "Balmain to Coogee"String
getServiceDescription()
Description of the service, longer (if at all) and contextual not meant for end user in realityRoutedServiceTripInfo
getTripInfo()
Access to the trips available for this servicelong
recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable idvoid
resetChildManagedIdEntities()
Each class that has a managed id, should be able to reset any children that themselves are managedIdEntity containers.void
setName(String name)
Name of the service, can be a number.void
setNameDescription(String nameDescription)
Description of the name of the service, usually a short elaboration in addition to the name (number), for example for a bus the name could be 370 and the nameDescription "Balmain to Coogee"void
setServiceDescription(String serviceDescription)
Description of the service, longer (if at all) and contextual not meant for end user in realityRoutedServiceImpl
shallowClone()
Create a shallow copy of this entityString
toString()
-
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, 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.service.routed.RoutedService
extractGeometry, getIdClass, hasName, hasNameDescription, hasServiceDescription
-
-
-
-
Constructor Detail
-
RoutedServiceImpl
public RoutedServiceImpl(IdGroupingToken tokenId, Mode mode)
Constructor- Parameters:
tokenId
- to use for id generationmode
- of the service
-
RoutedServiceImpl
public RoutedServiceImpl(RoutedServiceImpl 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 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:
recreateManagedIds
in 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
-
shallowClone
public RoutedServiceImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceRoutedService
- Overrides:
shallowClone
in classExternalIdAbleImpl
- Returns:
- shallow copy of entity
-
deepClone
public RoutedServiceImpl 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:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in interfaceRoutedService
- Overrides:
deepClone
in classExternalIdAbleImpl
- Returns:
- deep copy of entity
-
getName
public String getName()
Name of the service, can be a number. Shortest visual (user) identifier for the service- Specified by:
getName
in interfaceRoutedService
- Returns:
- name
-
setName
public void setName(String name)
Name of the service, can be a number. Shortest visual (user) identifier for the service- Specified by:
setName
in interfaceRoutedService
- Parameters:
name
- to use
-
getNameDescription
public String getNameDescription()
Description of the name of the service, usually a short elaboration in addition to the name (number), for example for a bus the name could be 370 and the nameDescription "Balmain to Coogee"- Specified by:
getNameDescription
in interfaceRoutedService
- Returns:
- nameDescription
-
setNameDescription
public void setNameDescription(String nameDescription)
Description of the name of the service, usually a short elaboration in addition to the name (number), for example for a bus the name could be 370 and the nameDescription "Balmain to Coogee"- Specified by:
setNameDescription
in interfaceRoutedService
- Parameters:
nameDescription
- to use
-
getServiceDescription
public String getServiceDescription()
Description of the service, longer (if at all) and contextual not meant for end user in reality- Specified by:
getServiceDescription
in interfaceRoutedService
- Returns:
- serviceDescription
-
setServiceDescription
public void setServiceDescription(String serviceDescription)
Description of the service, longer (if at all) and contextual not meant for end user in reality- Specified by:
setServiceDescription
in interfaceRoutedService
- Parameters:
serviceDescription
- to use
-
getTripInfo
public RoutedServiceTripInfo getTripInfo()
Access to the trips available for this service- Specified by:
getTripInfo
in interfaceRoutedService
- Returns:
- known routed service trips
-
getMode
public Mode getMode()
Access to the mode this routed service utilises- Specified by:
getMode
in interfaceRoutedService
- Returns:
- mode for this routed service
-
resetChildManagedIdEntities
public void resetChildManagedIdEntities()
Each class that has a managed id, should be able to reset any children that themselves are managedIdEntity containers. This ensures that when resetting such a container any child containers are also reset- Specified by:
resetChildManagedIdEntities
in interfaceManagedId
-
-