CompNodeRep.java: Difference between revisions
From Santa Fe Institute Events Wiki
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[ | [[WikiPeerCode]] | ||
<pre> | <pre> | ||
/* | /* |
Latest revision as of 21:47, 16 June 2006
/* * 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; } }