package functions; public class Position<T extends Number> implements Cloneable { public T x, y, z; public Position() { x = 0.0; y = 0.0; } public Position(T1 val1, T2 val2) { first = val1; second = val2; } public void swap(Position<T1, T2> t){ Position<T1, T2> tmp = this; first = t.first; second = t.second; t = tmp; } @SuppressWarnings("unchecked") @Override public Position<T1, T2> clone(){ Position<T1, T2> p = new Position<T1, T2>(); try { p = (Position<T1, T2>)super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return p; } }