package accrue.analysis.pointer;

import polyglot.types.Type;

/**
 * An abstract heap object. An abstract heap object represents zero or
 * more concrete objects. This interface corresponds to the domain HContext
 * in the paper "Pick Your Contexts Well: Understanding Object-Sensitivity"
 * by Smaragdakis, Bravenboer, and Lhotak, POPL 2011.
 */
public interface HContext {
    /**
     * Returns the precise type of this abstract object. That is,
     * all concrete objects represented by this abstract object must
     * have the type returned by this method. Can be null if precise 
     * type is unknown.
     */
    public Type preciseType();

    /**
     * Returns the most specific known type of this abstract object. This serves
     * as an upper bound for the precise type of all concrete objects
     * represented by this abstract object. If a precise type is known, this
     * returns the same type as preciseType().
     */
    public Type type();

    /**
     * Returns true if there is a precise type for this abstract object.
     */
    public boolean hasPreciseType();

    /**
     * Semantic equality between two HContexts. 
     */
    public boolean equalsSemantic(HContext o);

    /**
     * Returns the allocation site of this abstract object.
     */
    public AllocSiteNode allocSite();
}
