mirror of
https://github.com/Barubary/dsdecmp.git
synced 2025-02-21 13:47:14 +01:00
Java: Added some simple JavaDoc to the Pair class.
This commit is contained in:
parent
2bd45587cf
commit
1ab4aa0c69
@ -1,18 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Very simple wrapper to contain two values in one object.
|
||||||
|
*/
|
||||||
public class Pair<T,U> {
|
public class Pair<T,U> {
|
||||||
|
|
||||||
|
/** The first value */
|
||||||
private T first;
|
private T first;
|
||||||
|
/** The second value */
|
||||||
private U second;
|
private U second;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Pair of values.
|
||||||
|
* @param one The first value.
|
||||||
|
* @param two The second value.
|
||||||
|
*/
|
||||||
public Pair(T one, U two){
|
public Pair(T one, U two){
|
||||||
this.first = one;
|
this.first = one;
|
||||||
this.second = two;
|
this.second = two;
|
||||||
}
|
}
|
||||||
public Pair(){}
|
/**
|
||||||
|
* Creates a new Pair of values, both initialized to {@code null}
|
||||||
|
*/
|
||||||
|
public Pair(){ this(null, null); }
|
||||||
|
|
||||||
|
/** Returns the first value of this Pair. */
|
||||||
public T getFirst(){ return this.first; }
|
public T getFirst(){ return this.first; }
|
||||||
|
/** Sets the first value of this Pair. */
|
||||||
public void setFirst(T value){ this.first = value; }
|
public void setFirst(T value){ this.first = value; }
|
||||||
|
/** Returns the second value of this Pair. */
|
||||||
public U getSecond(){ return this.second; }
|
public U getSecond(){ return this.second; }
|
||||||
|
/** Sets the second value of this Pair. */
|
||||||
public void setSecond(U value){ this.second = value; }
|
public void setSecond(U value){ this.second = value; }
|
||||||
|
/** Returns true iff both values in this Pair are non-null. */
|
||||||
public boolean allSet(){ return this.first != null && this.second != null; }
|
public boolean allSet(){ return this.first != null && this.second != null; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user