virtualcommons-svn Mailing List for Virtual Commons Experiment Software (Page 14)
Status: Beta
Brought to you by:
alllee
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(21) |
Aug
(31) |
Sep
(6) |
Oct
(15) |
Nov
(2) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(4) |
Feb
(6) |
Mar
(12) |
Apr
(52) |
May
(14) |
Jun
(19) |
Jul
(81) |
Aug
(115) |
Sep
(36) |
Oct
(88) |
Nov
(46) |
Dec
(58) |
2010 |
Jan
(52) |
Feb
(55) |
Mar
(48) |
Apr
(15) |
May
(5) |
Jun
(38) |
Jul
(27) |
Aug
(24) |
Sep
(28) |
Oct
(1) |
Nov
(2) |
Dec
(29) |
2011 |
Jan
(87) |
Feb
(39) |
Mar
(63) |
Apr
(42) |
May
(26) |
Jun
(53) |
Jul
(23) |
Aug
(43) |
Sep
(37) |
Oct
(25) |
Nov
(4) |
Dec
(7) |
2012 |
Jan
(73) |
Feb
(79) |
Mar
(62) |
Apr
(28) |
May
(12) |
Jun
(2) |
Jul
(9) |
Aug
(1) |
Sep
(8) |
Oct
|
Nov
(3) |
Dec
(3) |
2013 |
Jan
(8) |
Feb
(16) |
Mar
(38) |
Apr
(74) |
May
(62) |
Jun
(15) |
Jul
(49) |
Aug
(19) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(25) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Bitbucket <com...@bi...> - 2012-09-18 09:03:26
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/9f9c227c1643/ changeset: 9f9c227c1643 user: alllee date: 2012-09-18 11:03:15 summary: sorted map for consistent iteration order affected #: 1 file diff -r 08b36dd5edc56db7779868a09878ee39c5df9703 -r 9f9c227c1643cf342d088aa3d461520afc88657a src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java @@ -2,9 +2,10 @@ import java.awt.Point; import java.io.PrintWriter; -import java.util.HashMap; +import java.util.Comparator; import java.util.Map; import java.util.SortedSet; +import java.util.TreeMap; import edu.asu.commons.event.PersistableEvent; import edu.asu.commons.experiment.SaveFileProcessor.Base; @@ -136,7 +137,11 @@ SortedSet<PersistableEvent> actions = savedRoundData.getActions(); ServerDataModel dataModel = (ServerDataModel) savedRoundData.getDataModel(); Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); - Map<ClientData, RuleData> dataMap = new HashMap<ClientData, RuleData>(); + Map<ClientData, RuleData> dataMap = new TreeMap<ClientData, RuleData>(new Comparator<ClientData>() { + public int compare(ClientData a, ClientData b) { + return Integer.valueOf(a.getAssignedNumber()).compareTo(b.getAssignedNumber()); + } + }); for (ClientData data: clientDataMap.values()) { dataMap.put(data, new RuleData()); } Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-09-18 09:02:56
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/58bbaff1dcf5/ changeset: 58bbaff1dcf5 branch: asu-foraging-2012 user: alllee date: 2012-09-18 11:02:48 summary: using sorted map so emitted data is in a consistent / predictable order affected #: 33 files diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/data/AggregateCollectedTokenNeighborProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AggregateCollectedTokenNeighborProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AggregateCollectedTokenNeighborProcessor.java @@ -23,7 +23,7 @@ import edu.asu.commons.util.Utils; /** - * $Id: AggregateCollectedTokenNeighborProcessor.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Generates aggregate distributions of the number of neighboring tokens for a collected token in two situations: * 1. without regard to visibility diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/data/ClientMovementStatistics.java --- a/src/main/java/edu/asu/commons/foraging/data/ClientMovementStatistics.java +++ b/src/main/java/edu/asu/commons/foraging/data/ClientMovementStatistics.java @@ -5,7 +5,7 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ClientMovementStatistics.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Helper class to keep track of client movements. * diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/data/ClientMovementTokenCount.java --- a/src/main/java/edu/asu/commons/foraging/data/ClientMovementTokenCount.java +++ b/src/main/java/edu/asu/commons/foraging/data/ClientMovementTokenCount.java @@ -7,7 +7,7 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ClientMovementTokenCount.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Helper class for maintaining basic movement / token information. * diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java @@ -2,9 +2,10 @@ import java.awt.Point; import java.io.PrintWriter; -import java.util.HashMap; +import java.util.Comparator; import java.util.Map; import java.util.SortedSet; +import java.util.TreeMap; import edu.asu.commons.event.PersistableEvent; import edu.asu.commons.experiment.SaveFileProcessor.Base; @@ -136,7 +137,11 @@ SortedSet<PersistableEvent> actions = savedRoundData.getActions(); ServerDataModel dataModel = (ServerDataModel) savedRoundData.getDataModel(); Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); - Map<ClientData, RuleData> dataMap = new HashMap<ClientData, RuleData>(); + Map<ClientData, RuleData> dataMap = new TreeMap<ClientData, RuleData>(new Comparator<ClientData>() { + public int compare(ClientData a, ClientData b) { + return Integer.valueOf(a.getAssignedNumber()).compareTo(b.getAssignedNumber()); + } + }); for (ClientData data: clientDataMap.values()) { dataMap.put(data, new RuleData()); } diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/data/MovementStatisticsProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/MovementStatisticsProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/MovementStatisticsProcessor.java @@ -19,7 +19,7 @@ import edu.asu.commons.util.Utils; /** - * $Id: MovementStatisticsProcessor.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * * @author <a href='mailto:all...@as...'>Allen Lee</a> diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/BeginChatRoundRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/BeginChatRoundRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/BeginChatRoundRequest.java @@ -6,13 +6,13 @@ /** - * $Id: BeginChatRoundRequest.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * The facilitator uses this Request to signal the server that the timed * communication can now begin. * * @author Allen Lee - * @version $Revision: 4 $ + * @version $Revision$ */ public class BeginChatRoundRequest extends AbstractEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java @@ -10,13 +10,13 @@ /** - * $Id: ClientMovementRequest.java 350 2009-10-30 22:18:42Z alllee $ + * $Id$ * * Client signal informing the server that the client has moved in Direction d * and has ended up at Point p. * * @author <a href='mailto:al...@cs...'>Allen Lee</a> - * @version $Revision: 350 $ + * @version $Revision$ */ public class ClientMovementRequest extends AbstractEvent implements ClientRequest { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/ClientPoseUpdate.java --- a/src/main/java/edu/asu/commons/foraging/event/ClientPoseUpdate.java +++ b/src/main/java/edu/asu/commons/foraging/event/ClientPoseUpdate.java @@ -5,10 +5,10 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ClientPoseUpdate.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * @author <a href='All...@as...'>Allen Lee</a>, Deepali Bhagvat - * @version $Revision: 4 $ + * @version $Revision$ */ public class ClientPoseUpdate extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/CollectTokenRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/CollectTokenRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/CollectTokenRequest.java @@ -4,12 +4,12 @@ import edu.asu.commons.net.Identifier; /** - * $Id: CollectTokenRequest.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * Signals that the client wants to collect a token at its present location. * * @author <a href='All...@as...'>Allen Lee</a> - * @version $Revision: 4 $ + * @version $Revision$ */ public class CollectTokenRequest extends AbstractEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/EndRoundEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/EndRoundEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/EndRoundEvent.java @@ -11,7 +11,7 @@ /** - * $Id: EndRoundEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * This event carries all data relevant to the ending of a round, including the * debriefing message, the time (in milliseconds) that the client should wait @@ -21,7 +21,7 @@ * * @author Deepali Bhagvat * @author Allen Lee - * @version $Revision: 4 $ + * @version $Revision$ */ public class EndRoundEvent extends AbstractEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java @@ -5,13 +5,13 @@ import edu.asu.commons.net.Identifier; /** - * $Id: EnforcementRankingRequest.java 522 2010-06-30 19:17:48Z alllee $ + * $Id$ * * Sent from a client to the server signaling that the client * has updated the votes to the given options * * @author <a href='all...@as...'>Allen Lee</a> - * @version $Revision: 522 $ + * @version $Revision$ */ public class EnforcementRankingRequest extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/ExplicitCollectionModeRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/ExplicitCollectionModeRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/ExplicitCollectionModeRequest.java @@ -6,12 +6,12 @@ /** - * $Id: ExplicitCollectionModeRequest.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * Informs the server that the client's collection mode has changed. * * @author <a href='All...@as...'>Allen Lee</a> - * @version $Revision: 4 $ + * @version $Revision$ */ public class ExplicitCollectionModeRequest extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/MovementEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/MovementEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/MovementEvent.java @@ -6,9 +6,9 @@ /** - * $Id: MovementEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * - * @version $Revision: 4 $ + * @version $Revision$ * @author Allen Lee */ public class MovementEvent extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/PostRoundSanctionRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/PostRoundSanctionRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/PostRoundSanctionRequest.java @@ -11,7 +11,7 @@ * Carries a Map tying Identifiers to integer sanction amounts (can be positive or negative). * * @author alllee - * @version $Revision: 4 $ + * @version $Revision$ */ public class PostRoundSanctionRequest extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/QuizCompletedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/QuizCompletedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/QuizCompletedEvent.java @@ -5,10 +5,10 @@ /** - * $Id: QuizCompletedEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * @author Allen Lee - * @version $Revision: 4 $ + * @version $Revision$ */ public class QuizCompletedEvent extends AbstractEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java @@ -8,7 +8,7 @@ import edu.asu.commons.net.Identifier; /** - * $Id: QuizResponseEvent.java 522 2010-06-30 19:17:48Z alllee $ + * $Id$ * * A client's quiz responses for a given quiz page. * diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java @@ -6,12 +6,12 @@ /** - * $Id: RealTimeSanctionRequest.java 492 2010-03-23 23:08:38Z alllee $ + * $Id$ * * A request made by a client to sanction another client. * * @author <a href='mailto:all...@as...'>Allen Lee</a>, Deepali Bhagvat - * @version $Revision: 492 $ + * @version $Revision$ */ public class RealTimeSanctionRequest extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/ResourceAddedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/ResourceAddedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/ResourceAddedEvent.java @@ -8,12 +8,12 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ResourceAddedEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * FoodAddedEvent * * @author Allen Lee * @author Deepali Bhagvat - * @version $Revision: 4 $ + * @version $Revision$ */ public class ResourceAddedEvent extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/ResourcesAddedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/ResourcesAddedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/ResourcesAddedEvent.java @@ -10,11 +10,11 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ResourcesAddedEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * FoodAddedEvent * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 4 $ + * @version $Revision$ */ public class ResourcesAddedEvent extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java @@ -10,7 +10,7 @@ /** - * $Id: RoundStartedEvent.java 497 2010-03-29 20:10:49Z alllee $ + * $Id$ * * Signals clients that the beginning of a round has begun, carrying * relevant round parameters so the client can initialize its game window @@ -18,7 +18,7 @@ * * * @author <a href='mailto:all...@as...'>Allen Lee</a> - * @version $Revision: 497 $ + * @version $Revision$ */ public class RoundStartedEvent extends AbstractEvent implements ExperimentUpdateEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java @@ -4,7 +4,7 @@ import edu.asu.commons.net.Identifier; /** - * $Id: SanctionAppliedEvent.java 522 2010-06-30 19:17:48Z alllee $ + * $Id$ * * Persistable event marking an applied sanction. * diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/SynchronizeClientEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/SynchronizeClientEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/SynchronizeClientEvent.java @@ -12,7 +12,7 @@ /** - * $Id: SynchronizeClientEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * Maintains a Map of all clients and their locations (denoted by * java.awt.Point-S) as well as a list of food positions, if the food is visible. @@ -21,7 +21,7 @@ * * @author Deepali Bhagvat * @author Allen Lee - * @version $Revision: 4 $ + * @version $Revision$ */ public class SynchronizeClientEvent extends AbstractEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/TokenBirthEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TokenBirthEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TokenBirthEvent.java @@ -6,12 +6,12 @@ import edu.asu.commons.net.Identifier; /** - * $Id: TokenBirthEvent.java 78 2009-03-03 03:36:25Z alllee $ + * $Id$ * * Signifies that a resource at location source gave "birth" at location offspring. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 78 $ + * @version $Revision$ */ public class TokenBirthEvent extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/TokenCollectedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TokenCollectedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TokenCollectedEvent.java @@ -6,13 +6,13 @@ import edu.asu.commons.net.Identifier; /** - * $Id: TokenCollectedEvent.java 78 2009-03-03 03:36:25Z alllee $ + * $Id$ * * Persistable event signifying that a token was collected at some Point getLocation() by * the participant with Identifier getId(). * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 78 $ + * @version $Revision$ */ public class TokenCollectedEvent extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/TokenMovedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TokenMovedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TokenMovedEvent.java @@ -5,12 +5,12 @@ import edu.asu.commons.event.AbstractPersistableEvent; import edu.asu.commons.net.Identifier; /** - * $Id: TokenMovedEvent.java 78 2009-03-03 03:36:25Z alllee $ + * $Id$ * * Signifies that a token moved from source to destination. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 78 $ + * @version $Revision$ */ public class TokenMovedEvent extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/event/TokensMovedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TokensMovedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TokensMovedEvent.java @@ -6,13 +6,13 @@ import edu.asu.commons.event.AbstractPersistableEvent; import edu.asu.commons.net.Identifier; /** - * $Id: TokensMovedEvent.java 78 2009-03-03 03:36:25Z alllee $ + * $Id$ * * Bulk token movement event containing old locations that should be removed and * the new locations that should be added. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 78 $ + * @version $Revision$ */ public class TokensMovedEvent extends AbstractPersistableEvent { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java @@ -11,7 +11,7 @@ import edu.asu.commons.foraging.ui.GridView; /** - * $Id: GroupView.java 510 2010-04-20 04:11:22Z alllee $ + * $Id$ * * Provides an overview visualization of a particular group and all participants in the group. * diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/model/Direction.java --- a/src/main/java/edu/asu/commons/foraging/model/Direction.java +++ b/src/main/java/edu/asu/commons/foraging/model/Direction.java @@ -5,12 +5,12 @@ import java.util.Random; /** - * $Id: Direction.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * Enum representing a cardinal Direction in a 2-D grid. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 4 $ + * @version $Revision$ */ public enum Direction { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/model/RegulationData.java --- a/src/main/java/edu/asu/commons/foraging/model/RegulationData.java +++ b/src/main/java/edu/asu/commons/foraging/model/RegulationData.java @@ -5,13 +5,13 @@ import edu.asu.commons.net.Identifier; /** - * $Id: RegulationData.java 416 2009-12-25 05:17:14Z alllee $ + * $Id$ * * Prototype object used to carry information about a regulation proposed * by a participant. * * @author <a href='mailto:db...@as...'>dbarge</a> - * @version $Revision: 416 $ + * @version $Revision$ */ public class RegulationData implements Serializable, Comparable<RegulationData> { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/model/ResourceGenerator.java --- a/src/main/java/edu/asu/commons/foraging/model/ResourceGenerator.java +++ b/src/main/java/edu/asu/commons/foraging/model/ResourceGenerator.java @@ -8,12 +8,12 @@ import edu.asu.commons.foraging.conf.RoundConfiguration; /** - * $Id: ResourceGenerator.java 475 2010-02-24 00:39:44Z alllee $ + * $Id$ * * ResourceGenerators add resources directly to the GroupDataModel. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 475 $ + * @version $Revision$ */ public interface ResourceGenerator { public void initialize(RoundConfiguration roundConfiguration); diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/model/StochasticGenerator.java --- a/src/main/java/edu/asu/commons/foraging/model/StochasticGenerator.java +++ b/src/main/java/edu/asu/commons/foraging/model/StochasticGenerator.java @@ -1,12 +1,12 @@ package edu.asu.commons.foraging.model; /** - * $Id: StochasticGenerator.java 76 2009-02-25 18:02:38Z alllee $ + * $Id$ * * * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 76 $ + * @version $Revision$ */ public interface StochasticGenerator extends ResourceGenerator { public double getProbabilityForCell(GroupDataModel group, int x, int y); diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/ui/GameWindow.java --- a/src/main/java/edu/asu/commons/foraging/ui/GameWindow.java +++ b/src/main/java/edu/asu/commons/foraging/ui/GameWindow.java @@ -5,12 +5,12 @@ import edu.asu.commons.foraging.event.EndRoundEvent; /** - * $Id: GameWindow.java 416 2009-12-25 05:17:14Z alllee $ + * $Id$ * * Marker interface for both 2d and 3d game windows. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 416 $ + * @version $Revision$ */ public interface GameWindow { diff -r ba39f4118da8d9cfbdf2f217e290e48a2137429b -r 58bbaff1dcf57fce2e13fe5a3687212dd1d6e355 src/main/java/edu/asu/commons/foraging/ui/PostRoundSanctioningPanel.java --- a/src/main/java/edu/asu/commons/foraging/ui/PostRoundSanctioningPanel.java +++ b/src/main/java/edu/asu/commons/foraging/ui/PostRoundSanctioningPanel.java @@ -51,7 +51,7 @@ * Customized JPanel that enables participants to engage in post-round sanctioning. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 384 $ + * @version $Revision$ */ @SuppressWarnings("serial") Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-09-18 08:35:25
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/08b36dd5edc5/ changeset: 08b36dd5edc5 user: alllee date: 2012-09-18 10:35:10 summary: merging first cut at rule processor back into default to process imposed conditions affected #: 2 files diff -r f0aecafd2b928041108e5c1f04b78dbbc558384e -r 08b36dd5edc56db7779868a09878ee39c5df9703 src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java @@ -0,0 +1,170 @@ +package edu.asu.commons.foraging.data; + +import java.awt.Point; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; +import java.util.SortedSet; + +import edu.asu.commons.event.PersistableEvent; +import edu.asu.commons.experiment.SaveFileProcessor.Base; +import edu.asu.commons.experiment.SavedRoundData; +import edu.asu.commons.foraging.event.TokenCollectedEvent; +import edu.asu.commons.foraging.model.ClientData; +import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.net.Identifier; + +public class ForagingRuleProcessor extends Base { + + // rules are based on ForagingStrategy enum and ordered accordingly + // rule 1: collect tokens for 10 seconds than wait 10 seconds + // rule 2: private property, 4 quadrants + // rule 3: wait 60 seconds + // rule 4: collect 40 tokens then wait 30 seconds + private static class RuleData { + private int illegalRuleOneTokens = 0; + private int illegalRuleThreeTokens = 0; + private int illegalRuleFourTokens = 0; + private int totalTokensCollected = 0; + private int q1Tokens = 0; + private int q2Tokens = 0; + private int q3Tokens = 0; + private int q4Tokens = 0; + private int nextLegalCollectionTime = -1; + private int ruleFourTokenInterval = 1; + + public void addTokenCollected(Point location, int elapsedTimeInSeconds) { + if (isIllegalTokenCollectionForRuleOne(elapsedTimeInSeconds)) { + illegalRuleOneTokens++; + } + if (isIllegalTokenCollectionForRuleThree(elapsedTimeInSeconds)) { + illegalRuleThreeTokens++; + } + totalTokensCollected++; + addRuleTwoTokens(location); + checkRuleFourTokens(elapsedTimeInSeconds); + } + + private void checkRuleFourTokens(int elapsedTimeInSeconds) { + if (isIllegalRuleFourInterval(elapsedTimeInSeconds)) { + illegalRuleFourTokens++; + } + } + + private boolean isIllegalRuleFourInterval(int elapsedTimeInSeconds) { + if (totalTokensCollected < 40) { + return false; + } + int allowedTokens = ruleFourTokenInterval * 40; + // first check if we've reached our token goal + if (totalTokensCollected == allowedTokens) { + // next allowable time is 30 seconds from now. + nextLegalCollectionTime = elapsedTimeInSeconds + 30; + // the next number of allowable tokens is N * 40 + ruleFourTokenInterval++; + } +// System.err.println(String.format("allowed tokens: %d, total tokens collected: %d, next legal collection time: %d, token interval %d, legal collection? %s", +// allowedTokens, +// totalTokensCollected, +// nextLegalCollectionTime, +// ruleFourTokenInterval, +// (elapsedTimeInSeconds < nextLegalCollectionTime))); + return elapsedTimeInSeconds < nextLegalCollectionTime; + } + + private void addRuleTwoTokens(Point location) { + if (location.x < 13) { + if (location.y < 13) { + q1Tokens++; + } + else { + q2Tokens++; + } + } + else { + if (location.y < 13) { + q3Tokens++; + } + else { + q4Tokens++; + } + } + } + + private boolean isIllegalTokenCollectionForRuleThree(int elapsedTimeInSeconds) { + return elapsedTimeInSeconds <= 60; + } + + /** + * Returns true if the elapsed time is in the following interval ranges: + * 0-10, 20-30, 40-50, 60-70, and so on. + * + * @param elapsedTimeInSeconds + * @return + */ + private boolean isIllegalTokenCollectionForRuleOne(int elapsedTimeInSeconds) { + int interval = elapsedTimeInSeconds / 10; + int intervalModTwo = interval % 2; + return intervalModTwo == 0; + } + + public double getRuleOneBreaking() { + return (double) illegalRuleOneTokens / (double) totalTokensCollected; + } + public double getRuleThreeBreaking() { + return (double) illegalRuleThreeTokens / (double) totalTokensCollected; + } + public double getRuleFourBreaking() { + return (double) illegalRuleFourTokens / (double) totalTokensCollected; + } + + @Override + public String toString() { + return String.format("illegal R1 tokens: %d, illegal R2 tokens: %d, total tokens: %d, [%d, %d, %d, %d]", + illegalRuleOneTokens, illegalRuleFourTokens, totalTokensCollected, q1Tokens, q2Tokens, q3Tokens, q4Tokens); + } + + } + + @Override + public String getOutputFileExtension() { + return "-rule-data.txt"; + } + + @Override + public void process(SavedRoundData savedRoundData, PrintWriter writer) { + SortedSet<PersistableEvent> actions = savedRoundData.getActions(); + ServerDataModel dataModel = (ServerDataModel) savedRoundData.getDataModel(); + Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); + Map<ClientData, RuleData> dataMap = new HashMap<ClientData, RuleData>(); + for (ClientData data: clientDataMap.values()) { + dataMap.put(data, new RuleData()); + } + for (PersistableEvent event: actions) { + if (event instanceof TokenCollectedEvent) { + TokenCollectedEvent tokenCollectedEvent = (TokenCollectedEvent) event; + ClientData clientData = clientDataMap.get(event.getId()); + Point location = tokenCollectedEvent.getLocation(); + long elapsedTimeInSeconds = savedRoundData.getElapsedTimeInSeconds(event); + dataMap.get(clientData).addTokenCollected(location, (int) elapsedTimeInSeconds); + } + } + writer.println("Participant, 10 Second Rule, 60 Second Rule, 40 Second Rule, Q1 Tokens, Q2 Tokens, Q3 Tokens, Q4 Tokens"); + for (Map.Entry<ClientData, RuleData> entry: dataMap.entrySet()) { + RuleData data = entry.getValue(); + String line = String.format("%s, %3.2f, %3.2f, %3.2f, %d, %d, %d, %d", + entry.getKey(), + data.getRuleOneBreaking(), + data.getRuleThreeBreaking(), + data.getRuleFourBreaking(), + data.q1Tokens, + data.q2Tokens, + data.q3Tokens, + data.q4Tokens + ); + System.err.println(line); + writer.println(line); + } + } + +} diff -r f0aecafd2b928041108e5c1f04b78dbbc558384e -r 08b36dd5edc56db7779868a09878ee39c5df9703 src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java --- a/src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java @@ -32,6 +32,7 @@ new CollectedTokenSpatialDistributionProcessor(), new MovementStatisticsProcessor(), // new MovieCreatorProcessor(), + new ForagingRuleProcessor(), new AggregateCollectedTokenNeighborProcessor() )); Persister.processSaveFiles(allSaveFilesDirectory, processors); Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-09-18 00:47:43
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/ba39f4118da8/ changeset: ba39f4118da8 branch: asu-foraging-2012 user: alllee date: 2012-09-18 02:47:35 summary: foraging rule processor is now working, but needs to be verified against the actual data and is also generating NaNs in certain cases affected #: 2 files diff -r a91c53f62f5d207e76060b15b78c31f2a4fbdd5e -r ba39f4118da8d9cfbdf2f217e290e48a2137429b src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java @@ -9,7 +9,6 @@ import edu.asu.commons.event.PersistableEvent; import edu.asu.commons.experiment.SaveFileProcessor.Base; import edu.asu.commons.experiment.SavedRoundData; -import edu.asu.commons.foraging.conf.RoundConfiguration; import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.ServerDataModel; @@ -23,21 +22,23 @@ // rule 3: wait 60 seconds // rule 4: collect 40 tokens then wait 30 seconds private static class RuleData { - private int illegalRuleOneTokens; - private int illegalRuleFourTokens; - private int totalTokensCollected; - private int q1Tokens; - private int q2Tokens; - private int q3Tokens; - private int q4Tokens; - private int ruleFourTimestamp = -1; + private int illegalRuleOneTokens = 0; + private int illegalRuleThreeTokens = 0; + private int illegalRuleFourTokens = 0; + private int totalTokensCollected = 0; + private int q1Tokens = 0; + private int q2Tokens = 0; + private int q3Tokens = 0; + private int q4Tokens = 0; + private int nextLegalCollectionTime = -1; + private int ruleFourTokenInterval = 1; public void addTokenCollected(Point location, int elapsedTimeInSeconds) { if (isIllegalTokenCollectionForRuleOne(elapsedTimeInSeconds)) { illegalRuleOneTokens++; } if (isIllegalTokenCollectionForRuleThree(elapsedTimeInSeconds)) { - + illegalRuleThreeTokens++; } totalTokensCollected++; addRuleTwoTokens(location); @@ -45,20 +46,30 @@ } private void checkRuleFourTokens(int elapsedTimeInSeconds) { + if (isIllegalRuleFourInterval(elapsedTimeInSeconds)) { + illegalRuleFourTokens++; + } + } + + private boolean isIllegalRuleFourInterval(int elapsedTimeInSeconds) { if (totalTokensCollected < 40) { - return; + return false; } - if (totalTokensCollected < 80 && ruleFourTimestamp == -1) { - // 40 tokens have been collected, from now on each token collected is illegal until 30 seconds from ruleFourTimestamp have passed. - ruleFourTimestamp = elapsedTimeInSeconds; - return; + int allowedTokens = ruleFourTokenInterval * 40; + // first check if we've reached our token goal + if (totalTokensCollected == allowedTokens) { + // next allowable time is 30 seconds from now. + nextLegalCollectionTime = elapsedTimeInSeconds + 30; + // the next number of allowable tokens is N * 40 + ruleFourTokenInterval++; } - if (elapsedTimeInSeconds < ruleFourTimestamp + 30) { - illegalRuleFourTokens++; - return; - } - // FIXME: need to finish implementing rule four logic - +// System.err.println(String.format("allowed tokens: %d, total tokens collected: %d, next legal collection time: %d, token interval %d, legal collection? %s", +// allowedTokens, +// totalTokensCollected, +// nextLegalCollectionTime, +// ruleFourTokenInterval, +// (elapsedTimeInSeconds < nextLegalCollectionTime))); + return elapsedTimeInSeconds < nextLegalCollectionTime; } private void addRuleTwoTokens(Point location) { @@ -84,12 +95,6 @@ return elapsedTimeInSeconds <= 60; } - @Override - public String toString() { - return String.format("illegal R1 tokens: %d, illegal R2 tokens: %d, total tokens: %d, [%d, %d, %d, %d]", - illegalRuleOneTokens, illegalRuleFourTokens, totalTokensCollected, q1Tokens, q2Tokens, q3Tokens, q4Tokens); - } - /** * Returns true if the elapsed time is in the following interval ranges: * 0-10, 20-30, 40-50, 60-70, and so on. @@ -102,6 +107,23 @@ int intervalModTwo = interval % 2; return intervalModTwo == 0; } + + public double getRuleOneBreaking() { + return (double) illegalRuleOneTokens / (double) totalTokensCollected; + } + public double getRuleThreeBreaking() { + return (double) illegalRuleThreeTokens / (double) totalTokensCollected; + } + public double getRuleFourBreaking() { + return (double) illegalRuleFourTokens / (double) totalTokensCollected; + } + + @Override + public String toString() { + return String.format("illegal R1 tokens: %d, illegal R2 tokens: %d, total tokens: %d, [%d, %d, %d, %d]", + illegalRuleOneTokens, illegalRuleFourTokens, totalTokensCollected, q1Tokens, q2Tokens, q3Tokens, q4Tokens); + } + } @Override @@ -127,6 +149,22 @@ dataMap.get(clientData).addTokenCollected(location, (int) elapsedTimeInSeconds); } } + writer.println("Participant, 10 Second Rule, 60 Second Rule, 40 Second Rule, Q1 Tokens, Q2 Tokens, Q3 Tokens, Q4 Tokens"); + for (Map.Entry<ClientData, RuleData> entry: dataMap.entrySet()) { + RuleData data = entry.getValue(); + String line = String.format("%s, %3.2f, %3.2f, %3.2f, %d, %d, %d, %d", + entry.getKey(), + data.getRuleOneBreaking(), + data.getRuleThreeBreaking(), + data.getRuleFourBreaking(), + data.q1Tokens, + data.q2Tokens, + data.q3Tokens, + data.q4Tokens + ); + System.err.println(line); + writer.println(line); + } } } diff -r a91c53f62f5d207e76060b15b78c31f2a4fbdd5e -r ba39f4118da8d9cfbdf2f217e290e48a2137429b src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java --- a/src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java @@ -32,6 +32,7 @@ new CollectedTokenSpatialDistributionProcessor(), new MovementStatisticsProcessor(), // new MovieCreatorProcessor(), + new ForagingRuleProcessor(), new AggregateCollectedTokenNeighborProcessor() )); Persister.processSaveFiles(allSaveFilesDirectory, processors); Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-09-15 00:13:58
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/a91c53f62f5d/ changeset: a91c53f62f5d branch: asu-foraging-2012 user: alllee date: 2012-09-15 02:13:50 summary: adding foraging rule data processor, still incomplete for rule four and needs testing affected #: 1 file diff -r f730e6bfd31de0130b4f8c441a54fc7a5915a850 -r a91c53f62f5d207e76060b15b78c31f2a4fbdd5e src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingRuleProcessor.java @@ -0,0 +1,132 @@ +package edu.asu.commons.foraging.data; + +import java.awt.Point; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; +import java.util.SortedSet; + +import edu.asu.commons.event.PersistableEvent; +import edu.asu.commons.experiment.SaveFileProcessor.Base; +import edu.asu.commons.experiment.SavedRoundData; +import edu.asu.commons.foraging.conf.RoundConfiguration; +import edu.asu.commons.foraging.event.TokenCollectedEvent; +import edu.asu.commons.foraging.model.ClientData; +import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.net.Identifier; + +public class ForagingRuleProcessor extends Base { + + // rules are based on ForagingStrategy enum and ordered accordingly + // rule 1: collect tokens for 10 seconds than wait 10 seconds + // rule 2: private property, 4 quadrants + // rule 3: wait 60 seconds + // rule 4: collect 40 tokens then wait 30 seconds + private static class RuleData { + private int illegalRuleOneTokens; + private int illegalRuleFourTokens; + private int totalTokensCollected; + private int q1Tokens; + private int q2Tokens; + private int q3Tokens; + private int q4Tokens; + private int ruleFourTimestamp = -1; + + public void addTokenCollected(Point location, int elapsedTimeInSeconds) { + if (isIllegalTokenCollectionForRuleOne(elapsedTimeInSeconds)) { + illegalRuleOneTokens++; + } + if (isIllegalTokenCollectionForRuleThree(elapsedTimeInSeconds)) { + + } + totalTokensCollected++; + addRuleTwoTokens(location); + checkRuleFourTokens(elapsedTimeInSeconds); + } + + private void checkRuleFourTokens(int elapsedTimeInSeconds) { + if (totalTokensCollected < 40) { + return; + } + if (totalTokensCollected < 80 && ruleFourTimestamp == -1) { + // 40 tokens have been collected, from now on each token collected is illegal until 30 seconds from ruleFourTimestamp have passed. + ruleFourTimestamp = elapsedTimeInSeconds; + return; + } + if (elapsedTimeInSeconds < ruleFourTimestamp + 30) { + illegalRuleFourTokens++; + return; + } + // FIXME: need to finish implementing rule four logic + + } + + private void addRuleTwoTokens(Point location) { + if (location.x < 13) { + if (location.y < 13) { + q1Tokens++; + } + else { + q2Tokens++; + } + } + else { + if (location.y < 13) { + q3Tokens++; + } + else { + q4Tokens++; + } + } + } + + private boolean isIllegalTokenCollectionForRuleThree(int elapsedTimeInSeconds) { + return elapsedTimeInSeconds <= 60; + } + + @Override + public String toString() { + return String.format("illegal R1 tokens: %d, illegal R2 tokens: %d, total tokens: %d, [%d, %d, %d, %d]", + illegalRuleOneTokens, illegalRuleFourTokens, totalTokensCollected, q1Tokens, q2Tokens, q3Tokens, q4Tokens); + } + + /** + * Returns true if the elapsed time is in the following interval ranges: + * 0-10, 20-30, 40-50, 60-70, and so on. + * + * @param elapsedTimeInSeconds + * @return + */ + private boolean isIllegalTokenCollectionForRuleOne(int elapsedTimeInSeconds) { + int interval = elapsedTimeInSeconds / 10; + int intervalModTwo = interval % 2; + return intervalModTwo == 0; + } + } + + @Override + public String getOutputFileExtension() { + return "-rule-data.txt"; + } + + @Override + public void process(SavedRoundData savedRoundData, PrintWriter writer) { + SortedSet<PersistableEvent> actions = savedRoundData.getActions(); + ServerDataModel dataModel = (ServerDataModel) savedRoundData.getDataModel(); + Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); + Map<ClientData, RuleData> dataMap = new HashMap<ClientData, RuleData>(); + for (ClientData data: clientDataMap.values()) { + dataMap.put(data, new RuleData()); + } + for (PersistableEvent event: actions) { + if (event instanceof TokenCollectedEvent) { + TokenCollectedEvent tokenCollectedEvent = (TokenCollectedEvent) event; + ClientData clientData = clientDataMap.get(event.getId()); + Point location = tokenCollectedEvent.getLocation(); + long elapsedTimeInSeconds = savedRoundData.getElapsedTimeInSeconds(event); + dataMap.get(clientData).addTokenCollected(location, (int) elapsedTimeInSeconds); + } + } + } + +} Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-09-12 00:38:28
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/f0aecafd2b92/ changeset: f0aecafd2b92 user: alllee date: 2012-09-12 02:38:16 summary: kwexpand affected #: 32 files diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/data/AggregateCollectedTokenNeighborProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AggregateCollectedTokenNeighborProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AggregateCollectedTokenNeighborProcessor.java @@ -23,7 +23,7 @@ import edu.asu.commons.util.Utils; /** - * $Id: AggregateCollectedTokenNeighborProcessor.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Generates aggregate distributions of the number of neighboring tokens for a collected token in two situations: * 1. without regard to visibility diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/data/ClientMovementStatistics.java --- a/src/main/java/edu/asu/commons/foraging/data/ClientMovementStatistics.java +++ b/src/main/java/edu/asu/commons/foraging/data/ClientMovementStatistics.java @@ -5,7 +5,7 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ClientMovementStatistics.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Helper class to keep track of client movements. * diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/data/ClientMovementTokenCount.java --- a/src/main/java/edu/asu/commons/foraging/data/ClientMovementTokenCount.java +++ b/src/main/java/edu/asu/commons/foraging/data/ClientMovementTokenCount.java @@ -7,7 +7,7 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ClientMovementTokenCount.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Helper class for maintaining basic movement / token information. * diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/data/MovementStatisticsProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/MovementStatisticsProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/MovementStatisticsProcessor.java @@ -19,7 +19,7 @@ import edu.asu.commons.util.Utils; /** - * $Id: MovementStatisticsProcessor.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * * @author <a href='mailto:all...@as...'>Allen Lee</a> diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/BeginChatRoundRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/BeginChatRoundRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/BeginChatRoundRequest.java @@ -6,13 +6,13 @@ /** - * $Id: BeginChatRoundRequest.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * The facilitator uses this Request to signal the server that the timed * communication can now begin. * * @author Allen Lee - * @version $Revision: 4 $ + * @version $Revision$ */ public class BeginChatRoundRequest extends AbstractEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java @@ -10,13 +10,13 @@ /** - * $Id: ClientMovementRequest.java 350 2009-10-30 22:18:42Z alllee $ + * $Id$ * * Client signal informing the server that the client has moved in Direction d * and has ended up at Point p. * * @author <a href='mailto:al...@cs...'>Allen Lee</a> - * @version $Revision: 350 $ + * @version $Revision$ */ public class ClientMovementRequest extends AbstractEvent implements ClientRequest { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/ClientPoseUpdate.java --- a/src/main/java/edu/asu/commons/foraging/event/ClientPoseUpdate.java +++ b/src/main/java/edu/asu/commons/foraging/event/ClientPoseUpdate.java @@ -5,10 +5,10 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ClientPoseUpdate.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * @author <a href='All...@as...'>Allen Lee</a>, Deepali Bhagvat - * @version $Revision: 4 $ + * @version $Revision$ */ public class ClientPoseUpdate extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/CollectTokenRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/CollectTokenRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/CollectTokenRequest.java @@ -4,12 +4,12 @@ import edu.asu.commons.net.Identifier; /** - * $Id: CollectTokenRequest.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * Signals that the client wants to collect a token at its present location. * * @author <a href='All...@as...'>Allen Lee</a> - * @version $Revision: 4 $ + * @version $Revision$ */ public class CollectTokenRequest extends AbstractEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/EndRoundEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/EndRoundEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/EndRoundEvent.java @@ -11,7 +11,7 @@ /** - * $Id: EndRoundEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * This event carries all data relevant to the ending of a round, including the * debriefing message, the time (in milliseconds) that the client should wait @@ -21,7 +21,7 @@ * * @author Deepali Bhagvat * @author Allen Lee - * @version $Revision: 4 $ + * @version $Revision$ */ public class EndRoundEvent extends AbstractEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java @@ -5,13 +5,13 @@ import edu.asu.commons.net.Identifier; /** - * $Id: EnforcementRankingRequest.java 522 2010-06-30 19:17:48Z alllee $ + * $Id$ * * Sent from a client to the server signaling that the client * has updated the votes to the given options * * @author <a href='all...@as...'>Allen Lee</a> - * @version $Revision: 522 $ + * @version $Revision$ */ public class EnforcementRankingRequest extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/ExplicitCollectionModeRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/ExplicitCollectionModeRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/ExplicitCollectionModeRequest.java @@ -6,12 +6,12 @@ /** - * $Id: ExplicitCollectionModeRequest.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * Informs the server that the client's collection mode has changed. * * @author <a href='All...@as...'>Allen Lee</a> - * @version $Revision: 4 $ + * @version $Revision$ */ public class ExplicitCollectionModeRequest extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/MovementEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/MovementEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/MovementEvent.java @@ -6,9 +6,9 @@ /** - * $Id: MovementEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * - * @version $Revision: 4 $ + * @version $Revision$ * @author Allen Lee */ public class MovementEvent extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/PostRoundSanctionRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/PostRoundSanctionRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/PostRoundSanctionRequest.java @@ -11,7 +11,7 @@ * Carries a Map tying Identifiers to integer sanction amounts (can be positive or negative). * * @author alllee - * @version $Revision: 4 $ + * @version $Revision$ */ public class PostRoundSanctionRequest extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/QuizCompletedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/QuizCompletedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/QuizCompletedEvent.java @@ -5,10 +5,10 @@ /** - * $Id: QuizCompletedEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * @author Allen Lee - * @version $Revision: 4 $ + * @version $Revision$ */ public class QuizCompletedEvent extends AbstractEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java @@ -8,7 +8,7 @@ import edu.asu.commons.net.Identifier; /** - * $Id: QuizResponseEvent.java 522 2010-06-30 19:17:48Z alllee $ + * $Id$ * * A client's quiz responses for a given quiz page. * diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java @@ -6,12 +6,12 @@ /** - * $Id: RealTimeSanctionRequest.java 492 2010-03-23 23:08:38Z alllee $ + * $Id$ * * A request made by a client to sanction another client. * * @author <a href='mailto:all...@as...'>Allen Lee</a>, Deepali Bhagvat - * @version $Revision: 492 $ + * @version $Revision$ */ public class RealTimeSanctionRequest extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/ResourceAddedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/ResourceAddedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/ResourceAddedEvent.java @@ -8,12 +8,12 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ResourceAddedEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * FoodAddedEvent * * @author Allen Lee * @author Deepali Bhagvat - * @version $Revision: 4 $ + * @version $Revision$ */ public class ResourceAddedEvent extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/ResourcesAddedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/ResourcesAddedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/ResourcesAddedEvent.java @@ -10,11 +10,11 @@ import edu.asu.commons.net.Identifier; /** - * $Id: ResourcesAddedEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * FoodAddedEvent * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 4 $ + * @version $Revision$ */ public class ResourcesAddedEvent extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java @@ -10,7 +10,7 @@ /** - * $Id: RoundStartedEvent.java 497 2010-03-29 20:10:49Z alllee $ + * $Id$ * * Signals clients that the beginning of a round has begun, carrying * relevant round parameters so the client can initialize its game window @@ -18,7 +18,7 @@ * * * @author <a href='mailto:all...@as...'>Allen Lee</a> - * @version $Revision: 497 $ + * @version $Revision$ */ public class RoundStartedEvent extends AbstractEvent implements ExperimentUpdateEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java @@ -4,7 +4,7 @@ import edu.asu.commons.net.Identifier; /** - * $Id: SanctionAppliedEvent.java 522 2010-06-30 19:17:48Z alllee $ + * $Id$ * * Persistable event marking an applied sanction. * diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/SynchronizeClientEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/SynchronizeClientEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/SynchronizeClientEvent.java @@ -12,7 +12,7 @@ /** - * $Id: SynchronizeClientEvent.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * Maintains a Map of all clients and their locations (denoted by * java.awt.Point-S) as well as a list of food positions, if the food is visible. @@ -21,7 +21,7 @@ * * @author Deepali Bhagvat * @author Allen Lee - * @version $Revision: 4 $ + * @version $Revision$ */ public class SynchronizeClientEvent extends AbstractEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/TokenBirthEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TokenBirthEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TokenBirthEvent.java @@ -6,12 +6,12 @@ import edu.asu.commons.net.Identifier; /** - * $Id: TokenBirthEvent.java 78 2009-03-03 03:36:25Z alllee $ + * $Id$ * * Signifies that a resource at location source gave "birth" at location offspring. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 78 $ + * @version $Revision$ */ public class TokenBirthEvent extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/TokenCollectedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TokenCollectedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TokenCollectedEvent.java @@ -6,13 +6,13 @@ import edu.asu.commons.net.Identifier; /** - * $Id: TokenCollectedEvent.java 78 2009-03-03 03:36:25Z alllee $ + * $Id$ * * Persistable event signifying that a token was collected at some Point getLocation() by * the participant with Identifier getId(). * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 78 $ + * @version $Revision$ */ public class TokenCollectedEvent extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/TokenMovedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TokenMovedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TokenMovedEvent.java @@ -5,12 +5,12 @@ import edu.asu.commons.event.AbstractPersistableEvent; import edu.asu.commons.net.Identifier; /** - * $Id: TokenMovedEvent.java 78 2009-03-03 03:36:25Z alllee $ + * $Id$ * * Signifies that a token moved from source to destination. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 78 $ + * @version $Revision$ */ public class TokenMovedEvent extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/event/TokensMovedEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TokensMovedEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TokensMovedEvent.java @@ -6,13 +6,13 @@ import edu.asu.commons.event.AbstractPersistableEvent; import edu.asu.commons.net.Identifier; /** - * $Id: TokensMovedEvent.java 78 2009-03-03 03:36:25Z alllee $ + * $Id$ * * Bulk token movement event containing old locations that should be removed and * the new locations that should be added. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 78 $ + * @version $Revision$ */ public class TokensMovedEvent extends AbstractPersistableEvent { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java @@ -11,7 +11,7 @@ import edu.asu.commons.foraging.ui.GridView; /** - * $Id: GroupView.java 510 2010-04-20 04:11:22Z alllee $ + * $Id$ * * Provides an overview visualization of a particular group and all participants in the group. * diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/model/Direction.java --- a/src/main/java/edu/asu/commons/foraging/model/Direction.java +++ b/src/main/java/edu/asu/commons/foraging/model/Direction.java @@ -5,12 +5,12 @@ import java.util.Random; /** - * $Id: Direction.java 4 2008-07-25 22:51:44Z alllee $ + * $Id$ * * Enum representing a cardinal Direction in a 2-D grid. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 4 $ + * @version $Revision$ */ public enum Direction { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/model/RegulationData.java --- a/src/main/java/edu/asu/commons/foraging/model/RegulationData.java +++ b/src/main/java/edu/asu/commons/foraging/model/RegulationData.java @@ -5,13 +5,13 @@ import edu.asu.commons.net.Identifier; /** - * $Id: RegulationData.java 416 2009-12-25 05:17:14Z alllee $ + * $Id$ * * Prototype object used to carry information about a regulation proposed * by a participant. * * @author <a href='mailto:db...@as...'>dbarge</a> - * @version $Revision: 416 $ + * @version $Revision$ */ public class RegulationData implements Serializable, Comparable<RegulationData> { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/model/ResourceGenerator.java --- a/src/main/java/edu/asu/commons/foraging/model/ResourceGenerator.java +++ b/src/main/java/edu/asu/commons/foraging/model/ResourceGenerator.java @@ -8,12 +8,12 @@ import edu.asu.commons.foraging.conf.RoundConfiguration; /** - * $Id: ResourceGenerator.java 475 2010-02-24 00:39:44Z alllee $ + * $Id$ * * ResourceGenerators add resources directly to the GroupDataModel. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 475 $ + * @version $Revision$ */ public interface ResourceGenerator { public void initialize(RoundConfiguration roundConfiguration); diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/model/StochasticGenerator.java --- a/src/main/java/edu/asu/commons/foraging/model/StochasticGenerator.java +++ b/src/main/java/edu/asu/commons/foraging/model/StochasticGenerator.java @@ -1,12 +1,12 @@ package edu.asu.commons.foraging.model; /** - * $Id: StochasticGenerator.java 76 2009-02-25 18:02:38Z alllee $ + * $Id$ * * * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 76 $ + * @version $Revision$ */ public interface StochasticGenerator extends ResourceGenerator { public double getProbabilityForCell(GroupDataModel group, int x, int y); diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/ui/GameWindow.java --- a/src/main/java/edu/asu/commons/foraging/ui/GameWindow.java +++ b/src/main/java/edu/asu/commons/foraging/ui/GameWindow.java @@ -5,12 +5,12 @@ import edu.asu.commons.foraging.event.EndRoundEvent; /** - * $Id: GameWindow.java 416 2009-12-25 05:17:14Z alllee $ + * $Id$ * * Marker interface for both 2d and 3d game windows. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 416 $ + * @version $Revision$ */ public interface GameWindow { diff -r 1f350cebb59f68a549393ecfc559137334388b05 -r f0aecafd2b928041108e5c1f04b78dbbc558384e src/main/java/edu/asu/commons/foraging/ui/PostRoundSanctioningPanel.java --- a/src/main/java/edu/asu/commons/foraging/ui/PostRoundSanctioningPanel.java +++ b/src/main/java/edu/asu/commons/foraging/ui/PostRoundSanctioningPanel.java @@ -51,7 +51,7 @@ * Customized JPanel that enables participants to engage in post-round sanctioning. * * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Revision: 384 $ + * @version $Revision$ */ @SuppressWarnings("serial") Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: A L. <iss...@bi...> - 2012-08-02 00:06:44
|
--- you can reply above this line --- New issue 59: get_or_create issues for Likes https://bitbucket.org/virtualcommons/vcweb/issue/59/get_or_create-issues-for-likes A Lee: There needs to be a unique_together constraint on the target_data_value and participant_group_relationship for Like models in order for get_or_create to work properly here without creating dupes. However, this won't work in general since this uniqueness constraint is only specific to Likes.. need to figure out an appropriate solution. MultipleObjectsReturned: get() returned more than one Like File "vcweb/lighterprints/views.py", line 314, in like (like, created) = Like.objects.get_or_create(participant_group_relationship=participant_group_relationship, target_data_value=target) Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: Bitbucket <com...@bi...> - 2012-07-30 22:45:18
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/1f350cebb59f/ changeset: 1f350cebb59f user: alllee date: 2012-07-31 00:37:31 summary: merging fixes to summary processor from asu-foraging-2012 affected #: 5 files diff -r 45e39bd1c9eb6bfddedfac30a47ed28c2551783e -r 1f350cebb59f68a549393ecfc559137334388b05 src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -46,7 +46,6 @@ @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { - RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); processData(savedRoundData, writer); } @@ -149,11 +148,13 @@ writer.println(line); } else if (event instanceof RuleVoteRequest) { + System.err.println("rule vote request: " + event); RuleVoteRequest request = (RuleVoteRequest) event; String line = String.format("%s, %s, %s, Strategy Nomination", savedRoundData.toSecondString(event), request.getId(), request.getRule()); writer.println(line); } else if (event instanceof RuleSelectedUpdateEvent) { + System.err.println("rule selected update event: " + event); RuleSelectedUpdateEvent update = (RuleSelectedUpdateEvent) event; String line = String.format("%s, %s, \"%s\", \"%s\", Rule selected", savedRoundData.toSecondString(event), update.getGroup(), update.getSelectedStrategies(), update.getVotingResults()); diff -r 45e39bd1c9eb6bfddedfac30a47ed28c2551783e -r 1f350cebb59f68a549393ecfc559137334388b05 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -14,11 +14,14 @@ import edu.asu.commons.event.PersistableEvent; import edu.asu.commons.experiment.SaveFileProcessor; import edu.asu.commons.experiment.SavedRoundData; +import edu.asu.commons.foraging.event.RuleSelectedUpdateEvent; +import edu.asu.commons.foraging.event.RuleVoteRequest; +import edu.asu.commons.foraging.event.SanctionAppliedEvent; import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.ServerDataModel; -import edu.asu.commons.util.Utils; +import edu.asu.commons.net.Identifier; /** * $Id$ @@ -32,6 +35,20 @@ public void process(SavedRoundData savedRoundData, PrintWriter writer) { ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); List<GroupDataModel> groups = serverDataModel.getOrderedGroups(); + for (PersistableEvent event: savedRoundData.getActions()) { + if (event instanceof SanctionAppliedEvent) { + SanctionAppliedEvent sanctionEvent = (SanctionAppliedEvent) event; + Identifier id = sanctionEvent.getId(); + System.err.println("applying sanction costs and penalties to " + sanctionEvent.getId() + " -> " + sanctionEvent.getTarget()); + ClientData source = serverDataModel.getClientData(id); + source.addSanctionCosts(sanctionEvent.getSanctionCost()); + System.err.println("costs on client data are now " + source.getSanctionCosts()); + ClientData target = serverDataModel.getClientData(sanctionEvent.getTarget()); + target.addSanctionPenalties(sanctionEvent.getSanctionPenalty()); + System.err.println("penalties on client data are now " + target.getSanctionPenalties()); + } + } + writer.println("Participant, Group, Total Cumulative Tokens, Sanction costs, Sanction penalties"); for (GroupDataModel group: groups) { int totalTokensHarvested = 0; @@ -75,6 +92,8 @@ } writer.println("========================================="); writer.println("Time, Participant, Token Collected?, Chat"); + Map<Identifier, RuleVoteRequest> ruleVoteRequests = new HashMap<Identifier, RuleVoteRequest>(); + ArrayList<RuleSelectedUpdateEvent> ruleSelectedEvents = new ArrayList<RuleSelectedUpdateEvent>(); for (PersistableEvent action: savedRoundData.getActions()) { if (action instanceof ChatRequest) { writer.println(String.format("%s, %s, %s, %s", @@ -83,6 +102,33 @@ else if (action instanceof TokenCollectedEvent) { writer.println(String.format("%s, %s, %s", savedRoundData.toSecondString(action), action.getId(), "token collected")); + } + else if (action instanceof RuleVoteRequest) { + ruleVoteRequests.put(action.getId(), (RuleVoteRequest) action); + } + else if (action instanceof RuleSelectedUpdateEvent) { + ruleSelectedEvents.add((RuleSelectedUpdateEvent) action); + } + } + if (! ruleVoteRequests.isEmpty()) { + writer.println("=== Selected rules ==="); + for (RuleSelectedUpdateEvent event: ruleSelectedEvents) { + writer.println(event.toString()); + } + for (GroupDataModel group: groups) { + ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(group.getClientDataMap().values()); + Collections.sort(clientDataList, new Comparator<ClientData>() { + @Override + public int compare(ClientData a, ClientData b) { + return Integer.valueOf(a.getAssignedNumber()).compareTo(b.getAssignedNumber()); + } + }); + + writer.println("=== Voting results for " + group.toString() + "==="); + for (ClientData data: clientDataList) { + RuleVoteRequest request = ruleVoteRequests.get(data.getId()); + writer.println(String.format("%s, %s", data.getId(), request.getRule())); + } } } diff -r 45e39bd1c9eb6bfddedfac30a47ed28c2551783e -r 1f350cebb59f68a549393ecfc559137334388b05 src/main/java/edu/asu/commons/foraging/model/ClientData.java --- a/src/main/java/edu/asu/commons/foraging/model/ClientData.java +++ b/src/main/java/edu/asu/commons/foraging/model/ClientData.java @@ -335,6 +335,15 @@ public int getSanctionPenalties() { return sanctionPenalties; } + + public void addSanctionCosts(int cost) { + sanctionCosts += cost; + } + + public void addSanctionPenalties(int penalty) { + sanctionPenalties += penalty; + } + public int getSanctionCosts() { return sanctionCosts; diff -r 45e39bd1c9eb6bfddedfac30a47ed28c2551783e -r 1f350cebb59f68a549393ecfc559137334388b05 src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java @@ -253,7 +253,7 @@ return new ArrayList<GroupDataModel>(new TreeSet<GroupDataModel>(clientsToGroups.values())); } - protected ClientData getClientData(Identifier id) { + public ClientData getClientData(Identifier id) { return getGroup(id).getClientData(id); } Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-07-30 21:18:44
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/f730e6bfd31d/ changeset: f730e6bfd31d branch: asu-foraging-2012 user: alllee date: 2012-07-30 23:18:35 summary: calculating sanction costs / penalties from the event stream as they are getting cleared along with the currentTokens at the end of the round. affected #: 4 files diff -r 7a12bf31f1c82e886dd5a8de2e37f4e392594d86 -r f730e6bfd31de0130b4f8c441a54fc7a5915a850 src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -46,7 +46,6 @@ @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { - RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); processData(savedRoundData, writer); } diff -r 7a12bf31f1c82e886dd5a8de2e37f4e392594d86 -r f730e6bfd31de0130b4f8c441a54fc7a5915a850 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -16,6 +16,7 @@ import edu.asu.commons.experiment.SavedRoundData; import edu.asu.commons.foraging.event.RuleSelectedUpdateEvent; import edu.asu.commons.foraging.event.RuleVoteRequest; +import edu.asu.commons.foraging.event.SanctionAppliedEvent; import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.GroupDataModel; @@ -34,6 +35,20 @@ public void process(SavedRoundData savedRoundData, PrintWriter writer) { ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); List<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); + for (PersistableEvent event: savedRoundData.getActions()) { + if (event instanceof SanctionAppliedEvent) { + SanctionAppliedEvent sanctionEvent = (SanctionAppliedEvent) event; + Identifier id = sanctionEvent.getId(); + System.err.println("applying sanction costs and penalties to " + sanctionEvent.getId() + " -> " + sanctionEvent.getTarget()); + ClientData source = serverDataModel.getClientData(id); + source.addSanctionCosts(sanctionEvent.getSanctionCost()); + System.err.println("costs on client data are now " + source.getSanctionCosts()); + ClientData target = serverDataModel.getClientData(sanctionEvent.getTarget()); + target.addSanctionPenalties(sanctionEvent.getSanctionPenalty()); + System.err.println("penalties on client data are now " + target.getSanctionPenalties()); + } + } + writer.println("Participant, Group, Collected Tokens, Sanction costs, Sanction penalties"); for (GroupDataModel group: groups) { int totalConsumedGroupTokens = 0; diff -r 7a12bf31f1c82e886dd5a8de2e37f4e392594d86 -r f730e6bfd31de0130b4f8c441a54fc7a5915a850 src/main/java/edu/asu/commons/foraging/model/ClientData.java --- a/src/main/java/edu/asu/commons/foraging/model/ClientData.java +++ b/src/main/java/edu/asu/commons/foraging/model/ClientData.java @@ -335,6 +335,15 @@ public int getSanctionPenalties() { return sanctionPenalties; } + + public void addSanctionCosts(int cost) { + sanctionCosts += cost; + } + + public void addSanctionPenalties(int penalty) { + sanctionPenalties += penalty; + } + public int getSanctionCosts() { return sanctionCosts; diff -r 7a12bf31f1c82e886dd5a8de2e37f4e392594d86 -r f730e6bfd31de0130b4f8c441a54fc7a5915a850 src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java @@ -262,7 +262,7 @@ return groups; } - protected ClientData getClientData(Identifier id) { + public ClientData getClientData(Identifier id) { return getGroup(id).getClientData(id); } Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-07-26 23:16:42
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/7a12bf31f1c8/ changeset: 7a12bf31f1c8 branch: asu-foraging-2012 user: alllee date: 2012-07-27 01:16:33 summary: minor formatting changes affected #: 1 file diff -r 273a171f8bcacdc1e9be0c20077d7571472584a5 -r 7a12bf31f1c82e886dd5a8de2e37f4e392594d86 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -96,7 +96,10 @@ } } if (! ruleVoteRequests.isEmpty()) { - writer.println("Selected rules:\n\t" + ruleSelectedEvents); + writer.println("=== Selected rules ==="); + for (RuleSelectedUpdateEvent event: ruleSelectedEvents) { + writer.println(event.toString()); + } for (GroupDataModel group: groups) { ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(group.getClientDataMap().values()); Collections.sort(clientDataList, new Comparator<ClientData>() { Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-07-26 22:40:58
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/273a171f8bca/ changeset: 273a171f8bca branch: asu-foraging-2012 user: alllee date: 2012-07-27 00:40:48 summary: neglected to store GroupDataModel with the RuleSelectedUpdateEvent.. thankfully this data should be reproducible from the logs but it needs to be added in default affected #: 1 file diff -r e7e0fd9704227f80e343e36f72bb460e23b671bc -r 273a171f8bcacdc1e9be0c20077d7571472584a5 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -78,7 +78,7 @@ writer.println("========================================="); writer.println("Time, Participant, Token Collected?, Chat"); Map<Identifier, RuleVoteRequest> ruleVoteRequests = new HashMap<Identifier, RuleVoteRequest>(); - Map<GroupDataModel, RuleSelectedUpdateEvent> ruleSelectedEvents = new HashMap<GroupDataModel, RuleSelectedUpdateEvent>(); + ArrayList<RuleSelectedUpdateEvent> ruleSelectedEvents = new ArrayList<RuleSelectedUpdateEvent>(); for (PersistableEvent action: savedRoundData.getActions()) { if (action instanceof ChatRequest) { writer.println(String.format("%s, %s, %s, %s", @@ -92,10 +92,11 @@ ruleVoteRequests.put(action.getId(), (RuleVoteRequest) action); } else if (action instanceof RuleSelectedUpdateEvent) { - ruleSelectedEvents.put(serverDataModel.getGroup(action.getId()), (RuleSelectedUpdateEvent) action); + ruleSelectedEvents.add((RuleSelectedUpdateEvent) action); } } if (! ruleVoteRequests.isEmpty()) { + writer.println("Selected rules:\n\t" + ruleSelectedEvents); for (GroupDataModel group: groups) { ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(group.getClientDataMap().values()); Collections.sort(clientDataList, new Comparator<ClientData>() { @@ -104,8 +105,8 @@ return Integer.valueOf(a.getAssignedNumber()).compareTo(b.getAssignedNumber()); } }); + writer.println("=== Voting results for " + group.toString() + "==="); - writer.println("Selected rule: " + ruleSelectedEvents.get(group).getSelectedRule()); for (ClientData data: clientDataList) { RuleVoteRequest request = ruleVoteRequests.get(data.getId()); writer.println(String.format("%s, %s", data.getId(), request.getRule())); Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-07-26 22:33:16
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/e7e0fd970422/ changeset: e7e0fd970422 branch: asu-foraging-2012 user: alllee date: 2012-07-27 00:33:00 summary: neglected to add selected rule (in the event of a tie breaker, not derivable from just the votes themselves) affected #: 1 file diff -r d06723a1082b35f37479ad60f212a1909546b872 -r e7e0fd9704227f80e343e36f72bb460e23b671bc src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -14,6 +14,7 @@ import edu.asu.commons.event.PersistableEvent; import edu.asu.commons.experiment.SaveFileProcessor; import edu.asu.commons.experiment.SavedRoundData; +import edu.asu.commons.foraging.event.RuleSelectedUpdateEvent; import edu.asu.commons.foraging.event.RuleVoteRequest; import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.model.ClientData; @@ -77,6 +78,7 @@ writer.println("========================================="); writer.println("Time, Participant, Token Collected?, Chat"); Map<Identifier, RuleVoteRequest> ruleVoteRequests = new HashMap<Identifier, RuleVoteRequest>(); + Map<GroupDataModel, RuleSelectedUpdateEvent> ruleSelectedEvents = new HashMap<GroupDataModel, RuleSelectedUpdateEvent>(); for (PersistableEvent action: savedRoundData.getActions()) { if (action instanceof ChatRequest) { writer.println(String.format("%s, %s, %s, %s", @@ -89,6 +91,9 @@ else if (action instanceof RuleVoteRequest) { ruleVoteRequests.put(action.getId(), (RuleVoteRequest) action); } + else if (action instanceof RuleSelectedUpdateEvent) { + ruleSelectedEvents.put(serverDataModel.getGroup(action.getId()), (RuleSelectedUpdateEvent) action); + } } if (! ruleVoteRequests.isEmpty()) { for (GroupDataModel group: groups) { @@ -100,6 +105,7 @@ } }); writer.println("=== Voting results for " + group.toString() + "==="); + writer.println("Selected rule: " + ruleSelectedEvents.get(group).getSelectedRule()); for (ClientData data: clientDataList) { RuleVoteRequest request = ruleVoteRequests.get(data.getId()); writer.println(String.format("%s, %s", data.getId(), request.getRule())); Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-07-26 22:21:24
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/d06723a1082b/ changeset: d06723a1082b branch: asu-foraging-2012 user: alllee date: 2012-07-27 00:21:13 summary: adding voting results to summary processor affected #: 1 file diff -r 6a5549259e2e78d180f7215664a39475425db8e9 -r d06723a1082b35f37479ad60f212a1909546b872 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -14,11 +14,12 @@ import edu.asu.commons.event.PersistableEvent; import edu.asu.commons.experiment.SaveFileProcessor; import edu.asu.commons.experiment.SavedRoundData; +import edu.asu.commons.foraging.event.RuleVoteRequest; import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.ServerDataModel; -import edu.asu.commons.util.Utils; +import edu.asu.commons.net.Identifier; /** * $Id$ @@ -35,7 +36,6 @@ writer.println("Participant, Group, Collected Tokens, Sanction costs, Sanction penalties"); for (GroupDataModel group: groups) { int totalConsumedGroupTokens = 0; - ArrayList<String> clientTokens = new ArrayList<String>(); ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(group.getClientDataMap().values()); Collections.sort(clientDataList, new Comparator<ClientData>() { @Override @@ -48,16 +48,6 @@ totalConsumedGroupTokens += data.getTotalTokens(); } writer.println(String.format("Group %s, %s, %s", group, group.getResourceDistributionSize(), totalConsumedGroupTokens)); - /* - writer.println( - String.format("%s, %s, %s, %s", - group, - Utils.join(',', clientTokens), - group.getResourceDistributionSize(), - totalConsumedGroupTokens, - Utils.join(',', group.getResourceDistribution().keySet()) - )); - */ } Map<GroupDataModel, SortedSet<ChatRequest>> chatRequestMap = new HashMap<GroupDataModel, SortedSet<ChatRequest>>(); SortedSet<ChatRequest> allChatRequests = savedRoundData.getChatRequests(); @@ -86,6 +76,7 @@ } writer.println("========================================="); writer.println("Time, Participant, Token Collected?, Chat"); + Map<Identifier, RuleVoteRequest> ruleVoteRequests = new HashMap<Identifier, RuleVoteRequest>(); for (PersistableEvent action: savedRoundData.getActions()) { if (action instanceof ChatRequest) { writer.println(String.format("%s, %s, %s, %s", @@ -94,7 +85,25 @@ else if (action instanceof TokenCollectedEvent) { writer.println(String.format("%s, %s, %s", savedRoundData.toSecondString(action), action.getId(), "token collected")); - + } + else if (action instanceof RuleVoteRequest) { + ruleVoteRequests.put(action.getId(), (RuleVoteRequest) action); + } + } + if (! ruleVoteRequests.isEmpty()) { + for (GroupDataModel group: groups) { + ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(group.getClientDataMap().values()); + Collections.sort(clientDataList, new Comparator<ClientData>() { + @Override + public int compare(ClientData a, ClientData b) { + return Integer.valueOf(a.getAssignedNumber()).compareTo(b.getAssignedNumber()); + } + }); + writer.println("=== Voting results for " + group.toString() + "==="); + for (ClientData data: clientDataList) { + RuleVoteRequest request = ruleVoteRequests.get(data.getId()); + writer.println(String.format("%s, %s", data.getId(), request.getRule())); + } } } } Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-07-26 04:40:37
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/45e39bd1c9eb/ changeset: 45e39bd1c9eb user: alllee date: 2012-07-26 06:18:32 summary: adjusting summary data file processor reporting to not be all on one difficult-to-parse line (transplanted from 6a5549259e2e78d180f7215664a39475425db8e9) affected #: 2 files diff -r b9d8f9a3f5c6cf4a3d1fa3d87cfc19d6bd1366a5 -r 45e39bd1c9eb6bfddedfac30a47ed28c2551783e src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java --- a/src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java @@ -31,7 +31,7 @@ new AggregateTokenSpatialDistributionProcessor(), new CollectedTokenSpatialDistributionProcessor(), new MovementStatisticsProcessor(), - new MovieCreatorProcessor(), +// new MovieCreatorProcessor(), new AggregateCollectedTokenNeighborProcessor() )); Persister.processSaveFiles(allSaveFilesDirectory, processors); diff -r b9d8f9a3f5c6cf4a3d1fa3d87cfc19d6bd1366a5 -r 45e39bd1c9eb6bfddedfac30a47ed28c2551783e src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -32,10 +32,8 @@ public void process(SavedRoundData savedRoundData, PrintWriter writer) { ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); List<GroupDataModel> groups = serverDataModel.getOrderedGroups(); - String header = "Participant, Group, Collected tokens, Given punishment, Received punishment"; - writer.println(header); + writer.println("Participant, Group, Total Cumulative Tokens, Sanction costs, Sanction penalties"); for (GroupDataModel group: groups) { - int totalTokensHarvestedThisRound = 0; int totalTokensHarvested = 0; ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(group.getClientDataMap().values()); Collections.sort(clientDataList, new Comparator<ClientData>() { @@ -45,15 +43,10 @@ } }); for (ClientData data : clientDataList) { - writer.println(String.format("%s, %s, %s, %s, %s", - data.getId(), group, data.getCurrentTokens(), data.getSanctionCosts(), data.getSanctionPenalties())); - totalTokensHarvestedThisRound += data.getCurrentTokens(); + writer.println(String.format("%s, %s, %s, %s, %s", data, group, data.getTotalTokens(), data.getSanctionCosts(), data.getSanctionPenalties())); totalTokensHarvested += data.getTotalTokens(); } - writer.println(String.format("%s, %d tokens harvested this round, %d tokens harvested over all rounds, %s", group, - totalTokensHarvestedThisRound, - totalTokensHarvested, - Utils.join(',', clientDataList))); + writer.println(String.format("Group %s, %s, %s", group, group.getResourceDistributionSize(), totalTokensHarvested)); } Map<GroupDataModel, SortedSet<ChatRequest>> chatRequestMap = new HashMap<GroupDataModel, SortedSet<ChatRequest>>(); SortedSet<ChatRequest> allChatRequests = savedRoundData.getChatRequests(); Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-07-26 04:18:49
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/6a5549259e2e/ changeset: 6a5549259e2e branch: asu-foraging-2012 user: alllee date: 2012-07-26 06:18:32 summary: adjusting summary data file processor reporting to not be all on one difficult-to-parse line affected #: 3 files diff -r be38ac0883e9b0442904b5717b63e00542196001 -r 6a5549259e2e78d180f7215664a39475425db8e9 src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -149,11 +149,13 @@ writer.println(line); } else if (event instanceof RuleVoteRequest) { + System.err.println("rule vote request: " + event); RuleVoteRequest request = (RuleVoteRequest) event; String line = String.format("%s, %s, %s, Strategy Nomination", savedRoundData.toSecondString(event), request.getId(), request.getRule()); writer.println(line); } else if (event instanceof RuleSelectedUpdateEvent) { + System.err.println("rule selected update event: " + event); RuleSelectedUpdateEvent update = (RuleSelectedUpdateEvent) event; String line = String.format("%s, %s, \"%s\", \"%s\", Rule selected", savedRoundData.toSecondString(event), update.getId(), update.getSelectedStrategies(), update.getVotingResults()); diff -r be38ac0883e9b0442904b5717b63e00542196001 -r 6a5549259e2e78d180f7215664a39475425db8e9 src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java --- a/src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java +++ b/src/main/java/edu/asu/commons/foraging/data/ForagingSaveFileConverter.java @@ -31,7 +31,7 @@ new AggregateTokenSpatialDistributionProcessor(), new CollectedTokenSpatialDistributionProcessor(), new MovementStatisticsProcessor(), - new MovieCreatorProcessor(), +// new MovieCreatorProcessor(), new AggregateCollectedTokenNeighborProcessor() )); Persister.processSaveFiles(allSaveFilesDirectory, processors); diff -r be38ac0883e9b0442904b5717b63e00542196001 -r 6a5549259e2e78d180f7215664a39475425db8e9 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -32,6 +32,7 @@ public void process(SavedRoundData savedRoundData, PrintWriter writer) { ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); List<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); + writer.println("Participant, Group, Collected Tokens, Sanction costs, Sanction penalties"); for (GroupDataModel group: groups) { int totalConsumedGroupTokens = 0; ArrayList<String> clientTokens = new ArrayList<String>(); @@ -43,9 +44,11 @@ } }); for (ClientData data : clientDataList) { - clientTokens.add(String.format("%s, %s", data, data.getTotalTokens())); + writer.println(String.format("%s, %s, %s, %s, %s", data, group, data.getTotalTokens(), data.getSanctionCosts(), data.getSanctionPenalties())); totalConsumedGroupTokens += data.getTotalTokens(); } + writer.println(String.format("Group %s, %s, %s", group, group.getResourceDistributionSize(), totalConsumedGroupTokens)); + /* writer.println( String.format("%s, %s, %s, %s", group, @@ -54,6 +57,7 @@ totalConsumedGroupTokens, Utils.join(',', group.getResourceDistribution().keySet()) )); + */ } Map<GroupDataModel, SortedSet<ChatRequest>> chatRequestMap = new HashMap<GroupDataModel, SortedSet<ChatRequest>>(); SortedSet<ChatRequest> allChatRequests = savedRoundData.getChatRequests(); Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: A L. <iss...@bi...> - 2012-07-16 23:01:30
|
--- you can reply above this line --- New issue 58: sockjs authentication https://bitbucket.org/virtualcommons/vcweb/issue/58/sockjs-authentication A Lee: excerpted from https://groups.google.com/forum/?fromgroups#!topic/sockjs/ZWOfnpOexa0 1. Encrypt value that identifies a user using symmetrical algorithm (AES, etc). Add some proofing to the token before encrypting it: random value, time stamp to prevent replay attack, etc. 2. Expose encrypted token to the web browser 3. Whenever sockjs client connects to the server, send this token as a first message 4. On server-side decrypt and verify token 5. If everything is fine, store user information in your connection class and continue working Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: A L. <iss...@bi...> - 2012-06-14 19:19:38
|
--- you can reply above this line --- New issue 57: input field types for ios https://bitbucket.org/virtualcommons/vcweb/issue/57/input-field-types-for-ios A Lee: http://www.bennadel.com/blog/1721-Default-To-The-Numeric-Email-And-URL-Keyboards-On-The-iPhone.htm Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: A L. <iss...@bi...> - 2012-06-14 18:15:38
|
--- you can reply above this line --- New issue 56: inconsistent api https://bitbucket.org/virtualcommons/vcweb/issue/56/inconsistent-api A Lee: activity list endpoint should be something like /api/activitylist/3 instead of /activity/list.json?participant_group_id=3 Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: Bitbucket <com...@bi...> - 2012-05-23 17:33:32
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/be38ac0883e9/ changeset: be38ac0883e9 branch: asu-foraging-2012 user: alllee date: 2012-05-23 19:32:56 summary: adjusting movie creator processor save file path (transplanted from b9d8f9a3f5c6cf4a3d1fa3d87cfc19d6bd1366a5) affected #: 1 file diff -r 743ef09b3df5c84047049fc0e69a53ef6a6efeb4 -r be38ac0883e9b0442904b5717b63e00542196001 src/main/java/edu/asu/commons/foraging/data/MovieCreatorProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/MovieCreatorProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/MovieCreatorProcessor.java @@ -24,7 +24,9 @@ import edu.asu.commons.foraging.facilitator.GroupView; import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.ServerDataModel; -import edu.asu.commons.foraging.util.*; +import edu.asu.commons.foraging.util.IntervalChecker; +import edu.asu.commons.foraging.util.QuickTimeOutputStream; +import edu.asu.commons.foraging.util.VideoFormat; /** * $Id$ @@ -47,9 +49,9 @@ } @Override - public void process(SavedRoundData savedRoundData, OutputStream stream) { - // hmm, there needs to be one output stream per group because we write 1 video per group. - // QuickTimeOutputStream quickTimeOutputStream = new QuickTimeOutputStream(stream, videoFormat); + public void process(SavedRoundData savedRoundData, OutputStream ignored) { + // there needs to be one output stream per group because we write 1 video per group. + // we ignore the incoming output stream. ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); final List<GroupView> groupViewList = new ArrayList<GroupView>(); @@ -64,7 +66,7 @@ groupView.setup(roundConfiguration); groupViewList.add(groupView); try { - File groupMovieFile = new File(savedRoundDataFile.getCanonicalPath() + "-group-" + groupDataModel.getGroupId() + "-" + saveFilePath + ".mov"); + File groupMovieFile = new File(savedRoundDataFile.getCanonicalPath() + "-group-" + groupDataModel.getGroupId() + ".mov"); groupViewMap.put(groupView, new QuickTimeOutputStream(groupMovieFile, videoFormat)); } catch (IOException exception) { Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-05-23 17:33:15
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/b9d8f9a3f5c6/ changeset: b9d8f9a3f5c6 user: alllee date: 2012-05-23 19:32:56 summary: adjusting movie creator processor save file path affected #: 1 file diff -r 4b03fd6501579091f9f30bae3a207694551f1a49 -r b9d8f9a3f5c6cf4a3d1fa3d87cfc19d6bd1366a5 src/main/java/edu/asu/commons/foraging/data/MovieCreatorProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/MovieCreatorProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/MovieCreatorProcessor.java @@ -24,7 +24,9 @@ import edu.asu.commons.foraging.facilitator.GroupView; import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.ServerDataModel; -import edu.asu.commons.foraging.util.*; +import edu.asu.commons.foraging.util.IntervalChecker; +import edu.asu.commons.foraging.util.QuickTimeOutputStream; +import edu.asu.commons.foraging.util.VideoFormat; /** * $Id$ @@ -47,9 +49,9 @@ } @Override - public void process(SavedRoundData savedRoundData, OutputStream stream) { - // hmm, there needs to be one output stream per group because we write 1 video per group. - // QuickTimeOutputStream quickTimeOutputStream = new QuickTimeOutputStream(stream, videoFormat); + public void process(SavedRoundData savedRoundData, OutputStream ignored) { + // there needs to be one output stream per group because we write 1 video per group. + // we ignore the incoming output stream. ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); final List<GroupView> groupViewList = new ArrayList<GroupView>(); @@ -64,7 +66,7 @@ groupView.setup(roundConfiguration); groupViewList.add(groupView); try { - File groupMovieFile = new File(savedRoundDataFile.getCanonicalPath() + "-group-" + groupDataModel.getGroupId() + "-" + saveFilePath + ".mov"); + File groupMovieFile = new File(savedRoundDataFile.getCanonicalPath() + "-group-" + groupDataModel.getGroupId() + ".mov"); groupViewMap.put(groupView, new QuickTimeOutputStream(groupMovieFile, videoFormat)); } catch (IOException exception) { Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-05-23 17:19:33
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/4b03fd650157/ changeset: 4b03fd650157 user: alllee date: 2012-05-23 19:19:23 summary: merging changes to summary processor for mady affected #: 1 file diff -r b6b0fbcabc4fb1267ecf68351278fed71850ee2c -r 4b03fd6501579091f9f30bae3a207694551f1a49 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -11,8 +11,10 @@ import java.util.TreeSet; import edu.asu.commons.event.ChatRequest; +import edu.asu.commons.event.PersistableEvent; import edu.asu.commons.experiment.SaveFileProcessor; import edu.asu.commons.experiment.SavedRoundData; +import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.ServerDataModel; @@ -78,8 +80,21 @@ } } } - + writer.println("========================================="); + writer.println("Time, Participant, Token Collected?, Chat"); + for (PersistableEvent action: savedRoundData.getActions()) { + if (action instanceof ChatRequest) { + writer.println(String.format("%s, %s, %s, %s", + savedRoundData.toSecondString(action), action.getId(), 0, action.toString())); + } + else if (action instanceof TokenCollectedEvent) { + writer.println(String.format("%s, %s, %s", + savedRoundData.toSecondString(action), action.getId(), "token collected")); + + } + } } + @Override public String getOutputFileExtension() { return "-summary.txt"; Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-05-22 21:10:17
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/743ef09b3df5/ changeset: 743ef09b3df5 branch: asu-foraging-2012 user: alllee date: 2012-05-22 23:10:01 summary: adding time ordered summary of chat / token collection events affected #: 1 file diff -r 79f5da33995d744a27bb59d2a28249502746e6fa -r 743ef09b3df5c84047049fc0e69a53ef6a6efeb4 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -11,8 +11,10 @@ import java.util.TreeSet; import edu.asu.commons.event.ChatRequest; +import edu.asu.commons.event.PersistableEvent; import edu.asu.commons.experiment.SaveFileProcessor; import edu.asu.commons.experiment.SavedRoundData; +import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.ServerDataModel; @@ -78,8 +80,21 @@ } } } - + writer.println("========================================="); + writer.println("Time, Participant, Token Collected?, Chat"); + for (PersistableEvent action: savedRoundData.getActions()) { + if (action instanceof ChatRequest) { + writer.println(String.format("%s, %s, %s, %s", + savedRoundData.toSecondString(action), action.getId(), 0, action.toString())); + } + else if (action instanceof TokenCollectedEvent) { + writer.println(String.format("%s, %s, %s", + savedRoundData.toSecondString(action), action.getId(), "token collected")); + + } + } } + @Override public String getOutputFileExtension() { return "-summary.txt"; Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: A L. <iss...@bi...> - 2012-05-18 00:03:33
|
--- you can reply above this line --- New issue 55: implement experiments for Tim https://bitbucket.org/virtualcommons/vcweb/issue/55/implement-experiments-for-tim A Lee: Specific changes that need to be implemented: # verify socket.io logic # might need to tweak group formation and provide support for generations where certain information is left from one generation to the next # ??? Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: virtualcommons <iss...@bi...> - 2012-05-15 02:44:34
|
--- you can reply above this line --- New issue 54: twitter bootstrap https://bitbucket.org/virtualcommons/vcweb/issue/54/twitter-bootstrap virtualcommons: Replace blueprint with http://twitter.github.com/bootstrap/ Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: A L. <iss...@bi...> - 2012-05-15 00:55:41
|
--- you can reply above this line --- New issue 53: oauth2 registration needs to set a local password still https://bitbucket.org/virtualcommons/vcweb/issue/53/oauth2-registration-needs-to-set-a-local A Lee: oauth2 registration currently works when linking an existing vcweb user account to a social auth account. Creation of brand new accounts won't work though. Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |