Actions

CompNodeRep.java

From Santa Fe Institute Events Wiki

Revision as of 21:47, 16 June 2006 by Seoc (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WikiPeerCode

/*
 * 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;
    }

}