Actions

CompNodeRep.java: Difference between revisions

From Santa Fe Institute Events Wiki

No edit summary
 
No edit summary
Line 1: Line 1:
[[WikiPeer Code]
[[WikiPeer Code]]
<pre>
<pre>
/*
/*

Revision as of 21:46, 16 June 2006

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

}