org.cfpm.caves.za
Class RandomListElement

java.lang.Object
  extended by org.cfpm.caves.za.RandomListElement
All Implemented Interfaces:
jess.Userfunction

public class RandomListElement
extends java.lang.Object
implements jess.Userfunction

This class implements a user function in Jess. The function "random-element-of" expects a list as parameter and returns a randomly picked element of this list.

Author:
Ruth

Constructor Summary
RandomListElement()
           
 
Method Summary
 jess.Value call(jess.ValueVector vv, jess.Context context)
          The argument of the call is the list of which a random element is to be picked.
 java.lang.String getName()
          returns the name of the function in Jess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomListElement

public RandomListElement()
Method Detail

getName

public java.lang.String getName()
returns the name of the function in Jess

Specified by:
getName in interface jess.Userfunction

call

public jess.Value call(jess.ValueVector vv,
                       jess.Context context)
                throws jess.JessException
The argument of the call is the list of which a random element is to be picked.

Specified by:
call in interface jess.Userfunction
Parameters:
vv - -- the ValueVector containing the header and parameters
context - -- the context of the Rete engine
Returns:
random element of the list
Throws:
jess.JessException
See Also:
Userfunction.call(jess.ValueVector, jess.Context)