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 class
OdPathsHashed.OdPathsHashedIterator
Wrapper 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 OdPathsHashed
clone()
Create a shallow copy of this entityOdPathsHashed.OdPathsHashedIterator
iterator()
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:
iterator
in interfaceIterable<DirectedPath>
- Specified by:
iterator
in interfaceOdData<DirectedPath>
- Specified by:
iterator
in interfaceOdHashed<DirectedPath>
- Specified by:
iterator
in 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:
clone
in interfaceIdAble
- Specified by:
clone
in classOdHashedImpl<DirectedPath>
- Returns:
- shallow copy of entity
-
-