If you think the Android project Turn-of-War listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/* This file is part of Dragon Wars.
*/*www.java2s.com*/
* Dragon Wars is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Dragon Wars is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Dragon Wars. If not, see <http://www.gnu.org/licenses/>.
*/package uk.co.fuuzetsu.turnofwar.engine;
publicclass Pair<L, R> {
private L left;
private R right;
public Pair(final L left, final R right) {
this.left = left;
this.right = right;
}
public L getLeft() {
return this.left;
}
public R getRight() {
return this.right;
}
publicvoid setLeft(final L l) {
this.left = l;
}
publicvoid setRight(final R r) {
this.right = r;
}
public String toString() {
return String.format("(%s, %s)", left, right);
}
@Override
publicint hashCode() {
int hashFirst = left != null ? left.hashCode() : 0;
int hashSecond = right != null ? right.hashCode() : 0;
return (hashFirst + hashSecond) * hashSecond + hashFirst;
}
@Override
publicboolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof Pair)) {
return false;
}
Pair that = (Pair) other;
return left.equals(that.getLeft()) && right.equals(that.getRight());
}
}