blog
Class ExplicitSetSpec

java.lang.Object
  extended by blog.ArgSpec
      extended by blog.ExplicitSetSpec

public class ExplicitSetSpec
extends ArgSpec

Represents an argument - set with explicit listing of its elements. The elements are assumed to be Terms.


Field Summary
 
Fields inherited from class blog.ArgSpec
location
 
Constructor Summary
ExplicitSetSpec(java.util.List terms)
          Creates a new explicit set specification.
 
Method Summary
 boolean checkTypesAndScope(Model model, java.util.Map scope)
          Returns true if, within the given scope, all the variables used in this ArgSpec are in scope and all type constraints are satisfied.
 boolean containsRandomSymbol()
          Returns true if this ArgSpec contains any random function symbols or any type symbols (any type might have a number statement, and thus could be random).
 boolean equals(java.lang.Object o)
          Two explicit set specifications are equal if they have the same list of terms (in the same order).
 java.lang.Object evaluate(EvalContext context)
          Returns the value of this argument specification in the given context.
 java.util.List getElts()
           
 java.util.Collection getSubExprs()
          Returns the proper sub-expressions of this ArgSpec.
 ArgSpec getSubstResult(Substitution subst, java.util.Set<LogicalVar> boundVars)
          Returns the result of applying the substitution subst to this expression, excluding the logical variables in boundVars.
 int hashCode()
           
 java.lang.String toString()
          Returns a string of the form {t1, ..., tK} where t1, ..., tK are the terms in this explicit set specification.
 
Methods inherited from class blog.ArgSpec
compile, evaluate, evaluate, getFreeVars, getLocation, getSubstResult, getValueIfNonRandom, getVariable, isDetermined, isNumeric, setLocation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExplicitSetSpec

public ExplicitSetSpec(java.util.List terms)
Creates a new explicit set specification.

Parameters:
terms - List of Term objects
Method Detail

getElts

public java.util.List getElts()

evaluate

public java.lang.Object evaluate(EvalContext context)
Description copied from class: ArgSpec
Returns the value of this argument specification in the given context. Returns null if the partial world in this context is not complete enough to evaluate this ArgSpec, or if this ArgSpec contains a free variable that is not assigned a value in the given context.

Specified by:
evaluate in class ArgSpec

containsRandomSymbol

public boolean containsRandomSymbol()
Description copied from class: ArgSpec
Returns true if this ArgSpec contains any random function symbols or any type symbols (any type might have a number statement, and thus could be random).

Specified by:
containsRandomSymbol in class ArgSpec

checkTypesAndScope

public boolean checkTypesAndScope(Model model,
                                  java.util.Map scope)
Description copied from class: ArgSpec
Returns true if, within the given scope, all the variables used in this ArgSpec are in scope and all type constraints are satisfied. If there is a type or scope error, prints an appropriate message to standard error and returns false.

Specified by:
checkTypesAndScope in class ArgSpec
scope - a Map from variable names (Strings) to LogicalVar objects

getSubExprs

public java.util.Collection getSubExprs()
Description copied from class: ArgSpec
Returns the proper sub-expressions of this ArgSpec. This is an empty collection if this ArgSpec has no proper sub-expressions.

This default implementation returns an empty collection.

Overrides:
getSubExprs in class ArgSpec
Returns:
unmodifiable Collection of ArgSpec

getSubstResult

public ArgSpec getSubstResult(Substitution subst,
                              java.util.Set<LogicalVar> boundVars)
Description copied from class: ArgSpec
Returns the result of applying the substitution subst to this expression, excluding the logical variables in boundVars. This method is used for recursive calls. The set boundVars should contain those variables that are bound in the syntax tree between this sub-expression and the top-level expression to which the substitution is being applied.

Specified by:
getSubstResult in class ArgSpec

equals

public boolean equals(java.lang.Object o)
Two explicit set specifications are equal if they have the same list of terms (in the same order). Explicit set specifications with the same terms in different orders are equivalent, but we do not consider them equal, just as we do not consider the conjunctive formula (alpha & beta) equal to (beta & alpha).

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a string of the form {t1, ..., tK} where t1, ..., tK are the terms in this explicit set specification.

Overrides:
toString in class java.lang.Object