Package org.goplanit.utils.od
Class OdPrimitiveMatrix<T extends Number>
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.od.OdDataImpl<T>
-
- org.goplanit.utils.od.OdMatrixImpl<T,org.ojalgo.array.Array2D<T>>
-
- org.goplanit.utils.od.OdPrimitiveMatrix<T>
-
- All Implemented Interfaces:
Comparable<IdAble>,Iterable<T>,IdAble,OdData<T>,OdMatrix<T,org.ojalgo.array.Array2D<T>>
- Direct Known Subclasses:
OdDemandMatrix,OdSkimMatrix
public abstract class OdPrimitiveMatrix<T extends Number> extends OdMatrixImpl<T,org.ojalgo.array.Array2D<T>>
This class contains common methods for handling origin-demand matrices.- Author:
- gman6028, markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.od.OdMatrixImpl
matrixContents
-
Fields inherited from class org.goplanit.utils.od.OdDataImpl
zones
-
-
Constructor Summary
Constructors Constructor Description OdPrimitiveMatrix(Class<? extends IdAble> idTokenClass, IdGroupingToken idToken, OdZones zones, org.ojalgo.array.Array2D<T> matrixContents)Constructor for Od matrix containing primitives, i.e.OdPrimitiveMatrix(OdPrimitiveMatrix<T> other, org.ojalgo.array.Array2D.Factory<T> contentFactory)Copy Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description OdPrimitiveMatrix<T>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.TgetValue(long originId, long destinationId)Returns the value for a specified origin and destination by their internal idTgetValue(Zone origin, Zone destination)Returns the value for a specified origin and destinationabstract OdMatrixIterator<T,org.ojalgo.array.Array2D<T>>iterator()Returns an iterator which can iterate through all the origin-destination cells in the matrixvoidsetValue(Zone origin, Zone destination, T value)Sets the value for a specified origin and destinationabstract OdPrimitiveMatrix<T>shallowClone()Create a shallow copy of this entity-
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
-
-
-
-
Constructor Detail
-
OdPrimitiveMatrix
public OdPrimitiveMatrix(Class<? extends IdAble> idTokenClass, IdGroupingToken idToken, OdZones zones, org.ojalgo.array.Array2D<T> matrixContents)
Constructor for Od matrix containing primitives, i.e. number based- Parameters:
idTokenClass- to use for id generationidToken- to use for the matrix idzones- holder for zones considered in the matrixmatrixContents- container for the matrix contents
-
OdPrimitiveMatrix
public OdPrimitiveMatrix(OdPrimitiveMatrix<T> other, org.ojalgo.array.Array2D.Factory<T> contentFactory)
Copy Constructor- Parameters:
other- to copycontentFactory- to use
-
-
Method Detail
-
setValue
public void setValue(Zone origin, Zone destination, T value)
Sets the value for a specified origin and destination- Parameters:
origin- specified origindestination- specified destinationvalue- value at the specified cell
-
getValue
public T getValue(Zone origin, Zone destination)
Returns the value for a specified origin and destination- Parameters:
origin- specified origindestination- specified destination- Returns:
- value at the specified cell
-
getValue
public T getValue(long originId, long destinationId)
Returns the value for a specified origin and destination by their internal id- Parameters:
originId- specified origindestinationId- specified destination- Returns:
- value at the specified cell
-
shallowClone
public abstract OdPrimitiveMatrix<T> shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein interfaceOdData<T extends Number>- Specified by:
shallowClonein classOdMatrixImpl<T extends Number,org.ojalgo.array.Array2D<T extends Number>>- Returns:
- shallow copy of entity
-
deepClone
public OdPrimitiveMatrix<T> 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
-
iterator
public abstract OdMatrixIterator<T,org.ojalgo.array.Array2D<T>> iterator()
Returns an iterator which can iterate through all the origin-destination cells in the matrix- Specified by:
iteratorin interfaceIterable<T extends Number>- Specified by:
iteratorin interfaceOdData<T extends Number>- Specified by:
iteratorin interfaceOdMatrix<T extends Number,org.ojalgo.array.Array2D<T extends Number>>- Specified by:
iteratorin classOdMatrixImpl<T extends Number,org.ojalgo.array.Array2D<T extends Number>>- Returns:
- iterator through all the origin-destination cells
-
-