[ create a new paste ] login | about

Link: http://codepad.org/XutwvI9D    [ raw code | fork ]

Plain Text, pasted on Nov 17:
public abstract class Piece<T extends Piece> implements Comparable<T>{
	
        //Note: This could also obviously return Piece
	public abstract T collide(T other);
}

public class ChessPiece extends Piece<ChessPiece> {

	public ChessPiece collide(ChessPiece other) {
		return this;
	}

	public int compareTo(ChessPiece arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

}

public class RPGPiece extends Piece<RPGPiece>{

	public int compareTo(RPGPiece o) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public RPGPiece collide(RPGPiece other) {
		return this.compareTo(other) > 0 ? this: other;
	}
}



Create a new paste based on this one


Comments: