MASON-INTEREST-L Archives

January 2011

MASON-INTEREST-L@LISTSERV.GMU.EDU

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

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

Print Reply
Subject:
From:
"Makowsky, Michael D." <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 7 Jan 2011 15:51:37 -0500
Content-Type:
text/plain
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