Agent System POND 1.2 (28.2.2002)

PkgAgentSystem.Experiences
Class ValueComparator

java.lang.Object
  |
  +--PkgAgentSystem.Experiences.ValueComparator
All Implemented Interfaces:
Comparator

public class ValueComparator
extends Object
implements Comparator

Compares two agent identity objects according to a certain characteristic. Used for sorting.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag

Field Summary
protected  String characteristic
          The characteristic to compare
protected  Experiences exp
          The Experiences object
 
Constructor Summary
ValueComparator(Experiences exp, String characteristic)
          Creates a new comparator which compares a certain characteristic.
 
Method Summary
 int compare(Object o1, Object o2)
          Compares its two arguments for order.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

exp

protected Experiences exp
The Experiences object

characteristic

protected String characteristic
The characteristic to compare
Constructor Detail

ValueComparator

public ValueComparator(Experiences exp,
                       String characteristic)
Creates a new comparator which compares a certain characteristic.
Parameters:
exp - the experiences object in which to compare
characteristic - the characteristic to compare
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
Specified by:
compare in interface Comparator
Parameters:
o1 - the first object to compare
o2 - the second object to compare
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
Throws:
ClassCastException - if the arguments' types are not both of class AgentIdentity

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.