edu.stanford.nlp.util
Class Triple<T1,T2,T3>
java.lang.Object
edu.stanford.nlp.util.Triple<T1,T2,T3>
- All Implemented Interfaces:
- PrettyLoggable, Serializable
public class Triple<T1,T2,T3>
- extends Object
- implements Serializable, PrettyLoggable
Class representing an ordered triple of objects, possibly typed.
Useful when you'd like a method to return three objects, or would like to put
triples of objects in a Collection or Map. equals() and hashcode() should
work properly.
- Author:
- Teg Grenager (grenager@stanford.edu)
- See Also:
- Serialized Form
first
public T1 first
second
public T2 second
third
public T3 third
Triple
public Triple(T1 first,
T2 second,
T3 third)
first
public T1 first()
second
public T2 second()
third
public T3 third()
setFirst
public void setFirst(T1 o)
setSecond
public void setSecond(T2 o)
setThird
public void setThird(T3 o)
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
asList
public List<Object> asList()
makeTriple
public static <X,Y,Z> Triple<X,Y,Z> makeTriple(X x,
Y y,
Z z)
- Returns a Triple constructed from X, Y, and Z. Convenience method; the
compiler will disambiguate the classes used for you so that you don't have
to write out potentially long class names.
prettyLog
public void prettyLog(Redwood.RedwoodChannels channels,
String description)
- Pretty logs the current object to specific Redwood channels.
- Specified by:
prettyLog
in interface PrettyLoggable
- Parameters:
channels
- the channels which should be logged to -- all logging calls should
use logging methods on the channels (e.g. channels.log(), etc.)description
- The description of the object. It will potentially identify the
object's functional role or (failing that) its class. This is
typically used as a track name surrounding the contents of this
object.
Stanford NLP Group