Package jason.functions
Class Count
java.lang.Object
jason.asSemantics.DefaultArithFunction
jason.functions.Count
- All Implemented Interfaces:
ArithFunction
,Serializable
Function: .count(B)
: counts the number of occurrences of a particular belief
(pattern) in the agent's belief base, as the internal action .count.
Example:
-
.count(a(2,_))
: returns the number of beliefs that unify witha(2,_)
.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
returns true if the arguments of the function can be unground (as in .count)boolean
checkArity
(int a) returns true if a is a good number of arguments for the functiondouble
evaluate
(TransitionSystem ts, Term[] args) evaluates/computes the function based on the argsgetName()
returns the name of the functionMethods inherited from class jason.asSemantics.DefaultArithFunction
toString
-
Constructor Details
-
Count
public Count()
-
-
Method Details
-
getName
Description copied from interface:ArithFunction
returns the name of the function- Specified by:
getName
in interfaceArithFunction
- Overrides:
getName
in classDefaultArithFunction
-
evaluate
Description copied from interface:ArithFunction
evaluates/computes the function based on the args- Specified by:
evaluate
in interfaceArithFunction
- Overrides:
evaluate
in classDefaultArithFunction
- Throws:
Exception
-
checkArity
public boolean checkArity(int a) Description copied from interface:ArithFunction
returns true if a is a good number of arguments for the function- Specified by:
checkArity
in interfaceArithFunction
- Overrides:
checkArity
in classDefaultArithFunction
-
allowUngroundTerms
public boolean allowUngroundTerms()Description copied from interface:ArithFunction
returns true if the arguments of the function can be unground (as in .count)- Specified by:
allowUngroundTerms
in interfaceArithFunction
- Overrides:
allowUngroundTerms
in classDefaultArithFunction
-