package accrue.analysis.interprocanalysis;

/**
 * Interface for an arbitrary partially ordered set
 * 
 * @param <T>
 *            Implementing class
 */
public interface Ordered<T> {
    /**
     * Is the given object less than or equal to this one
     * 
     * @param o
     *            object to compare to <code>this</code>
     * @return true if this is less than or equal to <code>o</code>
     */
    boolean leq(T o);

    /**
     * Compute the upper bound of <code>this</code> and <code>o</code>
     * 
     * @param o
     *            object to upper bound with this
     * @return the upper bound of <code>this</code> with <code>o</code>
     */
    T upperBound(T o);

    /**
     * Compute the widening operator on <code>this</code> and <code>o</code>. A
     * widening operator is an upper bound where all ascending chains eventually
     * stabilize.
     * 
     * @param o
     *            object to widen with <code>this</code>
     * @return Widened upper bound of <code>this</code> and <code>o</code>
     */
    T widen(T o);
}
