Newer
Older
CactusClient / src / myLibrary / Position.java
package myLibrary;

public class Position<T extends Number> implements Cloneable {
    public T x, y, z;

    public Position() {
        x = null;
        y = null;
        z = null;
    }

    public Position(T val1, T val2) {
        x = val1;
        y = val2;
        z = null;
    }

    public Position(T val1, T val2, T val3) {
        x = val1;
        y = val2;
        z = val3;
    }

    // TODO: 動作確認
    public void swap(Position<T> t){
        Position<T> tmp = this.clone();
        x = t.x;
        y = t.y;
        z = t.z;
        t = tmp;
    }

    // TODO: 動作確認
    @SuppressWarnings("unchecked")
    @Override
    public Position<T> clone(){
        Position<T> p = new Position<T>();
        try {
            p = (Position<T>)super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return p;
    }
}