package demoEnum;

class TestEnum {
	// enum Switch { ON, OFF }
	public static void main(String[] args) {
		Switch hallLight = Switch.ON;
		if (hallLight==Switch.ON) System.out.println("I can see!");
		else System.out.println("It's dark here!");

		String values = "";
		for(Switch x : Switch.values()) {
			values += " " + x;
			System.out.println("Geneology of " + x + " is: " + geneology(x.getClass()));
		}
		System.out.println("Values of Switch are: " + values);

		/*----------Under the Covers-------------------------------------------*/

		SwitchUTC hallLightU = SwitchUTC.ON;
		if (hallLightU==SwitchUTC.ON) System.out.println("I can see!");
		else System.out.println("It's dark here!");

		values = "";
		for(SwitchUTC x : SwitchUTC.values()) {
			values += " " + x;
			System.out.println("Geneology of " + x + " is: " + geneology(x.getClass()));
		}
		System.out.println("Values of SwitchUTC are: " + values);


	}

	public static String geneology(Class c) {
		String result= "";
		if (c==null) return result;
		result += c.getSimpleName();
		Class sc = c.getSuperclass();
		if (sc != null) result += "->" + geneology(sc);
		return result;
	}
}
