package accrue.analysis.interprocanalysis;

/**
 * Singleton representation of a single element lattice. Is useful for interprocedural 
 * analyses that simply need to visit each analysis unit once (e.g., to gather
 * constraints for each analysis unit).
 */
public class Unit implements Ordered<Unit> {

    /**
     * Get the singleton instance
     */
    public static final Unit UNIT = new Unit();

    /**
     * The only instance should be accessed statically
     */
    private Unit() {
    }

    @Override
    public boolean leq(Unit o) {
        return this.equals(o);
    }

    @Override
    public Unit upperBound(Unit o) {
        return this;
    }

    @Override
    public String toString() {
        return "Unit";
    }

    @Override
    public int hashCode() {
        return 37;
    }

    @Override
    public boolean equals(Object obj) {
        return this == obj;

    }

    @Override
    public Unit widen(Unit o) {
        return upperBound(o);
    }
}
