Package org.tensorics.core.commons.util
Class AbstractPair<T>
- java.lang.Object
-
- org.tensorics.core.commons.util.AbstractPair<T>
-
- Type Parameters:
T
- the type of the elements of the pair
- Direct Known Subclasses:
PositionPair
,TensorPair
,ValuePair
public class AbstractPair<T> extends java.lang.Object
A pair of elements, which is used in several occasion within tensorics calculations, where the values of the same type are commonly used together. The content is named as 'left' and 'right' since very often, the two values might contain operands of binary operations. It provides hashCode and equals methods.This class is intended to be subclassed. It is highly recommended that the subclasses provide factory methods.
This class does not put any constraint on the consistency of the values. Also
null
is allowed for both. Related checks are left to the subclases, if desired.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPair(T leftElement, T rightElement)
A protected class constructor, since instances might only be created using sub classes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
int
hashCode()
T
left()
T
right()
-