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<DirectedPath>
-
- org.goplanit.od.path.OdPathsHashed
-
- All Implemented Interfaces:
Cloneable,Comparable<IdAble>,Iterable<DirectedPath>,OdPaths,IdAble,OdData<DirectedPath>,OdHashed<DirectedPath>
public class OdPathsHashed extends OdHashedImpl<DirectedPath> 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.OdDataImpl
zones
-
-
Constructor Summary
Constructors Constructor Description OdPathsHashed(OdPathsHashed other)Copy constructor (shallow copy of contents)OdPathsHashed(IdGroupingToken groupId, OdZones zones)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OdPathsHashedclone()Create a shallow copy of this entityOdPathsHashed.OdPathsHashedIteratoriterator()Returns an iterator which can iterate through all the origin-destination entries-
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
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)
Copy constructor (shallow copy of contents)- Parameters:
other- to copy from
-
-
Method Detail
-
iterator
public OdPathsHashed.OdPathsHashedIterator iterator()
Returns an iterator which can iterate through all the origin-destination entries- Specified by:
iteratorin interfaceIterable<DirectedPath>- Specified by:
iteratorin interfaceOdData<DirectedPath>- Specified by:
iteratorin interfaceOdHashed<DirectedPath>- Specified by:
iteratorin classOdHashedImpl<DirectedPath>- Returns:
- iterator through all available non-empty origin-destination entries
-
clone
public OdPathsHashed clone()
Create a shallow copy of this entity- Specified by:
clonein interfaceIdAble- Specified by:
clonein classOdHashedImpl<DirectedPath>- Returns:
- shallow copy of entity
-
-