Class Tuple

java.lang.Object
edu.uky.ai.util.Tuple

public class Tuple
extends java.lang.Object
A tuple is simply an array of Objects implemented such that two tuples are the same (i.e. Object#equals(Object)) if their arrays contain values which are equal. Tuples can, for example, be use as multi-valued keys to HashMaps.
Author:
Stephen G. Ware
  • Field Summary

    Fields 
    Modifier and Type Field Description
    java.lang.Object[] elements
    The array of objects in the tuple
  • Constructor Summary

    Constructors 
    Constructor Description
    Tuple​(int size)
    Constructs a tuple of a given size with each element as null.
    Tuple​(java.lang.Object... elements)
    Constructs a tuple from a given set of objects.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object other)  
    int hashCode()  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • elements

      public final java.lang.Object[] elements
      The array of objects in the tuple
  • Constructor Details

    • Tuple

      public Tuple​(java.lang.Object... elements)
      Constructs a tuple from a given set of objects.
      Parameters:
      elements - the objects
    • Tuple

      public Tuple​(int size)
      Constructs a tuple of a given size with each element as null.
      Parameters:
      size - the size of the tuple
  • Method Details

    • equals

      public boolean equals​(java.lang.Object other)
      Overrides:
      equals in class java.lang.Object
    • hashCode

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

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object