FileDocCategorySizeDatePackage
Inference.javaAPI DocExample3125Thu Dec 11 04:49:56 GMT 2003oreilly.hcj.tiger

Inference

public class Inference extends Object
Implements a manager of lists that stores the lists by key.

Fields Summary
static int
callCount
Constructors Summary
Methods Summary
public static final voidmain(java.lang.String[] args)

		// introductory 
		System.out.print("1)");
		someMethod("Hello");

		//System.out.print("2)");
		//someMethod(new C());

		// Simple
		//System.out.print("3)");
		//someMethod("hello").getClass();

		//System.out.print("4)");
		//someMethod(new Object()).getClass();

		System.out.print("5)");
		someMethod(new Integer(5)).getClass();

		System.out.print("6)");
		someMethod(5).getClass();

		//System.out.print("7)");
		//someMethod().getClass();

		// Less Than Simple
		List<A> first = new ArrayList<A>();
		first.add(new A());

		List<B> second = new ArrayList<B>();
		second.add(new B());
		
		try {
			System.out.print("8)");
			someMethod(new A(), new ArrayList<B>()).getClass();
		} catch (final ClassCastException ex) { ex.printStackTrace(); }

		try {
			System.out.print("9)");
			someMethod(new B(), new ArrayList<A>()).getClass();
		} catch (final NullPointerException ex) { ex.printStackTrace(); }

		//System.out.print("1)");
		Inference.<A>someMethod(new B(), new ArrayList<A>()).getClass();

		System.out.print("10)");
		someMethod(5, new ArrayList<Object>()).getClass();

		System.out.print("11)");
		someMethod(5, null).getClass();

		// Significantly Less than Simple
	
public static java.util.Listnothing()

		List<Type> result = new ArrayList<Type>();
		System.out.print(" Fourth==> ");
		System.out.println(result.getClass().getComponentType());
		return result;
	
public static TypesomeMethod(Type obj)


	       
		System.out.print(" First==> ");
		System.out.println(obj.getClass());
		return obj;
	
public static TypesomeMethod(Type num)

		System.out.print(" Second==> ");
		System.out.println(num.getClass());
		return num;
	
public static TypesomeMethod(Type obj, java.util.List list)

		System.out.print(" Third==> ");
		System.out.println(obj.getClass());
		for (Type element : list) {
		}
		return obj;
	
public static voidsomeMethod(java.lang.Object obj)

		System.out.print(" Fifth==> ");
		System.out.println(obj.getClass());
	
public static voidsomeMethod(java.lang.String str)

		System.out.print(" Sixth==> ");
		System.out.println(str.getClass());