public class Obj implements java.io.Serializable {
	static final long serialVersionUID = 1L;
	
	// Object type
	public static final int YUKKURI = 1;
	public static final int SHIT = 2;
	public static final int FOOD = 3;
	
	// Object event
	public static final int BIRTHBABY = 1;
	public static final int DOSHIT = 2;
	public static final int DEAD = 3;
	public static final int REMOVED = 4;
	public static final int DONOTHING = 5;
	
	public static final int TICK = 1;

	// basic attributes
	protected long age;			//age of this object
	protected int x, y, z;		//location
	protected int objType;		//YUKKURI, SHIT, FOOD
	protected boolean removed = false;
	protected boolean grabbed = false;
	
	public int getX() {
		return x;
	}
	
	public int getY() {
		return y;
	}
	
	public int getZ() {
		return z;
	}
	
	public void setX(int X) {
		if (X < 0) {
			x = 0;
		}
		else if (X > Box.maxX) {
			x = Box.maxX;
		}
		else {
			x = X;
		}
	}
	
	public void setY(int Y) {
		if (Y < 0) {
			y = 0;
		}
		else if(Y > Box.maxY) {
			y = Box.maxY;
		}
		else {
			y = Y;
		}
	}
	
	public void setZ(int Z) {
		if (Z < 0) {
			z = 0;
		}
		else if (Z > Box.maxZ) {
			z = Box.maxZ;
		}
		else {
			z = Z;
		}
	}
	
	public void grab() {
		grabbed = true;
	}
	
	public void release() {
		grabbed = false;
	}
	
	public boolean isGrabbed() {
		return grabbed;
	}
	
	public int getObjType() {
		return objType;
	}
	
	public void remove() {
		removed = true;
	}
	
	public int clockTick() {
		age += TICK;
		if (removed == true) {
			return REMOVED;
		}
		return DONOTHING;
	}
}