Class 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()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractPair

        protected AbstractPair​(T leftElement,
                               T rightElement)
        A protected class constructor, since instances might only be created using sub classes.
    • Method Detail

      • left

        public final T left()
      • right

        public final T right()
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object