Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jason.functions
Class RuleToFunction

    java.lang.Object
      jason.asSemantics.DefaultArithFunction
          jason.functions.RuleToFunction

All Implemented Interfaces:
  ArithFunction, java.io.Serializable

    public class RuleToFunction

extends DefaultArithFunction

Wraps a rule into a function. For example the rule sum(X,Y,Z) :- Z = X+Y. is wrapped in a function sum(X,Y).

To define sum as a function the user should register it using a directive in the ASL code: { register_function("myf.sum",2,"sum") } where myf.sum is the name of the function, sum is the name of the rule (or literal, or internal action) and 2 is the function's arity.

See Also:
  Serialized Form

Constructor Summary
`RuleToFunction(java.lang.String literal, int arity)`

Method Summary
`boolean` | `checkArity(int a)` returns true if a is a good number of arguments for the function
`double` | `evaluate(TransitionSystem ts, Term[] args)` evaluates/computes the function based on the args
`java.lang.String` | `getName()` returns the name of the function
`java.lang.String` | `toString()`

Methods inherited from class jason.asSemantics.DefaultArithFunction
`allowUngroundTerms`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### RuleToFunction

    public RuleToFunction(java.lang.String literal,
                          int arity)

Method Detail

### getName

    public java.lang.String getName()

  Description copied from interface: `ArithFunction`
  returns the name of the function

  Specified by:
    `getName` in interface `ArithFunction`
  Overrides:
    `getName` in class `DefaultArithFunction`

### 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 interface `ArithFunction`
  Overrides:
    `checkArity` in class `DefaultArithFunction`

### evaluate

    public double evaluate(TransitionSystem ts,
                           Term[] args)
                    throws java.lang.Exception

  Description copied from interface: `ArithFunction`
  evaluates/computes the function based on the args

  Specified by:
    `evaluate` in interface `ArithFunction`
  Overrides:
    `evaluate` in class `DefaultArithFunction`
  Throws:
    `java.lang.Exception`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `DefaultArithFunction`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD