package Lib;

public abstract class Simple {

	protected Simple(){}

	public boolean equals(Object o){
		/*rule
		 * x.equals(x)
		 * x.equals(y) -> y.equal(x)
		 * z extends x z.equals(x) -> x.equals(z)
		 *     mean that super class must support subclass
		 * x.equals(null) -> null
		 * recipe:
		 * 		if this == o return true;
		 * 		if o == null return null;
		 * 		if !(o instanceof MyClass) return false
		 * 		if (o instanceof MySubClass) do special test
		 * 		do test
		 *
		 * */
		throw new UnsupportedOperationException();
	}

	public int hashCode(){
		/*
		 * must not depend on equals
		 * but equals object must return the same hash
		 * not necesary that not equals objects return distinct hash
		 * but it can improve hashMap performance
		 * recipe
		 * 		result = 42 arbitrary starting number
		 * 					different between different class
		 * 					ensure that zero does not give same result
		 * 					in two unequals object
		 *		for all properties
		 *			boolean -> c=1 if f==true
		 *			byte char short -> c = (int)f
		 *			long -> c = (int)(f>>>32)
		 *			float -> c = Float.floatToIntBits(f)
		 *			double -> c = (int)(Double.doubleToLongBits(f)>>>32)
		 *			Object -> c = f.hashCode()
		 *			result = 37 * result + c ; where 37 is arbitrary odd prime
		 * */
		throw new UnsupportedOperationException();
	}

	public String toString(){
		/*will return className@hashCode if not specified*/
		throw new UnsupportedOperationException();
	}

	public Object clone(){
		/*completly useless with immutable object*/
		throw new UnsupportedOperationException();
	}

	/*implements Comparable
	 * public int compareTo(Object o){
	 * 	/*negative if less than 0
	 * 	  zero if equal
	 *    positive if greater than o
	 * }
	 * */

	/*implements Serializable
	 *  private void writeObject(java.io.ObjectOutputStream out)
     			throws IOException
 		private void readObject(java.io.ObjectInputStream in)
     			throws IOException, ClassNotFoundException;
    */
}
