|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.Function
public abstract class Function
Represents a BLOG function. A function is specified by its name, return type, and argument types.
Nested Class Summary | |
---|---|
static class |
Function.Sig
Nested class representing a function signature, that is, a function name and a tuple of argument types. |
Constructor Summary | |
---|---|
Function(java.lang.String fname,
java.util.List argTypeList,
Type retType)
|
Method Summary | |
---|---|
boolean |
appliesTo(Type[] types)
Returns true if this function applies to all tuples of objects with the given types. |
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 is ready to be used by an inference engine. |
java.util.Iterator |
domainIterator()
Returns an iterator over the tuples of objects that can serve as arguments to this function. |
java.util.Iterator |
domainIterator(boolean skipLastArg)
Returns an iterator over the tuples of objects that can serve as arguments to this function. |
Type[] |
getArgTypes()
|
int |
getCreationIndex()
Returns an index indicating when this function was declared (or otherwise created). |
java.lang.Object |
getDefaultValue()
Returns the value of this function on arguments that are not in its domain. |
java.lang.String |
getName()
|
Type |
getRetType()
|
Function.Sig |
getSig()
|
java.lang.Object |
getValue(java.lang.Object[] args,
PartialWorld w)
Returns the value of this function applied to the given tuple of arguments in the given partial world. |
java.lang.Object |
getValue(java.lang.Object arg1,
java.lang.Object arg2,
PartialWorld w)
Returns the value of this function applied to the given pair of arguments in the given partial world (this method should be used only for binary functions). |
java.lang.Object |
getValue(PartialWorld w)
Returns the value of this function applied to an empty tuple of arguments in the given partial world (this method should be used only for zero-ary functions). |
abstract 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. |
java.lang.Object |
getValueSingleArg(java.lang.Object arg,
PartialWorld w)
Returns the value of this function applied to the given single argument in the given partial world (this method should be used only for unary functions). |
boolean |
isTimeIndexed()
Returns true if this function is indexed by time, that is, it has a final argument of type Timestep. |
boolean |
overlapsWith(Type[] types)
Returns true if this function could apply to some tuple of non-null objects with the given types. |
java.lang.String |
toString()
Returns this function's name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Function(java.lang.String fname, java.util.List argTypeList, Type retType)
Method Detail |
---|
public java.lang.String getName()
public Type[] getArgTypes()
public Type getRetType()
public Function.Sig getSig()
public boolean appliesTo(Type[] types)
public boolean overlapsWith(Type[] types)
public boolean checkTypesAndScope(Model model)
This default implementation just returns true.
public 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 java.lang.Object getValue(java.lang.Object[] args, PartialWorld w)
public java.lang.Object getValue(PartialWorld w)
public java.lang.Object getValueSingleArg(java.lang.Object arg, PartialWorld w)
public java.lang.Object getValue(java.lang.Object arg1, java.lang.Object arg2, PartialWorld w)
public abstract java.lang.Object getValueInContext(java.lang.Object[] args, EvalContext context, boolean stable)
stable
- if true, the caller guarantees that the
args
array will not be modifiedpublic java.lang.Object getDefaultValue()
public boolean isTimeIndexed()
public java.util.Iterator domainIterator()
public java.util.Iterator domainIterator(boolean skipLastArg)
skipLastArg
- if true, exclude the last argument from the
tuples (useful for time-indexed functions)
public int getCreationIndex()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |