[virtualcommons-svn] commit/foraging: 2 new changesets
Status: Beta
Brought to you by:
alllee
From: <com...@bi...> - 2013-03-28 04:40:44
|
2 new commits in foraging: https://bitbucket.org/virtualcommons/foraging/commits/91a29135b11f/ Changeset: 91a29135b11f Branch: stable User: alllee Date: 2013-03-28 05:39:16 Summary: kw expansion Affected #: 33 files diff -r d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 @@ -9,7 +9,7 @@ import edu.asu.commons.experiment.SaveFileProcessor; /** - * $Id: ForagingSaveFileConverter.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * <p> * Save file processors used to convert binary data files from the foraging experiment. * diff -r d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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 d76a4a1439269f24f331741b86d1811977e0c33d -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 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") https://bitbucket.org/virtualcommons/foraging/commits/9a85c86b5535/ Changeset: 9a85c86b5535 Branch: stable User: alllee Date: 2013-03-28 05:39:55 Summary: merging default back into stable Affected #: 13 files diff -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 build.xml --- a/build.xml +++ b/build.xml @@ -84,7 +84,7 @@ test - Run all JUnit in the test source tree. build-all - builds the client, server, and facilitator jars. deploy - invokes build-all and then copies the client and facilitator jars to ${web.dir} - convert - invokes the ForagingSaveFileConverter to process the savefiles in the raw-data directory or as specified by -Dsavefile.dir=foo + convert - invokes the ForagingSaveFileConverter to process the savefiles in the experiment-data directory or as specified by -Dsavefile.dir=foo </echo></target><target name="build-all" depends="facilitator-jar, client-jar, server-jar, compile"/> @@ -202,7 +202,7 @@ </target><!-- Compile project source files --><target name="compile" depends="prepare, resolve"> - <javac srcdir="${src.dir}" destdir="${build.dir}" debug="on" optimize="off" deprecation="on" source="1.6" includeAntRuntime="false"> + <javac srcdir="${src.dir}" destdir="${build.dir}" debug="on" optimize="off" deprecation="on" source="1.6" target="1.6" includeAntRuntime="false"><compilerarg value="-Xlint:unchecked"/><classpath refid="project.classpath"/></javac> @@ -260,7 +260,7 @@ </target><!-- Compile Tests --><target name="compile-tests" depends="compile"> - <javac srcdir="${test.src.dir}" destdir="${test.build.dir}" source="1.6" debug="on"> + <javac srcdir="${test.src.dir}" destdir="${test.build.dir}" source="1.6" target="1.6" debug="on"><!-- <compilerarg value='-Xlint:unchecked'/> --><classpath refid="project.classpath"/></javac> @@ -281,8 +281,8 @@ </junit></target><property name="savefile.converter.class" value="edu.asu.commons.foraging.data.ForagingSaveFileConverter"/> - <!-- default savefile directory is the raw-data directory --> - <property name="savefile.dir" value="raw-data"/> + <!-- default savefile directory is the experiment-data directory --> + <property name="savefile.dir" value="experiment-data"/><target name="convert" depends="compile"><java classname="${savefile.converter.class}" classpathref="project.classpath" fork="yes"><arg value="${savefile.dir}"/> diff -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java --- a/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java +++ b/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java @@ -664,11 +664,12 @@ else if (resourceGeneratorType.equals("top-bottom-patchy")) { addSpecialInstructions(builder, getPatchyResourceInstructions()); } - if (builder.toString().isEmpty()) { + if (builder.length() == 0) { return instructionsBuilder; } else { - return instructionsBuilder.append("<h2>Additional instructions</h2><hr><ul>").append(builder).append("</ul>"); + // FIXME: localize via ResourceBundle + return instructionsBuilder.append("<hr><ul>").append(builder).append("</ul>"); } } @@ -685,7 +686,7 @@ } private String getInRoundChatInstructions() { - return getProperty("in-round-chat-instructions", "<p>You can chat during this round with all players visible on the screen.</p>"); + return getProperty("in-round-chat-instructions", getParentConfiguration().getInRoundChatInstructions()); } public String getTrustGameInstructions() { @@ -850,4 +851,29 @@ return getProperty("survey-confirmation-message", "Please make sure you have completed the survey before continuing. Have you completed the survey?"); } + + public String[] getTrustGamePlayerTwoColumnNames() { + return getParentConfiguration().getTrustGamePlayerTwoColumnNames(); + } + + public String getTrustGamePlayerOneAllocationLabel() { + return getParentConfiguration().getTrustGamePlayerOneAllocationLabel(); + } + + public String getTrustGamePlayerTwoAllocationLabel() { + return getParentConfiguration().getTrustGamePlayerTwoAllocationLabel(); + } + + public String getTrustGamePlayerTwoInstructionLabel() { + return getParentConfiguration().getTrustGamePlayerTwoInstructionLabel(); + } + + public String getPlayerOneAmountToKeepValidation() { + return getParentConfiguration().getPlayerOneAmountToKeepValidation(); + } + + public String getPlayerTwoAmountToKeepValidation() { + return getParentConfiguration().getPlayerTwoAmountToKeepValidation(); + } + } diff -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 src/main/java/edu/asu/commons/foraging/conf/ServerConfiguration.java --- a/src/main/java/edu/asu/commons/foraging/conf/ServerConfiguration.java +++ b/src/main/java/edu/asu/commons/foraging/conf/ServerConfiguration.java @@ -110,7 +110,7 @@ } public double getDollarsPerToken() { - return DEFAULT_DOLLARS_PER_TOKEN; + return getDoubleProperty("dollars-per-token", DEFAULT_DOLLARS_PER_TOKEN); } public String getFinalRoundFacilitatorInstructions() { @@ -155,8 +155,41 @@ return getIntProperty("server-sleep-interval", 50); } + public String getInRoundChatInstructions() { + return getProperty("in-round-chat-instructions", "<p>You can chat during this round with all players visible on the screen.</p>"); + } + public String getWaitingRoomInstructions() { return getProperty("waiting-room-instructions", "<h1>Please wait</h1><hr><p>Please wait while the rest of the participants complete the task.</p>"); } + public String[] getTrustGamePlayerTwoColumnNames() { + return new String[] { + getProperty("trust-game-p2-column-0", "Amount sent by P1"), + getProperty("trust-game-p2-column-1", "Total amount received"), + getProperty("trust-game-p2-column-2", "Amount to keep"), + getProperty("trust-game-p2-column-3", "Amount to return to P1") + }; + } + + public String getTrustGamePlayerOneAllocationLabel() { + return getProperty("trust-game-p1-allocation", "Player 1: Please select one of the following allocations."); + } + + public String getTrustGamePlayerTwoAllocationLabel() { + return getProperty("trust-game-p2-allocation", "Player 2: Please enter data for ALL of the following allocations."); + } + + public String getTrustGamePlayerTwoInstructionLabel() { + return getProperty("trust-game-p2-amount-to-keep-label", "Click in the \"Amount to keep\" column to select how much to keep if you are selected as player 2."); + } + + public String getPlayerOneAmountToKeepValidation() { + return getProperty("trust-game-p1-validation", "Please select the amount you would like to keep as player 1."); + } + + public String getPlayerTwoAmountToKeepValidation() { + return getProperty("trust-game-p2-validation", "Please select the amount you would like to keep as player 1."); + } + } diff -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 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 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 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,175 @@ +package edu.asu.commons.foraging.data; + +import java.awt.Point; +import java.io.PrintWriter; +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; +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 TreeMap<ClientData, RuleData>(new Comparator<ClientData>() { + public int compare(ClientData a, ClientData b) { + return a.getId().getStationId().compareTo(b.getId().getStationId()); + } + }); + 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 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 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,8 +31,9 @@ new AggregateTokenSpatialDistributionProcessor(), new CollectedTokenSpatialDistributionProcessor(), new MovementStatisticsProcessor(), +// new MovieCreatorProcessor(), + new ForagingRuleProcessor(), new AggregateCollectedTokenNeighborProcessor() - // new MovieCreatorProcessor() )); Persister.processSaveFiles(allSaveFilesDirectory, processors); return true; diff -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 src/main/java/edu/asu/commons/foraging/data/MovieCreatorProcessor.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/data/MovieCreatorProcessor.java @@ -0,0 +1,158 @@ +package edu.asu.commons.foraging.data; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +import edu.asu.commons.event.PersistableEvent; +import edu.asu.commons.experiment.SaveFileProcessor; +import edu.asu.commons.experiment.SavedRoundData; +import edu.asu.commons.foraging.conf.RoundConfiguration; +import edu.asu.commons.foraging.event.AddClientEvent; +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.IntervalChecker; +import edu.asu.commons.foraging.util.QuickTimeOutputStream; +import edu.asu.commons.foraging.util.VideoFormat; + +/** + * $Id$ + * + * Foraging save file processor to create quicktime movies. + * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev: 522 $ + */ +class MovieCreatorProcessor extends SaveFileProcessor.Base { + + private VideoFormat videoFormat; + + public MovieCreatorProcessor() { + this(VideoFormat.PNG); + } + + public MovieCreatorProcessor(VideoFormat videoFormat) { + this.videoFormat = videoFormat; + } + + @Override + 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>(); + final Map<GroupView, QuickTimeOutputStream> groupViewMap = new HashMap<GroupView, QuickTimeOutputStream>(); + serverDataModel.reinitialize(roundConfiguration); + List<JFrame> jframes = new ArrayList<JFrame>(); + Dimension dimension = new Dimension(800, 800); + File savedRoundDataFile = new File(savedRoundData.getSaveFilePath()); + String saveFilePath = savedRoundDataFile.getName(); + for (GroupDataModel groupDataModel: serverDataModel.getGroups()) { + GroupView groupView = new GroupView(dimension, groupDataModel); + groupView.setup(roundConfiguration); + groupViewList.add(groupView); + try { + File groupMovieFile = new File(savedRoundDataFile.getCanonicalPath() + "-group-" + groupDataModel.getGroupId() + ".mov"); + groupViewMap.put(groupView, new QuickTimeOutputStream(groupMovieFile, videoFormat)); + } + catch (IOException exception) { + exception.printStackTrace(); + } + JFrame jframe = new JFrame("Group: " + groupDataModel.getGroupId()); + jframe.add(groupView); + jframe.pack(); + jframe.setVisible(true); + jframes.add(jframe); + } + // grab out all add client events to initialize the state of the game properly. + for (PersistableEvent event: savedRoundData.getActions()) { + if (event instanceof AddClientEvent) { + System.err.println("Adding client: " + event); + serverDataModel.apply(event); + } + } + IntervalChecker intervalChecker = new IntervalChecker(); + // 10 frames per second + intervalChecker.setUnitsPerInterval(100); + + for (PersistableEvent event: savedRoundData.getActions()) { + final long elapsedTimeInMillis = savedRoundData.getElapsedTime(event); + + serverDataModel.apply(event); + if ( intervalChecker.isIntervalElapsed(elapsedTimeInMillis) && serverDataModel.isDirty() ) { + + for (final GroupView groupView: groupViewList) { + try { + // groupView.repaint(); + final Dimension groupViewSize = groupView.getSize(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + Graphics2D graphics = (Graphics2D) groupView.getGraphics(); + BufferedImage bufferedImage = graphics.getDeviceConfiguration().createCompatibleImage(groupViewSize.width, groupViewSize.height); + Graphics2D bufferedImageGraphics = bufferedImage.createGraphics(); + groupView.paint(bufferedImageGraphics); + try { + // 600 time scale units = 1 s + // 10 fps = one frame per 60 time scale units + groupViewMap.get(groupView).writeFrame(bufferedImage, 60); + } + catch (IOException exception) { + exception.printStackTrace(); + throw new RuntimeException(exception); + } + } + }); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + catch (InvocationTargetException e) { + e.printStackTrace(); + } + } + serverDataModel.setDirty(false); + + } + + } + for (QuickTimeOutputStream out : groupViewMap.values()) { + try { + out.close(); + } + catch (IOException exception) { + exception.printStackTrace(); + } + } + for (JFrame jframe : jframes) { + jframe.setVisible(false); + jframe.dispose(); + } + groupViewMap.clear(); + } + + + @Override + public void process(SavedRoundData savedRoundData, PrintWriter writer) { + throw new UnsupportedOperationException("This method is not suitable for this class (consider removing as requirement for super class)"); + } + + @Override + public String getOutputFileExtension() { + String videoFormatString = videoFormat.toString().toLowerCase(); + return String.format("-%s-movie.%s", videoFormatString, videoFormatString); + } +} diff -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 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,12 +11,17 @@ 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.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$ @@ -30,9 +35,23 @@ 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 totalConsumedGroupTokens = 0; - ArrayList<String> clientTokens = new ArrayList<String>(); + int totalTokensHarvested = 0; ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(group.getClientDataMap().values()); Collections.sort(clientDataList, new Comparator<ClientData>() { @Override @@ -41,16 +60,10 @@ } }); for (ClientData data : clientDataList) { - clientTokens.add(String.format("%s, %s", data, data.getTotalTokens())); - totalConsumedGroupTokens += data.getTotalTokens(); + 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, %s, %s, %s", - group, - Utils.join(',', clientTokens), - group.getResourceDistributionSize(), - totalConsumedGroupTokens) - ); + 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(); @@ -77,8 +90,50 @@ } } } - + 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", + 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")); + } + 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())); + } + + } + } } + @Override public String getOutputFileExtension() { return "-summary.txt"; diff -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 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 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 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); } diff -r 91a29135b11f07eaaa4cfc8dc86fc781795d2182 -r 9a85c86b5535bbce0764dcb500812e2475989254 src/main/java/edu/asu/commons/foraging/ui/TrustGamePanel.form --- a/src/main/java/edu/asu/commons/foraging/ui/TrustGamePanel.form +++ b/src/main/java/edu/asu/commons/foraging/ui/TrustGamePanel.form @@ -264,7 +264,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="0 cents"/> + <Property name="text" type="java.lang.String" value="0"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -278,7 +278,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="1 dollar"/> + <Property name="text" type="java.lang.String" value="1"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -292,7 +292,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="(3 x 1) = 3 dollars"/> + <Property name="text" type="java.lang.String" value="(3 x 1) = 3"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -307,7 +307,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="(3 x 0.75) = 2.25 dollars"/> + <Property name="text" type="java.lang.String" value="(3 x 0.75) = 2.25"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -322,7 +322,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="75 cents"/> + <Property name="text" type="java.lang.String" value="0.75"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -336,7 +336,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="25 cents"/> + <Property name="text" type="java.lang.String" value="0.25"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -366,7 +366,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="50 cents"/> + <Property name="text" type="java.lang.String" value="0.50"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -380,7 +380,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="50 cents"/> + <Property name="text" type="java.lang.String" value="0.50"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -394,7 +394,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="(3 x 0.5) = 1.5 dollars"/> + <Property name="text" type="java.lang.String" value="(3 x 0.5) = 1.5"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -417,7 +417,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="75 cents"/> + <Property name="text" type="java.lang.String" value="0.75"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -431,7 +431,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="25 cents"/> + <Property name="text" type="java.lang.String" value="0.25"/><Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"><Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"><LineBorder/> @@ -445,7 +445,7 @@ <Font name="Tahoma" size="14" style="0"/></Property><Property name="horizontalAlignment" type="int" value="0"/> - <Property name="text" type="java.lang.String" value="(3 x 0.25) = 0.75 cents"/> + <Property name="text" type="java.lang.String" value="(3 x 0.25) = 0.75"/><Property name="border" type="javax.swing.border.Bo... [truncated message content] |