package common.properties;

import java.util.Collection;

public abstract class Property<T extends Comparable<T>> {
	private final Class<T> type;
	private final String name;

	protected Property(String name, Class<T> type) {
		this.type = type;
		this.name = name;
	}

	public String getName() {
		return this.name;
	}

	public Class<T> getType() {
		return this.type;
	}

	public abstract Collection<T> getStates();
	public abstract String getName(T value);

	public boolean equals(Object obj) {
		if(this == obj)
			return true;
		if(obj != null && this.getClass() == obj.getClass()) {
			Property other = (Property)obj;
			return this.type.equals(other.type) && this.name.equals(other.name);
		}
		return false;
	}

	public int hashCode() {
		return 31 * this.type.hashCode() + this.name.hashCode();
	}
}
