/FileExtraction/Java_unseen/slavpetrov_berkeleyparser/src/edu/berkeley/nlp/util/Factory.java
package edu.berkeley.nlp.util;

public interface Factory<T> {
	T newInstance(Object... args);

	public static class DefaultFactory<T> implements Factory<T> {
		private final Class c;

		public DefaultFactory(Class c) {
			this.c = c;
		}

		public T newInstance(Object... args) {
			try {
				return (T) c.newInstance();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return null;
		}
	}

}
