org.cfpm.caves.za
Class CommonAttributeCounter

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

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

This class implements a user function in Jess. The function "number-of-common-attributes" expects two lists of attributes and counts how many attributes are contained in both lists. It is used to compare the tags of two agents to find out how similar they are.

Author:
Scott

Constructor Summary
CommonAttributeCounter()
           
 
Method Summary
 jess.Value call(jess.ValueVector vv, jess.Context c)
          calls the function with the given parameter and context from Jess.
 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

CommonAttributeCounter

public CommonAttributeCounter()
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 c)
                throws jess.JessException
calls the function with the given parameter and context from Jess.

Specified by:
call in interface jess.Userfunction
Parameters:
vv - the list of parameters
c - the Jess context
Returns:
the number of common attributes
Throws:
jess.JessException