|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.Function blog.RandomFunction
public class RandomFunction
Represents random functions, whose value for the given tuple of arguments changes from world to world.
Function
Nested Class Summary |
---|
Nested classes/interfaces inherited from class blog.Function |
---|
Function.Sig |
Constructor Summary | |
---|---|
RandomFunction(java.lang.String fname,
java.util.List arg_types,
Type ret_type,
DependencyModel depmodel)
|
Method Summary | |
---|---|
boolean |
checkTypesAndScope(Model model)
Returns true if the dependency statement or interpretation statement for this function (if any) satisfies type and scope constraints. |
int |
compile(java.util.LinkedHashSet callStack)
Ensures that this function has a dependency statement, and compiles that dependency statement. |
LogicalVar[] |
getArgVars()
Returns the logical variables that stand for the function arguments in this function's dependency model. |
DependencyModel |
getDepModel()
|
LogicalVar |
getTimeVar()
If this function is indexed by time, returns the variable that stands for its time argument in its dependency model. |
java.lang.Object |
getValueInContext(java.lang.Object[] args,
EvalContext context,
boolean stable)
Returns the value of this function applied to the given tuple of arguments in the given context. |
boolean |
hasDepModel()
|
void |
printDepStatement(java.io.PrintStream s)
Prints the dependency statement for this function to the given stream. |
RandFuncAppVar |
rv()
Returns a basic random variable for this function with no arguments. |
RandFuncAppVar |
rv(java.lang.Object arg)
Returns a basic random variable for this function with the given single argument. |
RandFuncAppVar |
rv(java.lang.Object arg1,
java.lang.Object arg2)
Returns a basic random variable for this function with the given two arguments. |
RandFuncAppVar |
rvWithArgs(java.lang.Object[] args)
Returns a basic random variable for this function with the given array of arguments. |
void |
setArgVars(java.util.List vars)
Sets the variables that will stand for the function arguments in this function's dependency model. |
void |
setDepModel(DependencyModel depmodel)
|
Methods inherited from class blog.Function |
---|
appliesTo, domainIterator, domainIterator, getArgTypes, getCreationIndex, getDefaultValue, getName, getRetType, getSig, getValue, getValue, getValue, getValueSingleArg, isTimeIndexed, overlapsWith, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RandomFunction(java.lang.String fname, java.util.List arg_types, Type ret_type, DependencyModel depmodel)
Method Detail |
---|
public LogicalVar[] getArgVars()
public void setArgVars(java.util.List vars)
vars
- List of String objects representing the variablespublic LogicalVar getTimeVar()
java.lang.IllegalStateException
- if this function's argument variables
have not been set yet.public DependencyModel getDepModel()
public void setDepModel(DependencyModel depmodel)
public boolean hasDepModel()
public RandFuncAppVar rv()
public RandFuncAppVar rv(java.lang.Object arg)
public RandFuncAppVar rv(java.lang.Object arg1, java.lang.Object arg2)
public RandFuncAppVar rvWithArgs(java.lang.Object[] args)
public boolean checkTypesAndScope(Model model)
Function
This default implementation just returns true.
checkTypesAndScope
in class Function
public int compile(java.util.LinkedHashSet callStack)
compile
in class Function
callStack
- Set of objects whose compile methods are parents
of this method invocation. Ordered by invocation
order. Used to detect cycles.public void printDepStatement(java.io.PrintStream s)
public java.lang.Object getValueInContext(java.lang.Object[] args, EvalContext context, boolean stable)
Function
getValueInContext
in class Function
stable
- if true, the caller guarantees that the
args
array will not be modified
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |