|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.ArgSpec blog.Term blog.FuncAppTerm
public class FuncAppTerm
Represents a function invocation.
Term
Field Summary |
---|
Fields inherited from class blog.ArgSpec |
---|
location |
Constructor Summary | |
---|---|
FuncAppTerm(Function f)
Creates a new function application term with the given function and no arguments. |
|
FuncAppTerm(Function f,
java.util.List argList)
Creates a new function application term with the given function and argument list. |
|
FuncAppTerm(Function f,
Term arg)
Creates a new function application term with the given function and a single given argument. |
|
FuncAppTerm(Function f,
Term arg1,
Term arg2)
Creates a new function application term with the given function and two given arguments. |
|
FuncAppTerm(java.lang.String funcName,
java.util.List argList)
Creates a new function application term with the given function name and argument list. |
Method Summary | |
---|---|
boolean |
checkTypesAndScope(Model model,
java.util.Map scope)
Type checks this function application. |
int |
compile(java.util.LinkedHashSet callStack)
Ensures that all the functions used in this term are compiled. |
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 function application terms are equal if all their arguments are equal and their functions are equal. |
java.lang.Object |
evaluate(EvalContext context)
Returns the value of this argument specification in the given context. |
Term[] |
getArgs()
Returns the arguments in this function application term. |
Term |
getCanonicalVersion()
Returns a version of this term that uses canonical terms as much as possible. |
Function |
getFunction()
Returns the function in this function application term. |
java.util.Set |
getGenFuncsApplied(Term subject)
Returns the set of generating functions that are applied to the term subject by this term or any of its subterms. |
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 . |
Term |
getTimeArg()
If the top-level function in this term is indexed by time, returns the argument that serves as the time index. |
Type |
getType()
Returns the type of this term. |
BayesNetVar |
getVariable()
Returns the (basic or derived) random variable that this function application term corresponds to. |
int |
hashCode()
|
boolean |
makeOverlapSubst(Term t,
Substitution theta)
Function for computing a substitution that will make the two terms overlap. |
java.lang.String |
toString()
If this function application terms involves a non-zero number of arguments, returns a string of the form f(t1, ..., tK) where f is the string representation of the function and t1, ..., tK are string representations of the argument terms. |
Methods inherited from class blog.Term |
---|
containsTerm, getTermInScope, isConstantNull, isNumeric, makeOverlapSubst |
Methods inherited from class blog.ArgSpec |
---|
evaluate, evaluate, getFreeVars, getLocation, getSubstResult, getValueIfNonRandom, isDetermined, setLocation |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FuncAppTerm(Function f)
public FuncAppTerm(Function f, Term arg)
public FuncAppTerm(Function f, Term arg1, Term arg2)
public FuncAppTerm(Function f, java.util.List argList)
f
- a FunctionargList
- a List of Term objects representing argumentspublic FuncAppTerm(java.lang.String funcName, java.util.List argList)
funcName
- the name of a functionargList
- a List of Term objects representing arugmentsMethod Detail |
---|
public Function getFunction()
public Term[] getArgs()
public 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.lang.Object evaluate(EvalContext context)
ArgSpec
evaluate
in class ArgSpec
public BayesNetVar getVariable()
getVariable
in class ArgSpec
public java.util.Collection getSubExprs()
ArgSpec
This default implementation returns an empty collection.
getSubExprs
in class ArgSpec
public boolean containsRandomSymbol()
ArgSpec
containsRandomSymbol
in class ArgSpec
public java.util.Set getGenFuncsApplied(Term subject)
Term
subject
by this term or any of its subterms.
The default implementation returns the union of the generating functions applied in this term's sub-expressions. This is overridden by FuncAppTerm.
getGenFuncsApplied
in class Term
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
public boolean checkTypesAndScope(Model model, java.util.Map scope)
checkTypesAndScope
in class ArgSpec
scope
- a Map from variable names (Strings) to LogicalVar objectspublic Type getType()
Term
getType
in class Term
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 Term getTimeArg()
public boolean makeOverlapSubst(Term t, Substitution theta)
Term
theta
. If there is no extension of
theta
that makes this term and t
overlap,
this method returns false.
makeOverlapSubst
in class Term
public Term getCanonicalVersion()
Term
obj
of type type
is returned by
type.getCanonicalTerm(obj)
. A term can be
converted to canonical form only if it is non-random and has no
free variables (note that if the term is non-random, its value
must be a guaranteed object). This method returns a canonical
version of this term if possible; otherwise, it returns a
version where the subterms have been converted to canonical
form as much as possible.
getCanonicalVersion
in class Term
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |