MACS
Class PerceptionList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.ArrayList
                    |
                    +--MACS.PerceptionList
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable

class PerceptionList
extends java.util.ArrayList

This class represents a list of Perceptions.

Author:
Olivier Sigaud and Pierre Gérard.

Field Summary
 
Fields inherited from class java.util.ArrayList
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
protected PerceptionList()
           
protected PerceptionList(MACS.PerceptionList source)
           
protected PerceptionList(java.util.Set p)
          Creates a PerceptionList from a PerceptionSet
protected PerceptionList(java.lang.String form, java.lang.String value)
           
 
Method Summary
protected  MACS.PerceptionList buildMoreGeneralPerceptionList()
          From one list of condition parts, this method produces a list of more general condition parts, each member in the list generalizing over one specific attribute of one of the initial condition part.
protected static MACS.PerceptionList buildMoreGeneralPerceptionList(Classifier.Perception condition)
          From one condition part, this method produces a list of more general condition parts, each member in the list generalizing over one specific attribute of the initial condition part.
protected  boolean containsMatching(Classifier.Perception perc)
           
protected  boolean coversAtLeastOnePerceptionCoveredBy(MACS.AnticipatoryClassifierList incompatibleClassifierList, Classifier.AnticipatoryClassifier classifier)
          This method checks whether a classifier covers at least one Perception covered by the incompatibleClassifierList.
protected  boolean differsFrom(MACS.PerceptionList ps)
          Necessary because contains does not seem to work for something else than addresses protected final boolean contains(Perception perc) { Iterator it = iterator(); while (it.hasNext()) { if (((Perception)it.next()).equals(perc))return true; } return false; }
private  int getIndexOfPerception(java.lang.String strPerc)
           
protected  int getNbPerceptions()
           
protected  Classifier.Perception getPerception(int index)
           
protected  Classifier.Perception getRandomPerception()
           
protected  boolean matchOneIdenticalPerception(Classifier.BasicClassifier c1, Classifier.BasicClassifier c2)
           
protected  void mergeWith(MACS.PerceptionList perceptionList)
          This method merges two lists, making sure that identical elements are discarded.
 MACS.PerceptionList sort(java.lang.String orderSort)
          This method is used by the TraceManager to organize the display.
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String orderSort)
           
 java.lang.String toString(java.lang.String orderSort, java.lang.String coords)
           
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

Constructor Detail

PerceptionList

protected PerceptionList(java.util.Set p)
Creates a PerceptionList from a PerceptionSet

Parameters:
p - the original PerceptionSet

PerceptionList

protected PerceptionList(java.lang.String form,
                         java.lang.String value)
Parameters:
form -
value -

PerceptionList

protected PerceptionList(MACS.PerceptionList source)
Parameters:
source -

PerceptionList

protected PerceptionList()
Method Detail

differsFrom

protected final boolean differsFrom(MACS.PerceptionList ps)
Necessary because contains does not seem to work for something else than addresses protected final boolean contains(Perception perc) { Iterator it = iterator(); while (it.hasNext()) { if (((Perception)it.next()).equals(perc))return true; } return false; }

Parameters:
ps -
Returns:
boolean

getRandomPerception

protected final Classifier.Perception getRandomPerception()
Returns:
Classifier.Perception

getNbPerceptions

protected final int getNbPerceptions()
Returns:
int

getPerception

protected final Classifier.Perception getPerception(int index)
Parameters:
index -
Returns:
Classifier.Perception

containsMatching

protected final boolean containsMatching(Classifier.Perception perc)
Parameters:
perc -
Returns:
boolean

matchOneIdenticalPerception

protected final boolean matchOneIdenticalPerception(Classifier.BasicClassifier c1,
                                                    Classifier.BasicClassifier c2)
Parameters:
c1 -
c2 -
Returns:
boolean

mergeWith

protected final void mergeWith(MACS.PerceptionList perceptionList)
This method merges two lists, making sure that identical elements are discarded.

Parameters:
perceptionList - the list to be merged with the original

buildMoreGeneralPerceptionList

protected static final MACS.PerceptionList buildMoreGeneralPerceptionList(Classifier.Perception condition)
From one condition part, this method produces a list of more general condition parts, each member in the list generalizing over one specific attribute of the initial condition part. Used by the ConditionCoveringManager and the method below.

Parameters:
condition - a tentative condition part that should be generalized further
Returns:
PerceptionList the list of more general condition parts

buildMoreGeneralPerceptionList

protected final MACS.PerceptionList buildMoreGeneralPerceptionList()
From one list of condition parts, this method produces a list of more general condition parts, each member in the list generalizing over one specific attribute of one of the initial condition part. Identical members are discarded. Used by the ConditionCoveringManager.

Returns:
PerceptionList

coversAtLeastOnePerceptionCoveredBy

protected boolean coversAtLeastOnePerceptionCoveredBy(MACS.AnticipatoryClassifierList incompatibleClassifierList,
                                                      Classifier.AnticipatoryClassifier classifier)
This method checks whether a classifier covers at least one Perception covered by the incompatibleClassifierList. Used by the GeneralizationManager.

Parameters:
incompatibleClassifierList -
classifier -
Returns:
boolean
See Also:
GeneralizationManager

getIndexOfPerception

private final int getIndexOfPerception(java.lang.String strPerc)
Parameters:
strPerc -
Returns:
int

sort

public final MACS.PerceptionList sort(java.lang.String orderSort)
This method is used by the TraceManager to organize the display.

Parameters:
orderSort -
Returns:
PerceptionList

toString

public final java.lang.String toString(java.lang.String orderSort,
                                       java.lang.String coords)
Parameters:
orderSort -
coords -
Returns:
String

toString

public final java.lang.String toString(java.lang.String orderSort)
Parameters:
orderSort -
Returns:
String

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection
Returns:
String