From 89cdf3efb49335e7c07a68a5a64657eeec2288a6 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 6 Feb 2017 11:41:36 -0500 Subject: Inital commit --- labs/lab01_pair/PairInterface.java | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 labs/lab01_pair/PairInterface.java (limited to 'labs/lab01_pair/PairInterface.java') diff --git a/labs/lab01_pair/PairInterface.java b/labs/lab01_pair/PairInterface.java new file mode 100644 index 0000000..b3d78fa --- /dev/null +++ b/labs/lab01_pair/PairInterface.java @@ -0,0 +1,55 @@ + +public interface PairInterface +{ + /** + * Gets the first element of this pair. + * @return the first element of this pair. + */ + public T1 fst(); + + /** + * Gets the second element of this pair. + * @return the second element of this pair. + */ + public T2 snd(); + + /** + * Sets the first element to aFirst. + * @param aFirst the new first element + */ + public void setFst(T1 aFirst); + + /** + * Sets the second element to aSecond. + * @param aSecond the new second element + */ + public void setSnd(T2 aSecond); + + /** + * Checks whether two pairs are equal. Note that the pair + * (a,b) is equal to the pair (x,y) if and only if a is + * equal to x and b is equal to y. + * + * Note that if you forget to implement this method, your + * compiler will not complain since your class inherits this + * method from the class Object. + * + * @return true if this pair is equal to aPair. Otherwise + * return false. + */ + public boolean equals(Object otherObject); + + /** + * Generates a string representing this pair. Note that + * the String representing the pair (x,y) is "(x,y)". There + * is no whitespace unless x or y or both contain whitespace + * themselves. + * + * Note that if you forget to implement this method, your + * compiler will not complain since your class inherits this + * method from the class Object. + * + * @return a string representing this pair. + */ + public String toString(); +} -- cgit v1.2.3-70-g09d2