MASON-INTEREST-L Archives

January 2011

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Type:
text/plain; charset="us-ascii"
Date:
Fri, 7 Jan 2011 15:51:37 -0500
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Subject:
From:
"Makowsky, Michael D." <[log in to unmask]>
Content-Transfer-Encoding:
8bit
MIME-Version:
1.0
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Comments:
Parts/Attachments:
text/plain (10 lines)
I am unclear, due to my limited java abilities, how to sort a bag of steppable agents by an attribute. Specifically. I have a bag of agents that I would like to sort by a value stored as a double (public double diff). The documentation states that I need to provide a comparator: 

sort
public void sort(java.util.Comparator c)

but am uncertain how to provide the java.lang.Double.compare method such that it sorts the bag of objects by the "diff" attribute, if in fact that is what I need to do. 
Thank you for your assistance. 

Michael D. Makowsky

ATOM RSS1 RSS2