jess
Interface Strategy


public interface Strategy

An interface for conflict resolution strategies. Implement this interface, then pass the class name to (set-strategy).

(C) 1997 Ernest J. Friedman-Hill and Sandia National Laboratories

Author:
Ernest J. Friedman-Hill

Method Summary
 void addActivation(Activation a, java.util.Vector v)
          To implement your own conflict resolution strategy, you write this method.
 int findActivation(Token t, Defrule d, java.util.Vector v)
          To implement your own conflict resolution strategy, you write this method.
 java.lang.String getName()
          Return the name of this strategy
 

Method Detail

addActivation

public void addActivation(Activation a,
                          java.util.Vector v)
                   throws JessException
To implement your own conflict resolution strategy, you write this method. It should insert the Activation argument in the proper order within the given vector of activations. Salience should be respected.
Parameters:
a - A new rule activation. Place this in the proper order in v. It is your job to respect rule salience!
v - The vector of all activations, which will fire in increasing order
Throws:
JessException - if something goes wrong
See Also:
RU.bsearchVector(int, java.util.Vector, int, int, jess.RU.Fetch, jess.RU.Compare)

findActivation

public int findActivation(Token t,
                          Defrule d,
                          java.util.Vector v)
                   throws JessException
To implement your own conflict resolution strategy, you write this method. It should find any activation due to this token within the given vector of activations and return the index. If none, should return -1.
Parameters:
t - A Token
d - A rule
v - A vector of Activations
Throws:
JessException - if something goes wrong
See Also:
RU.bsearchVector(int, java.util.Vector, int, int, jess.RU.Fetch, jess.RU.Compare)

getName

public java.lang.String getName()
Return the name of this strategy
Returns:
a display name for this strategy

© 1997 E.J. Friedman-Hill and Sandia Corporation