Package org.goplanit.od.path
Class OdPathsHashed
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.od.OdDataImpl<T>
-
- org.goplanit.utils.od.OdHashedImpl<ManagedDirectedPath>
-
- org.goplanit.od.path.OdPathsHashed
-
- All Implemented Interfaces:
Comparable<IdAble>,Iterable<ManagedDirectedPath>,OdPaths,IdAble,OdData<ManagedDirectedPath>,OdHashed<ManagedDirectedPath>
public class OdPathsHashed extends OdHashedImpl<ManagedDirectedPath> implements OdPaths
This class stores paths by their origin and destination by creating a unique hash for the combined ids of the od zones. This results in a memory efficient implementation requiring only a single hash based container, instead of having as many containers as their are origins. It also means only conducting a single lookup despite the fact we have two keys (o and d).- Author:
- markr
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classOdPathsHashed.OdPathsHashedIteratorWrapper around hashed iterator for od paths
-
Field Summary
-
Fields inherited from class org.goplanit.utils.od.OdHashedImpl
odHashed
-
Fields inherited from class org.goplanit.utils.od.OdDataImpl
zones
-
-
Constructor Summary
Constructors Constructor Description OdPathsHashed(OdPathsHashed other, boolean deepCopy)Copy constructorOdPathsHashed(IdGroupingToken groupId, OdZones zones)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OdPathsHasheddeepClone()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.OdPathsHashed.OdPathsHashedIteratoriterator()Returns an iterator which can iterate through all the origin-destination entriesOdPathsHashedshallowClone()Create a shallow copy of this entity-
Methods inherited from class org.goplanit.utils.od.OdHashedImpl
getValue, getValue, setValue
-
Methods inherited from class org.goplanit.utils.od.OdDataImpl
getNumberOfOdZones, getOdZones
-
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.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.goplanit.utils.od.OdData
getNumberOfOdZones, getValue, getValue, setValue
-
-
-
-
Constructor Detail
-
OdPathsHashed
public OdPathsHashed(IdGroupingToken groupId, OdZones zones)
Constructor- Parameters:
groupId- contiguous id generation within this group for instances of this classzones- the zones being used
-
OdPathsHashed
public OdPathsHashed(OdPathsHashed other, boolean deepCopy)
Copy constructor- Parameters:
other- to copy fromdeepCopy- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
iterator
public OdPathsHashed.OdPathsHashedIterator iterator()
Returns an iterator which can iterate through all the origin-destination entries- Specified by:
iteratorin interfaceIterable<ManagedDirectedPath>- Specified by:
iteratorin interfaceOdData<ManagedDirectedPath>- Specified by:
iteratorin interfaceOdHashed<ManagedDirectedPath>- Specified by:
iteratorin classOdHashedImpl<ManagedDirectedPath>- Returns:
- iterator through all available non-empty origin-destination entries
-
shallowClone
public OdPathsHashed shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein interfaceOdData<ManagedDirectedPath>- Specified by:
shallowClonein classOdHashedImpl<ManagedDirectedPath>- Returns:
- shallow copy of entity
-
deepClone
public OdPathsHashed 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- Specified by:
deepClonein classOdHashedImpl<ManagedDirectedPath>- Returns:
- deep copy of entity
-
-