clarion.system
Class ImplicitModuleCollection

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<E>
              extended by java.util.LinkedHashSet<AbstractImplicitModule>
                  extended by clarion.system.ImplicitModuleCollection
All Implemented Interfaces:
InterfaceHandlesFeedback, InterfaceTracksMatchStatistics, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<AbstractImplicitModule>, java.util.Collection<AbstractImplicitModule>, java.util.Set<AbstractImplicitModule>

public class ImplicitModuleCollection
extends java.util.LinkedHashSet<AbstractImplicitModule>
implements InterfaceTracksMatchStatistics, InterfaceHandlesFeedback

This class implements an implicit module collection within CLARION. It extends the LinkedHashSet class and implements the InterfaceTracksMatchStatistics and InterfaceHandlesFeedback interfaces.

Usage:

This class acts as a container for holding implicit modules within some of the CLARION subsystems.

This collection keeps track of collection-wide match statistics that are used to for variable level selection within the ACS as well as for performance monitoring and reporting purposes.

This class contains both global (static) and local constants. The default is to use the local constants. If you want to change any of the global constants, you need to do so before any instances of this class are initialized.

Version:
6.0.4
Author:
Nick Wilson
See Also:
Serialized Form

Field Summary
private  double Feedback
          The immediate feedback (if given).
static double GLOBAL_MATCH_DISCOUNT
          The match discount factor.
static double GLOBAL_POSITIVE_MATCH_THRESHOLD
          The threshold that must be passed to meet the positive match criterion.
static double MATCH_DISCOUNT
          The match discount factor.
protected  double NM
          The negative match counter.
protected  double PM
          The positive match counter.
 double POSITIVE_MATCH_THRESHOLD
          The threshold that must be passed to meet the positive match criterion.
private static long serialVersionUID
           
 
Constructor Summary
ImplicitModuleCollection()
          Initializes an implicit module collection.
ImplicitModuleCollection(java.util.Collection<? extends AbstractImplicitModule> ims)
          Initializes an implicit module collection with the collection of implicit modules specified.
 
Method Summary
 boolean add(AbstractImplicitModule im)
          Adds an implicit module to the collection.
 boolean addAll(java.util.Collection<? extends AbstractImplicitModule> ims)
          Adds a collection of implicit modules to this collection.
 boolean checkMatchCriterion()
          This method does nothing as it is not used by the CLARION Library for this collection.
 boolean contains(java.lang.Object im)
          Checks to see if the collection contains an implicit module that is equal to the specified implicit module.
 void discountMatchStatistics()
          Discounts the positive and negative match statistics for all modules in the collection.
 double getFeedback()
          Gets the feedback.
 double getNM()
          Gets the negative match statistic.
 double getPM()
          Gets the positive match statistic.
 void incrementNM()
          Increments the negative match statistic.
 void incrementPM()
          Increments the positive match statistic.
 void resetMatchStatistics()
          Resets the match statistics.
 void setFeedback(double feedback)
          Sets the feedback.
 void setNM(double nm)
          Sets the negative match statistic.
 void setPM(double pm)
          Sets the positive match statistic.
 int size()
          Returns the number of implicit modules in the collection.
 void updateMatchStatistics(AbstractMatchCalculator MatchCalculator)
          Updates the positive or negative match statistics based on the feedback.
 
Methods inherited from class java.util.HashSet
clear, clone, isEmpty, iterator, remove
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
clear, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

GLOBAL_MATCH_DISCOUNT

public static double GLOBAL_MATCH_DISCOUNT
The match discount factor.


MATCH_DISCOUNT

public static double MATCH_DISCOUNT
The match discount factor.


Feedback

private double Feedback
The immediate feedback (if given).


PM

protected double PM
The positive match counter.


NM

protected double NM
The negative match counter.


GLOBAL_POSITIVE_MATCH_THRESHOLD

public static double GLOBAL_POSITIVE_MATCH_THRESHOLD
The threshold that must be passed to meet the positive match criterion.


POSITIVE_MATCH_THRESHOLD

public double POSITIVE_MATCH_THRESHOLD
The threshold that must be passed to meet the positive match criterion.

Constructor Detail

ImplicitModuleCollection

public ImplicitModuleCollection()
Initializes an implicit module collection.


ImplicitModuleCollection

public ImplicitModuleCollection(java.util.Collection<? extends AbstractImplicitModule> ims)
Initializes an implicit module collection with the collection of implicit modules specified.

Parameters:
ims - The implicit modules for the collection.
Method Detail

add

public boolean add(AbstractImplicitModule im)
            throws java.lang.IllegalArgumentException
Adds an implicit module to the collection. If the specified implicit module is already in the collection, this method will throw an exception.

Specified by:
add in interface java.util.Collection<AbstractImplicitModule>
Specified by:
add in interface java.util.Set<AbstractImplicitModule>
Overrides:
add in class java.util.HashSet<AbstractImplicitModule>
Parameters:
im - The implicit module to add.
Returns:
True if the implicit module was added to the collection.
Throws:
java.lang.IllegalArgumentException - If the specified implicit module is already in the collection.

addAll

public boolean addAll(java.util.Collection<? extends AbstractImplicitModule> ims)
Adds a collection of implicit modules to this collection.

Specified by:
addAll in interface java.util.Collection<AbstractImplicitModule>
Specified by:
addAll in interface java.util.Set<AbstractImplicitModule>
Overrides:
addAll in class java.util.AbstractCollection<AbstractImplicitModule>
Parameters:
ims - The implicit modules to add.
Returns:
True if the implicit modules were successfully added to the collection.

discountMatchStatistics

public void discountMatchStatistics()
Discounts the positive and negative match statistics for all modules in the collection.


getPM

public double getPM()
Gets the positive match statistic.

Specified by:
getPM in interface InterfaceTracksMatchStatistics
Returns:
The positive match statistic.

getNM

public double getNM()
Gets the negative match statistic.

Specified by:
getNM in interface InterfaceTracksMatchStatistics
Returns:
The negative match statistic.

setPM

public void setPM(double pm)
Sets the positive match statistic. This method can be used to update the positive match statistic if the user wishes to provide their own match criterion function.

Specified by:
setPM in interface InterfaceTracksMatchStatistics
Parameters:
pm - The value to set as the positive match statistic.

setNM

public void setNM(double nm)
Sets the negative match statistic. This method can be used to update the negative match statistic if the user wishes to provide their own match criterion function.

Specified by:
setNM in interface InterfaceTracksMatchStatistics
Parameters:
nm - The value to set as the negative match statistic.

getFeedback

public double getFeedback()
Gets the feedback. This method is only used if feedback is being provided.

Specified by:
getFeedback in interface InterfaceHandlesFeedback
Returns:
The feedback.

setFeedback

public void setFeedback(double feedback)
Sets the feedback. This method should be called before the updateMatchStatistics method is called. This method is only used if feedback is being provided.

Specified by:
setFeedback in interface InterfaceHandlesFeedback
Parameters:
feedback - The value of the feedback.

updateMatchStatistics

public void updateMatchStatistics(AbstractMatchCalculator MatchCalculator)
Updates the positive or negative match statistics based on the feedback.

This update is usually performed after the feedback has been set.

Specified by:
updateMatchStatistics in interface InterfaceTracksMatchStatistics
Parameters:
MatchCalculator - The match calculator to use to determine positivity.

resetMatchStatistics

public void resetMatchStatistics()
Resets the match statistics.

Specified by:
resetMatchStatistics in interface InterfaceTracksMatchStatistics

incrementPM

public void incrementPM()
Increments the positive match statistic. This method can be used to update the positive match statistic if the user wishes to provide their own match criterion function.

Specified by:
incrementPM in interface InterfaceTracksMatchStatistics

incrementNM

public void incrementNM()
Increments the negative match statistic. This method can be used to update the negative match statistic if the user wishes to provide their own match criterion function.

Specified by:
incrementNM in interface InterfaceTracksMatchStatistics

checkMatchCriterion

public boolean checkMatchCriterion()
This method does nothing as it is not used by the CLARION Library for this collection.

Specified by:
checkMatchCriterion in interface InterfaceHandlesFeedback
Returns:
False

contains

public boolean contains(java.lang.Object im)
Checks to see if the collection contains an implicit module that is equal to the specified implicit module.

Specified by:
contains in interface java.util.Collection<AbstractImplicitModule>
Specified by:
contains in interface java.util.Set<AbstractImplicitModule>
Overrides:
contains in class java.util.HashSet<AbstractImplicitModule>
Parameters:
im - The implicit module object you wish to find within this collection.
Returns:
True if the collection contains an implicit module equal to the implicit module specified, otherwise false.

size

public int size()
Returns the number of implicit modules in the collection.

Specified by:
size in interface java.util.Collection<AbstractImplicitModule>
Specified by:
size in interface java.util.Set<AbstractImplicitModule>
Overrides:
size in class java.util.HashSet<AbstractImplicitModule>