|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.ArgSpec blog.ImplicitSetSpec
public class ImplicitSetSpec
Represents an argument - set with implicit specification of its elements.
An ImplicitSetSpec consists of a type type
, a variable
set_elt
, and a formula cond
. It evaluates to
the set of objects o of type type
such that
cond
is satisfied when set_elt
is bound to
o.
Field Summary |
---|
Fields inherited from class blog.ArgSpec |
---|
location |
Constructor Summary | |
---|---|
ImplicitSetSpec(LogicalVar var,
Formula cond)
|
|
ImplicitSetSpec(java.lang.String set_elt,
Type type,
Formula cond)
|
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. |
int |
compile(java.util.LinkedHashSet callStack)
Initializes a compiled version of this set specification. |
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 implicit set specifications are equal if they have the same type, generic element variable, and condition. |
java.lang.Object |
evaluate(EvalContext context)
Returns the value of this argument specification in the given context. |
Formula |
getCond()
|
java.util.Set |
getFreeVars()
Returns the logical variables that occur free in this expression. |
LogicalVar |
getGenericSetElt()
|
protected CompiledSetSpec |
getSatisfierSpec()
Returns a compiled version of the set represented by this ImplicitSetSpec. |
java.util.Set |
getSatisfyingSet(PartialWorld w)
Returns the set of objects o of type type
such that when var is bound to o, the formula
cond is satisfied in w . |
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 . |
Type |
getType()
|
int |
hashCode()
|
java.lang.String |
toString()
Returns a string of the form {Type var : cond} where Type is this implicit set specification's type, var is the generic set element variable, and cond is the membership condition. |
Methods inherited from class blog.ArgSpec |
---|
evaluate, evaluate, getLocation, getSubstResult, getValueIfNonRandom, getVariable, isDetermined, isNumeric, setLocation |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ImplicitSetSpec(java.lang.String set_elt, Type type, Formula cond)
set_elt
- name of variable representing an element of the settype
- type of objects in the set. May be null, but then the
main program should exit before the compilation phase.cond
- formula that objects in the set must satisfypublic ImplicitSetSpec(LogicalVar var, Formula cond)
Method Detail |
---|
public LogicalVar getGenericSetElt()
public Type getType()
public Formula getCond()
public java.util.Set getSatisfyingSet(PartialWorld w)
type
such that when var
is bound to o, the formula
cond
is satisfied in w
. This method
yields a fatal error if w
is not complete enough to
define this set.
public java.lang.Object evaluate(EvalContext context)
ArgSpec
evaluate
in class ArgSpec
public boolean containsRandomSymbol()
ArgSpec
containsRandomSymbol
in class ArgSpec
public boolean checkTypesAndScope(Model model, java.util.Map scope)
ArgSpec
checkTypesAndScope
in class ArgSpec
scope
- a Map from variable names (Strings) to LogicalVar objectspublic int compile(java.util.LinkedHashSet callStack)
compile
in class ArgSpec
callStack
- Set of objects whose compile methods are parents
of this method invocation. Ordered by invocation
order. Used to detect cycles.public java.util.Collection getSubExprs()
ArgSpec
This default implementation returns an empty collection.
getSubExprs
in class ArgSpec
public java.util.Set getFreeVars()
ArgSpec
checkTypesAndScope
, which
converts SymbolTerms to LogicalVars.
The default implementation returns the union of the sets of free variables in this expression's sub-expressions.
getFreeVars
in class ArgSpec
public ArgSpec getSubstResult(Substitution subst, java.util.Set<LogicalVar> boundVars)
ArgSpec
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.
getSubstResult
in class ArgSpec
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
protected CompiledSetSpec getSatisfierSpec()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |