|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.ArgSpec
public abstract class ArgSpec
Represents an abstract argument specification. In general, an argument can be:
Field Summary | |
---|---|
protected java.lang.Object |
location
|
Constructor Summary | |
---|---|
ArgSpec()
|
Method Summary | |
---|---|
abstract 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)
Does compilation steps that can only be done correctly once the model is complete. |
abstract 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). |
abstract java.lang.Object |
evaluate(EvalContext context)
Returns the value of this argument specification in the given context. |
static java.util.List |
evaluate(EvalContext context,
java.util.List argSpecs)
Returns a List consisting of the objects obtained by evaluating each element of argSpecs in the given context. |
java.lang.Object |
evaluate(PartialWorld w)
Returns the value of this argument specification in the context. |
java.util.Set |
getFreeVars()
Returns the logical variables that occur free in this expression. |
java.lang.Object |
getLocation()
Returns the object specified by the last call to setLocation. |
java.util.Collection |
getSubExprs()
Returns the proper sub-expressions of this ArgSpec. |
ArgSpec |
getSubstResult(Substitution subst)
Returns the result of applying the given substitution to this expression. |
abstract 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 . |
java.lang.Object |
getValueIfNonRandom()
Returns the value of this ArgSpec if it is non-random. |
BayesNetVar |
getVariable()
Returns the (basic or derived) random variable that this argument specification corresponds to. |
boolean |
isDetermined(PartialWorld w)
Returns true if the given partial world is complete enough to determine the value of this ArgSpec. |
boolean |
isNumeric()
Returns true if the value of this ArgSpec is always an instance of Number (regardless of scope). |
void |
setLocation(java.lang.Object loc)
Sets the location of this ArgSpec, for instance, the file name and line number where it appears. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object location
Constructor Detail |
---|
public ArgSpec()
Method Detail |
---|
public static java.util.List evaluate(EvalContext context, java.util.List argSpecs)
argSpecs
in the given context.
public java.lang.Object evaluate(PartialWorld w)
public abstract java.lang.Object evaluate(EvalContext context)
public abstract boolean containsRandomSymbol()
public boolean isDetermined(PartialWorld w)
public java.lang.Object getValueIfNonRandom()
public BayesNetVar getVariable()
public abstract boolean checkTypesAndScope(Model model, java.util.Map scope)
scope
- a Map from variable names (Strings) to LogicalVar objectspublic int compile(java.util.LinkedHashSet callStack)
This default implementation just returns 0.
callStack
- Set of objects whose compile methods are parents
of this method invocation. Ordered by invocation
order. Used to detect cycles.public boolean isNumeric()
public void setLocation(java.lang.Object loc)
public java.lang.Object getLocation()
public java.util.Collection getSubExprs()
This default implementation returns an empty collection.
public java.util.Set getFreeVars()
checkTypesAndScope
, which
converts SymbolTerms to LogicalVars.
The default implementation returns the union of the sets of free variables in this expression's sub-expressions.
java.lang.IllegalStateException
- if this expression contains a
SymbolTermpublic ArgSpec getSubstResult(Substitution subst)
x
is replaced with
subst.getReplacement(x)
(which is just x
itself if subst
does not explicitly specify a
replacement).
public abstract ArgSpec getSubstResult(Substitution subst, java.util.Set<LogicalVar> boundVars)
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |