csli.util
Class Pair<A1,B2>

java.lang.Object
  extended by csli.util.Pair<A1,B2>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ComparablePair

public class Pair<A1,B2>
extends Object
implements Serializable

Pair of objects (when you need to return two, or put them on a list)

Author:
Danilo Mirkovic
See Also:
Serialized Form

Field Summary
 A1 a
           
 B2 b
           
 boolean onlyFirstToString
           
 
Constructor Summary
Pair(A1 a, B2 b)
           
Pair(A1 a, B2 b, boolean onlyFirstToString)
           
Pair(Pair<A1,B2> p)
           
 
Method Summary
 boolean equals(Object obj)
          Tests for equality against another object.
 A1 first()
           
 boolean getBool()
           
 double getDouble()
           
 int getInt()
           
 B2 second()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

a

public A1 a

b

public B2 b

onlyFirstToString

public boolean onlyFirstToString
Constructor Detail

Pair

public Pair(A1 a,
            B2 b)

Pair

public Pair(Pair<A1,B2> p)

Pair

public Pair(A1 a,
            B2 b,
            boolean onlyFirstToString)
Method Detail

first

public A1 first()

second

public B2 second()

getBool

public boolean getBool()

getInt

public int getInt()

getDouble

public double getDouble()

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Tests for equality against another object.

Two pairs are equal if and only if:

Overrides:
equals in class Object
Parameters:
obj - The object to test against.
Returns:
True if the two objects are equal.