info.javelot.functionalj.tuple
Class Quadruple<A,B,C,D>

java.lang.Object
  extended by info.javelot.functionalj.tuple.Pair<A,B>
      extended by info.javelot.functionalj.tuple.Triple<A,B,C>
          extended by info.javelot.functionalj.tuple.Quadruple<A,B,C,D>
All Implemented Interfaces:
Serializable, Comparable<Pair>

public class Quadruple<A,B,C,D>
extends Triple<A,B,C>

Used to create a tuple of four objects. Tuples can be used anywhere there is a need to group objects together, and Quadruples are used by the Tuples.zip(Collection, Collection, Collection, Collection) method.

Author:
Copyright © 2006 Frederic Daoud
See Also:
Serialized Form

Field Summary
 Function1<D,Quadruple<A,B,C,D>> fourth
          Function that returns the fourth element of the tuple.
 Function4<Quadruple<A,B,C,D>,A,B,C,D> quadruple
          Function that creates a Quadruple.
 
Fields inherited from class info.javelot.functionalj.tuple.Triple
third, triple
 
Fields inherited from class info.javelot.functionalj.tuple.Pair
first, pair, second
 
Constructor Summary
Quadruple()
          Default constructor.
Quadruple(A p_first, B p_second, C p_third, D p_fourth)
          Creates a tuple of the four given objects.
 
Method Summary
 int compareTo(Pair p_pair)
          Sort tuples according to the objects that they contain.
 boolean equals(Object p_object)
          Determines if the given object is equal to this object, by comparing the four objects of each quadruple.
 D getFourth()
          Returns the fourth object of the tuple.
protected  List<String> getStrings()
          Returns a list of the String representations of the objects of the tuple.
 int hashCode()
          Returns the hash code associated with this object.
 void setFourth(D p_fourth)
          Sets the fourth object of the tuple.
 
Methods inherited from class info.javelot.functionalj.tuple.Triple
getThird, setThird
 
Methods inherited from class info.javelot.functionalj.tuple.Pair
getFirst, getSecond, setFirst, setSecond, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

quadruple

public Function4<Quadruple<A,B,C,D>,A,B,C,D> quadruple
Function that creates a Quadruple.


fourth

public Function1<D,Quadruple<A,B,C,D>> fourth
Function that returns the fourth element of the tuple.

Constructor Detail

Quadruple

public Quadruple()
Default constructor.


Quadruple

public Quadruple(A p_first,
                 B p_second,
                 C p_third,
                 D p_fourth)
Creates a tuple of the four given objects.

Parameters:
p_fourth - the fourth object of the quadruple. A null value is accepted. The first three parameters are those accepted by Triple.Triple(Object, Object, Object).
See Also:
Triple.Triple(Object, Object, Object)
Method Detail

getFourth

public D getFourth()
Returns the fourth object of the tuple.

Returns:
the fourth object of the tuple, which may be null.

setFourth

public void setFourth(D p_fourth)
Sets the fourth object of the tuple.

Parameters:
p_fourth - the fourth object of the tuple.

hashCode

public int hashCode()
Returns the hash code associated with this object.

Overrides:
hashCode in class Triple<A,B,C>
Returns:
the hash code associated with this object.
See Also:
Pair.hashCode()

equals

public boolean equals(Object p_object)
Determines if the given object is equal to this object, by comparing the four objects of each quadruple.

Overrides:
equals in class Triple<A,B,C>
Parameters:
p_object - the object against which to compare this tuple.
Returns:
true if the pairs contain the same values; false otherwise.
See Also:
Pair.equals(Object)

compareTo

public int compareTo(Pair p_pair)
Description copied from class: Pair
Sort tuples according to the objects that they contain. If the contained in the tuples do not implement the Comparable interface, they are left unsorted.

Specified by:
compareTo in interface Comparable<Pair>
Overrides:
compareTo in class Triple<A,B,C>

getStrings

protected List<String> getStrings()
Returns a list of the String representations of the objects of the tuple. Here the fourth object of the tuple is added to the list.

Overrides:
getStrings in class Triple<A,B,C>
Returns:
a list of the String representations of the objects of the tuple.
See Also:
Pair.toString()