CompNodeRep.java
From Santa Fe Institute Events Wiki
[[WikiPeer Code]
/* * GameMaster.java * * Created on June 16 2006 * Last Modified June 16 2006 by Jack * * This class compares two agents based on their reputation */ package RepMod; import java.util.Comparator; public class CompNodeRep implements Comparator{ public CompNodeRep(){ } public int compare(Object o1, Object o2){ CustomNode nodei = (CustomNode) o1; CustomNode nodej = (CustomNode) o2; if (nodei.getReputation() < nodej.getReputation()) return -1; else if (nodei.getReputation() > nodej.getReputation()) return 1; else return 0; } }