virtualcommons-svn Mailing List for Virtual Commons Experiment Software (Page 60)
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: <al...@us...> - 2009-10-30 22:18:49
|
Revision: 350 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=350&view=rev Author: alllee Date: 2009-10-30 22:18:42 +0000 (Fri, 30 Oct 2009) Log Message: ----------- updated pom and build.xml, minor hygiene / refactoring Modified Paths: -------------- foraging/trunk/build.xml foraging/trunk/ivy.xml foraging/trunk/pom.xml foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ChatPanel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java foraging/trunk/src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java foraging/trunk/src/main/resources/web/client.jnlp Added Paths: ----------- foraging/trunk/src/main/java/edu/asu/commons/foraging/util/MovieCreatorProcessor.java Modified: foraging/trunk/build.xml =================================================================== --- foraging/trunk/build.xml 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/build.xml 2009-10-30 22:18:42 UTC (rev 350) @@ -13,7 +13,7 @@ uri='antlib:org.apache.ivy.ant' classpathref='ivy.lib.path'/> --> - <property name="ivy.install.version" value="2.0.0" /> + <property name="ivy.install.version" value="2.1.0" /> <condition property="ivy.home" value="${env.IVY_HOME}"> <isset property="env.IVY_HOME" /> </condition> @@ -22,18 +22,10 @@ <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" /> <target name="download-ivy" unless="offline"> - <mkdir dir="${ivy.jar.dir}"/> <!-- download Ivy from web site so that it can be used even without any special installation --> - <get src="http://www.apache.org/dist/ant/ivy/${ivy.install.version}/apache-ivy-${ivy.install.version}-bin.zip" - dest="${ivy.jar.dir}/ivy-${ivy.install.version}-bin.zip" usetimestamp="true"/> - <!-- FIXME: this should be dependent on the download in the first place --> - <unzip src='${ivy.jar.dir}/ivy-${ivy.install.version}-bin.zip' dest='${ivy.jar.dir}' overwrite='false' /> - <move file='${ivy.jar.dir}/apache-ivy-${ivy.install.version}/ivy-${ivy.install.version}.jar' tofile='${ivy.jar.file}' overwrite='false' /> - <!-- - <get src="http://www.apache.org/dist/ant/ivy/${ivy.install.version}/ivy.jar" - dest="${ivy.jar.file}" usetimestamp="true"/> - --> + <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" + dest="${ivy.jar.file}" usetimestamp="true"/> </target> <target name="init-ivy" depends="download-ivy"> @@ -41,12 +33,10 @@ it into ant's lib dir (note that the latter copy will always take precedence). We will not fail as long as local lib dir exists (it may be empty) and ivy is in at least one of ant's lib dir or the local lib dir. --> - <path id="ivy.lib.path"> - <fileset dir="${ivy.jar.dir}" includes="*.jar"/> - - </path> - <taskdef resource="org/apache/ivy/ant/antlib.xml" - uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/> + <path id="ivy.lib.path"> + <fileset dir="${ivy.jar.dir}" includes="*.jar"/> + </path> + <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/> </target> <target name='resolve' depends='init-ivy' description='--> retrieve dependencies with ivy'> @@ -73,7 +63,7 @@ <property name='server.class' value='edu.asu.commons.foraging.server.ForagingServer'/> <property name='framework.jar' value='csidex.jar'/> - <property name='dist.dir' value='dist' /> + <property name='dist.dir' value='.' /> <property name='resources.dir' value='src/main/resources'/> <property name='conf.dir' value='${resources.dir}/configuration'/> @@ -117,6 +107,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 </echo> </target> @@ -229,10 +220,10 @@ <target name="clean"> <delete dir="${build.dir}"/> <delete dir="${test.build.dir}"/> - <delete dir='${dist.dir}'/> <delete dir='${lib.dir}'/> <delete file='server.jar'/> - + <delete file='client.jar'/> + <delete file='facilitator.jar'/> </target> <!-- Compile project source files --> @@ -344,11 +335,13 @@ </target> <property name='savefile.converter.class' value='edu.asu.commons.foraging.util.ForagingSaveFileConverter'/> - <target name='convert-savefiles' depends='compile'> + <!-- default savefile directory is the raw-data directory --> + <property name='savefile.dir' value='raw-data'/> + <target name='convert' depends='compile'> <java classname='${savefile.converter.class}' classpathref='project.classpath' fork='yes'> - <arg value='raw-data'/> + <arg value='${savefile.dir}'/> </java> - </target> + </target> <!-- Run Test on GUI --> <target name="guitest" depends="compile-tests"> Modified: foraging/trunk/ivy.xml =================================================================== --- foraging/trunk/ivy.xml 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/ivy.xml 2009-10-30 22:18:42 UTC (rev 350) @@ -6,7 +6,7 @@ <info organisation="edu.asu.commons" module="foraging"/> <dependencies> <dependency org="junit" name="junit" rev="latest.integration"/> - <dependency org="edu.asu.commons" name="csidex" rev="latest.integration"/> + <dependency org="edu.asu.commons" name="csidex" rev="0.2-SNAPSHOT"/> <dependency org="net.java.dev.jogl" name="jogl" rev="1.1.1-rc6"/> <dependency org="javax.media" name="jmf" rev="2.1.1e"/> </dependencies> Modified: foraging/trunk/pom.xml =================================================================== --- foraging/trunk/pom.xml 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/pom.xml 2009-10-30 22:18:42 UTC (rev 350) @@ -52,7 +52,7 @@ <dependency> <groupId>edu.asu.commons</groupId> <artifactId>csidex</artifactId> - <version>0.2.1</version> + <version>0.2-SNAPSHOT</version> </dependency> <dependency> <groupId>net.java.dev.jogl</groupId> Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ChatPanel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ChatPanel.java 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ChatPanel.java 2009-10-30 22:18:42 UTC (rev 350) @@ -10,8 +10,6 @@ import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -51,7 +49,6 @@ * @author alllee * @version $Revision$ */ - @SuppressWarnings("serial") public class ChatPanel extends JPanel { @@ -225,7 +222,7 @@ continue; } JButton button = new JButton(getChatHandle(targetId)); - button.setAlignmentX(Component.CENTER_ALIGNMENT); + button.setAlignmentX(JButton.CENTER_ALIGNMENT); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // change stuff in the messageEntryPanel Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2009-10-30 22:18:42 UTC (rev 350) @@ -321,6 +321,14 @@ return ! isPrivateProperty() && getBooleanProperty("chat-enabled"); } + public boolean isVotingEnabled() { + return getBooleanProperty("voting-enabled", false); + } + + public String getEnforcementMechanisms() { + return getProperty("enforcement-mechanisms", "single, rotation"); + } + public int getMaximumResourceAge() { return getIntProperty("maximum-resource-age", 10); } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/ClientMovementRequest.java 2009-10-30 22:18:42 UTC (rev 350) @@ -48,7 +48,4 @@ return "Client update: " + getId() + "\n\tDirection: " + direction; } - public void setId(Identifier id) { - this.id = id; - } } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/GroupView.java 2009-10-30 22:18:42 UTC (rev 350) @@ -13,7 +13,7 @@ /** * $Id$ * - * Provides an overview visualization of a particular groups and all participants in the group. + * Provides an overview visualization of a particular group and all participants in the group. * * * @author <a href='mailto:All...@as...'>Allen Lee</a> Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java 2009-10-30 22:18:42 UTC (rev 350) @@ -287,7 +287,6 @@ } public void removeClient(Identifier id) { - // FIXME: add some sort of notification? clients.remove(id); } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java 2009-10-30 22:18:42 UTC (rev 350) @@ -48,16 +48,16 @@ public class ServerDataModel extends ForagingDataModel { private static final long serialVersionUID = 8166812955398387600L; - + private transient Logger logger = Logger.getLogger( getClass().getName() ); - + private transient Random random = new Random(); - + private transient FractalTerrain terrain; - + // Maps client Identifiers to the GroupDataModel that the client belongs to private final Map<Identifier, GroupDataModel> clientsToGroups = new HashMap<Identifier, GroupDataModel>(); - + public ServerDataModel() { super(EventTypeChannel.getInstance()); } @@ -66,40 +66,6 @@ super(channel); } - public void unapply(PersistableEvent persistableEvent) { - if (persistableEvent instanceof AddClientEvent) { -// AddClientEvent ace = (AddClientEvent) persistableEvent; -// ClientData clientData = ace.getClientData(); -// Group group = ace.getGroup(); -// removeClientFromGroup(clientData, group); - } - else if (persistableEvent instanceof MovementEvent) { - MovementEvent movementEvent = (MovementEvent) persistableEvent; -// if (movementEvent.didConsumeFood()) { -// Identifier clientId = movementEvent.getId(); -// Group group = getGroup(clientId); -// Point point = getClientPosition(clientId); -// addFood(group, point); -//// group.getClientData(clientId).subtractTokens(1); -// } - moveClient(movementEvent.getId(), movementEvent.getDirection().opposite()); - } - else if (persistableEvent instanceof ResourceAddedEvent) { - ResourceAddedEvent resourceAddedEvent = (ResourceAddedEvent) persistableEvent; - removeResource(resourceAddedEvent.getGroup(), resourceAddedEvent.getResource().getPosition()); - } - else if (persistableEvent instanceof RealTimeSanctionRequest) { -// // FIXME: need to add sanction undoability.. -// SanctionEvent sanctionEvent = (SanctionEvent) persistableEvent; -// getGroup(sanctionEvent.id()).reverseSanction(sanctionEvent); -// - } - else if (persistableEvent instanceof ResetTokenDistributionRequest) { - getGroup(persistableEvent.getId()).resetResourceDistribution(); - } - } - - /** * Invoked when we try to reconstruct a server game state given a time-ordered Set of * PersistableEvents that was previously saved. @@ -109,20 +75,14 @@ // iterate through all stored Persistable Actions, executing them onto // the ForagerServerGameState. if (event instanceof AddClientEvent) { - // usually we don't need to do anything here as we explicitly add all the clients - // in ReplayControlPanel. - AddClientEvent ace = (AddClientEvent) event; - ClientData clientData = ace.getClientData(); - GroupDataModel group = ace.getGroup(); + AddClientEvent addClientEvent = (AddClientEvent) event; + ClientData clientData = addClientEvent.getClientData(); + GroupDataModel group = addClientEvent.getGroup(); group.setServerDataModel(this); addClientToGroup(clientData, group); // XXX: this must occur after we add the client to the group because addClientToGroup() sets // the position according to the spacing algorithm. - System.err.println("setting client: " + clientData.getId() + " to position: " + ace.getPosition()); - clientData.setPosition(ace.getPosition()); - -// AddClientEvent ace = (AddClientEvent) persistableEvent; -// addClient(ace.getClientData()); + clientData.setPosition(addClientEvent.getPosition()); } else if (event instanceof ResourcesAddedEvent) { ResourcesAddedEvent resourcesAddedEvent = (ResourcesAddedEvent) event; @@ -137,34 +97,30 @@ addResource(resourceAddedEvent.getGroup(), resourceAddedEvent.getResource()); } else if (event instanceof RealTimeSanctionRequest) { -// getGroup(event.getId()).handle(event); + // currently unhandled. } else if (event instanceof ResetTokenDistributionRequest) { - getGroup(event.getId()).resetResourceDistribution(); } else if (event instanceof TokenCollectedEvent) { - TokenCollectedEvent tce = (TokenCollectedEvent) event; - getGroup(event.getId()).removeResource(tce.getLocation()); + TokenCollectedEvent tokenCollectedEvent = (TokenCollectedEvent) event; + getGroup(event.getId()).removeResource(tokenCollectedEvent.getLocation()); } else if (event instanceof ExplicitCollectionModeRequest) { ExplicitCollectionModeRequest request = (ExplicitCollectionModeRequest) event; - Identifier id = request.getId(); - ClientData client = getClientData(id); - client.setExplicitCollectionMode(request.isExplicitCollectionMode()); + getClientData(request.getId()).setExplicitCollectionMode(request.isExplicitCollectionMode()); } else { - // FIXME: this is pretty draconian, maybe relax this a little bit - // later. - logger.warning("could not apply event:" + event); + logger.warning("unapplied event:" + event); } } - - private void removeResource(GroupDataModel group, Point position) { - group.removeResource(position); + + public synchronized void removeClient(Identifier id) { + GroupDataModel groupDataModel = clientsToGroups.remove(id); + groupDataModel.removeClient(id); } - public void addClient(ClientData clientData) { + public synchronized void addClient(ClientData clientData) { // iterate through all existing groups and try to add to them. for (GroupDataModel group : getGroups()) { if (group.isFull()) { @@ -177,8 +133,8 @@ GroupDataModel group = new GroupDataModel(this); addClientToGroup(clientData, group); } - - public void addClientToGroup(ClientData clientData, GroupDataModel group) { + + public synchronized void addClientToGroup(ClientData clientData, GroupDataModel group) { group.addClient(clientData); clientsToGroups.put(clientData.getId(), group); channel.handle(new AddClientEvent(clientData, group, clientData.getPosition())); @@ -188,26 +144,26 @@ group.addResource(position); channel.handle(new ResourceAddedEvent(group, position)); } - + public void moveResources(GroupDataModel group, Collection<Point> removedPoints, Collection<Point> addedPoints) { // first remove all resources group.moveResources(removedPoints, addedPoints); channel.handle(new TokensMovedEvent(removedPoints, addedPoints)); } - + public void addResources(GroupDataModel group, Set<Resource> resources) { group.addResources(resources); channel.handle(new ResourcesAddedEvent(group, resources)); } - + public void moveResource(GroupDataModel group, Point oldLocation, Point newLocation) { group.addResource(newLocation); group.removeResource(oldLocation); channel.handle(new TokenMovedEvent(oldLocation, newLocation)); } - + public void moveResources(GroupDataModel group, List<Point> oldLocations, List<Point> newLocations) { - + } public void clearResourceDistribution() { @@ -215,7 +171,7 @@ group.clearResourceDistribution(); } } - + public Set<Point> getResourcePositions(Identifier id) { return clientsToGroups.get(id).getResourcePositions(); } @@ -225,7 +181,7 @@ int y = random.nextInt(getBoardHeight()); return new Point(x, y); } - + public FractalTerrain getTerrain() { return terrain; } @@ -233,7 +189,7 @@ public void setTerrain(FractalTerrain terrain) { this.terrain = terrain; } - + public void postProcessCleanup() { for (GroupDataModel group : clientsToGroups.values()) { group.clearDiffLists(); @@ -252,7 +208,7 @@ iter.remove(); } } - + public Map<Identifier, ClientData> getClientDataMap() { Map<Identifier, ClientData> clientDataMap = new HashMap<Identifier, ClientData>(); for (Map.Entry<Identifier, GroupDataModel> entry : clientsToGroups.entrySet()) { @@ -262,12 +218,12 @@ } return clientDataMap; } - + public void moveClient(Identifier id, Direction d) { getGroup(id).moveClient(id, d); channel.handle(new MovementEvent(id, d)); } - + public Point getClientPosition(Identifier id) { GroupDataModel group = clientsToGroups.get(id); return group.getClientPosition(id); @@ -276,7 +232,7 @@ public int getNumberOfClients() { return clientsToGroups.keySet().size(); } - + public Set<GroupDataModel> getGroups() { Set<GroupDataModel> groups = new LinkedHashSet<GroupDataModel>(); groups.addAll(clientsToGroups.values()); @@ -294,7 +250,7 @@ } return group; } - + /** * Returns a Map<Identifier, Point> representing the latest client * positions. @@ -310,15 +266,15 @@ public int getTokensConsumedBy(Identifier id) { return clientsToGroups.get(id).getCurrentTokens(id); } - + public boolean lockResource(LockResourceRequest event) { // lock resource System.err.println("Modifying lock status for resource: " + event.getResource() + " from station: " + event.getId()); return clientsToGroups.get(event.getId()).lockResource(event); } - + public void unlockResource(UnlockResourceRequest event) { clientsToGroups.get(event.getId()).unlockResource(event); } @@ -329,7 +285,7 @@ GroupDataModel group = clientsToGroups.get(id); group.harvestResource(id, event.getResource()); } - + public void harvestFruits(HarvestFruitRequest event) { Identifier id = event.getId(); GroupDataModel group = clientsToGroups.get(id); @@ -354,49 +310,49 @@ GroupDataModel group = clientsToGroups.get(clientId); return group.getClientDataMap(); } - + public void setGroups(Collection<GroupDataModel> groups) { for (GroupDataModel group: groups) { group.setServerDataModel(this); - + for (Identifier id: group.getClientIdentifiers()) { clientsToGroups.put(id, group); } } } - + /** * Resets this server data model by performing the following: * * 1. Sets event channel to a no-op event channel. */ public void setNullEventChannel() { - super.channel = new EventTypeChannel() { - public void handle(Event event) { } - }; + super.channel = new EventTypeChannel() { + public void handle(Event event) { } + }; } - + public void resetGroupResourceDistributions() { - for (GroupDataModel group: getGroups()) { - group.resetResourceDistribution(); - } + for (GroupDataModel group: getGroups()) { + group.resetResourceDistribution(); + } } - + public void reinitialize() { - setNullEventChannel(); - resetGroupResourceDistributions(); - // initialize all client positions - for (GroupDataModel group: getGroups()) { - for (ClientData clientData: group.getClientDataMap().values()) { - clientData.initializePosition(); - } - } + setNullEventChannel(); + resetGroupResourceDistributions(); + // initialize all client positions + for (GroupDataModel group: getGroups()) { + for (ClientData clientData: group.getClientDataMap().values()) { + clientData.initializePosition(); + } + } } - + public boolean isLastRound() { return getRoundConfiguration().isLastRound(); } - + private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { objectInputStream.defaultReadObject(); for (GroupDataModel group: getGroups()) { @@ -409,4 +365,8 @@ logger = Logger.getLogger( getClass().getName() ); random = new Random(); } + + public void unapply(PersistableEvent persistableEvent) { + logger.warning("unapply() not implemented yet: " + persistableEvent); + } } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2009-10-30 22:18:42 UTC (rev 350) @@ -234,6 +234,7 @@ } }); addEventProcessor(new EventTypeProcessor<DisconnectionRequest>(DisconnectionRequest.class) { + @Override public void handle(DisconnectionRequest event) { synchronized (clients) { logger.warning("Disconnecting client, removing from clients: " + event.getId()); @@ -404,6 +405,7 @@ }); addEventProcessor(new EventTypeProcessor<ShowInstructionsRequest>(ShowInstructionsRequest.class) { public void handle(ShowInstructionsRequest event) { + // FIXME: assign groups? if (event.getId().equals(facilitatorId)) { logger.info("Show Instructions request from facilitator - showing round instructions."); for (Identifier id: clients.keySet()) { @@ -435,11 +437,20 @@ } } }); +// addEventProcessor(new EventTypeProcessor<BeginVotingRequest>(BeginVotingRequest.class) { +// public void handle(BeginVotingRequest request) { +// if (getConfiguration().getCurrentParameters().isVotingEnabled()) { +// +// } +// } +// }); addEventProcessor(new EventTypeProcessor<BeginChatRoundRequest>(BeginChatRoundRequest.class) { public void handle(BeginChatRoundRequest request) { if (getConfiguration().getCurrentParameters().isChatEnabled()) { - // FIXME: need to handle properly corner case where chat is enabled before the first round - + // FIXME: need to handle properly corner case where chat is enabled before the first round // at that point the clients haven't been added to any groups yet. + // probably the best way to handle this is to have the clients added + // to groups when the show instructions request is handled. for (Map.Entry<Identifier, ClientData> entry: clients.entrySet()) { Identifier id = entry.getKey(); ClientData clientData = entry.getValue(); @@ -485,6 +496,7 @@ persister.store(request); } + // FIXME: remove Dispatcher reference if it's unused. public void execute(Dispatcher dispatcher) { switch (serverState) { case ROUND_IN_PROGRESS: Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java 2009-10-29 23:15:38 UTC (rev 349) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java 2009-10-30 22:18:42 UTC (rev 350) @@ -1,14 +1,9 @@ package edu.asu.commons.foraging.util; import java.awt.Dimension; -import java.awt.Graphics2D; import java.awt.Point; -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.Arrays; import java.util.Collection; @@ -20,8 +15,6 @@ import java.util.SortedSet; import java.util.TreeSet; -import javax.swing.JFrame; -import javax.swing.SwingUtilities; import edu.asu.commons.event.ChatRequest; import edu.asu.commons.event.PersistableEvent; @@ -29,7 +22,6 @@ 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.event.ClientPoseUpdate; import edu.asu.commons.foraging.event.HarvestFruitRequest; import edu.asu.commons.foraging.event.HarvestResourceRequest; @@ -37,7 +29,6 @@ import edu.asu.commons.foraging.event.ResourceAddedEvent; import edu.asu.commons.foraging.event.ResourcesAddedEvent; import edu.asu.commons.foraging.event.TokenCollectedEvent; -import edu.asu.commons.foraging.facilitator.GroupView; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; import edu.asu.commons.foraging.model.GroupDataModel; @@ -57,26 +48,25 @@ * @version $Rev$ */ public class ForagingSaveFileConverter { - - + public static boolean convert(String saveDataDirectory) { File allSaveFilesDirectory = new File(saveDataDirectory); if (allSaveFilesDirectory.exists() && allSaveFilesDirectory.isDirectory()) { List<SaveFileProcessor> processors = new ArrayList<SaveFileProcessor>(); processors.addAll(Arrays.asList( - new MovieCreatorProcessor() -// new AllDataProcessor(), -// new AggregateTimeIntervalProcessor(), -// new SummaryProcessor(), -// new CollectedTokenSpatialDistributionProcessor(), -// new MovementStatisticsProcessor() - )); + new AllDataProcessor(), + new AggregateTimeIntervalProcessor(), + new SummaryProcessor(), + new CollectedTokenSpatialDistributionProcessor(), + new MovementStatisticsProcessor(), + new MovieCreatorProcessor() + )); Persister.processSaveFiles(allSaveFilesDirectory, processors); return true; } return false; } - + public static void main(String[] args) { if (args.length == 0) { System.err.println("Usage: java " + ForagingSaveFileConverter.class + " <save-data-directory>"); @@ -84,136 +74,11 @@ } convert(args[0]); } - - private static 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 stream) { - // hmm, there needs to be one output stream per group because we write 1 video per group. - // QuickTimeOutputStream quickTimeOutputStream = new QuickTimeOutputStream(stream, videoFormat); - 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(); - 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-" + groupViewList.size() + "-" + saveFilePath + ".mov"); - groupViewMap.put(groupView, new QuickTimeOutputStream(groupMovieFile, videoFormat)); - } - catch (IOException exception) { - exception.printStackTrace(); - } - JFrame jframe = new JFrame("Group: " + groupViewList.size()); - jframe.add(groupView); - jframe.pack(); - jframe.setVisible(true); - jframes.add(jframe); - } - int secondHasPassedCheck = -1; - // 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); - } - } - for (PersistableEvent event: savedRoundData.getActions()) { - final int elapsedTimeInSeconds = savedRoundData.getElapsedTimeInSeconds(event); - System.err.println("elapsed time in seconds: " + elapsedTimeInSeconds + ":" + event); - serverDataModel.apply(event); - if (elapsedTimeInSeconds > secondHasPassedCheck) { - secondHasPassedCheck = elapsedTimeInSeconds; - // take a snapshot of each group... - 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 { - // currently each frame is 1 second.. maybe we can divvy this up so it's .5 seconds instead. - groupViewMap.get(groupView).writeFrame(bufferedImage, 600); - } - catch (IOException exception) { - exception.printStackTrace(); - throw new RuntimeException(exception); - } - - // write buffered image out to sequentially named file..? -// try { -// ImageIO.write(bufferedImage, videoFormat.name(), new File(elapsedTimeInSeconds + "-group-" + groupViewList.indexOf(groupView) + "." + videoFormat.name())); -// } -// catch (IOException e) { -// e.printStackTrace(); -// throw new RuntimeException(e); -// } - } - }); - } - catch (InterruptedException e) { - e.printStackTrace(); - } - catch (InvocationTargetException e) { - e.printStackTrace(); - } - } - } - } - for (QuickTimeOutputStream out : groupViewMap.values()) { - try { - out.close(); - } - catch (IOException exception) { - exception.printStackTrace(); - } - } - for (JFrame jframe : jframes) { - jframe.setVisible(false); - jframe.dispose(); - } - } - - - @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); - } - } - private static class MovementStatisticsProcessor extends SaveFileProcessor.Base { private Map<Identifier, ClientMovementStatistics> clientStatisticsMap = new LinkedHashMap<Identifier, ClientMovementStatistics>(); private Map<GroupDataModel, Integer> resourceCountMap = new HashMap<GroupDataModel, Integer>(); - + @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); @@ -235,7 +100,6 @@ } else { // stop counting for this group. -// System.err.println("Ignoring movement due to 0 resource count " + movementEvent + resourceCountMap); } } else if (event instanceof ResourcesAddedEvent) { @@ -253,7 +117,6 @@ resourceCountMap.put(groupDataModel, resources - 1); } } -// System.err.println("resource count map: " + resourceCountMap); // tally their very last movement counts // (since ClientMovementStatistics only adds to the movement distribution when they change direction) for (ClientMovementStatistics summary: clientStatisticsMap.values()) { @@ -267,7 +130,7 @@ // write out the header line. writer.println(Utils.join(',', "Identifier", Utils.join(',', Arrays.asList(movementHeader)))); - + // and then write out each Identifier's movement distribution. for (Map.Entry<Identifier, ClientMovementStatistics> entry : clientStatisticsMap.entrySet()) { writer.println(Utils.join(',', entry.getKey(), Utils.join(',', @@ -279,15 +142,15 @@ public String getOutputFileExtension() { return "-movement-summary-statistics.txt"; } - + @Override public void dispose() { clientStatisticsMap.clear(); resourceCountMap.clear(); } - + } - + /** * Helper class to keep track of client movements. */ @@ -298,11 +161,21 @@ private int[] movementDistribution; private int currentMoveCount = 0; private int allMoves; + public ClientMovementStatistics(Identifier id, RoundConfiguration configuration) { this.id = id; int maximumNumberOfMoves = Math.max(configuration.getBoardSize().height, configuration.getBoardSize().width); movementDistribution = new int[maximumNumberOfMoves]; } + + private void incrementMovementDistribution() { + int movementDistributionIndex = Math.min(currentMoveCount, movementDistribution.length-1); + if (movementDistributionIndex > 0) { + movementDistribution[movementDistributionIndex-1]++; + } + currentMoveCount = 1; + } + public synchronized void move(Direction direction) { if (direction != null) { allMoves++; @@ -319,21 +192,15 @@ incrementMovementDistribution(); } } - private void incrementMovementDistribution() { - int movementDistributionIndex = Math.min(currentMoveCount, movementDistribution.length-1); - if (movementDistributionIndex > 0) { - movementDistribution[movementDistributionIndex-1]++; - } - currentMoveCount = 1; - } + public Integer[] getMovementDistribution() { -// return Arrays.copyOf(movementDistribution, movementDistribution.length); Integer[] rv = new Integer[movementDistribution.length]; for (int i = 0; i < movementDistribution.length; i++) { rv[i] = Integer.valueOf(movementDistribution[i]); } return rv; } + public void validate() { int sum = 0; for (int i = 0; i < movementDistribution.length; i++) { @@ -344,7 +211,7 @@ } } } - + private static class CollectedTokenSpatialDistributionProcessor extends SaveFileProcessor.Base { @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { @@ -383,12 +250,12 @@ groupWeightedSpatialMetric /= totalTokens; writer.println(groupWeightedSpatialMetric); } -// for (Map.Entry<Identifier, ClientSpatialDistribution> entry: clientSpatialDistributionMap.entrySet()) { -// Identifier id = entry.getKey(); -// ClientSpatialDistribution spatialDistribution = entry.getValue(); -// spatialDistribution.calculateStandardDeviation(); -// writer.println(String.format("%s, %s", id, spatialDistribution.weightedSpatialMetric)); -// } + // for (Map.Entry<Identifier, ClientSpatialDistribution> entry: clientSpatialDistributionMap.entrySet()) { + // Identifier id = entry.getKey(); + // ClientSpatialDistribution spatialDistribution = entry.getValue(); + // spatialDistribution.calculateStandardDeviation(); + // writer.println(String.format("%s, %s", id, spatialDistribution.weightedSpatialMetric)); + // } } @Override @@ -396,7 +263,7 @@ return "-spatial-distribution.txt"; } } - + private static class ClientSpatialDistribution { private int[] rowCounts; private double standardizedRowDistribution; @@ -424,7 +291,7 @@ standardizedColumnDistribution = (columnStandardDeviation / averageTokens); weightedSpatialMetric = tokens * (rowStandardDeviation + columnStandardDeviation); } - + private double stdDev(int[] counts) { // calculate mean int totalTokensInRow = sum(counts); @@ -445,22 +312,11 @@ return total; } } - + private static class SummaryProcessor extends SaveFileProcessor.Base { @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); - /* - for (GroupDataModel group: new TreeSet<GroupDataModel>(serverDataModel.getGroups())) { - writer.println( - String.format("%s, %s, %s, %s", - group.toString(), - Utils.join(',', new TreeSet<Identifier>(group.getClientIdentifiers())), - group.getResourceDistributionSize(), - Utils.join(',', group.getResourceDistribution().keySet()) - )); - } - */ List<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); for (GroupDataModel group: groups) { int totalConsumedGroupTokens = 0; @@ -471,12 +327,12 @@ } writer.println( String.format("%s, %s, %s, %s", - "Group #" + groups.indexOf(group), - Utils.join(',', clientTokens), - group.getResourceDistributionSize(), - totalConsumedGroupTokens, - Utils.join(',', group.getResourceDistribution().keySet()) - )); + "Group #" + groups.indexOf(group), + Utils.join(',', clientTokens), + group.getResourceDistributionSize(), + totalConsumedGroupTokens, + Utils.join(',', group.getResourceDistribution().keySet()) + )); } // FIXME: should update later once we fix rolling chat logs. Map<GroupDataModel, SortedSet<ChatRequest>> chatRequestMap = new HashMap<GroupDataModel, SortedSet<ChatRequest>>(); @@ -486,10 +342,10 @@ for (ChatRequest request: savedRoundData.getChatRequests()) { // FIXME: hack to deal with rolling chat logs, eventually should only have per-round chat requests // in savedRoundData. -// if (request.getCreationTime() < lastCreationTime) { -// continue; -// } - + // if (request.getCreationTime() < lastCreationTime) { + // continue; + // } + GroupDataModel group = serverDataModel.getGroup(request.getSource()); if (chatRequestMap.containsKey(group)) { chatRequestMap.get(group).add(request); @@ -503,9 +359,9 @@ // FIXME: hack to deal with rolling chat logs // set last creation time to the last chat request that occurred so in the next chat round // we'll know if we repeated a chat request. -// ChatRequest last = allChatRequests.last(); -// lastCreationTime = last.getCreationTime(); -// System.err.println("last creation time: " + lastCreationTime + " - " + last); + // ChatRequest last = allChatRequests.last(); + // lastCreationTime = last.getCreationTime(); + // System.err.println("last creation time: " + lastCreationTime + " - " + last); for (GroupDataModel group: groups) { SortedSet<ChatRequest> chatRequests = chatRequestMap.get(group); if (chatRequests != null) { @@ -524,7 +380,7 @@ return "-summary.txt"; } } - + private static class AllDataProcessor extends SaveFileProcessor.Base { @Override @@ -542,9 +398,9 @@ processData3d(savedRoundData, writer); } } - + private void processData2d(SavedRoundData savedRoundData, PrintWriter writer) { -// RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); + // RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); SortedSet<PersistableEvent> actions = savedRoundData.getActions(); ServerDataModel model = (ServerDataModel) savedRoundData.getDataModel(); Map<Identifier, ClientMovementTokenCount> clientMovementTokenCounts = createClientMovementTokenCounts(model); @@ -564,7 +420,7 @@ client.moves, movementEvent.getDirection(), "movement event" - ); + ); writer.println(line); } else if (event instanceof TokenCollectedEvent) { @@ -581,7 +437,7 @@ location.y, groups.indexOf(group), client.tokens, - "token collected event"); + "token collected event"); writer.println(line); } else if (event instanceof ResourcesAddedEvent) { @@ -642,7 +498,7 @@ resource.getAge(), roundConfiguration.getTokensPerFruits(), clientStats.tokens, - "harvest fruit"); + "harvest fruit"); writer.println(line); } else if (event instanceof HarvestResourceRequest) { @@ -659,15 +515,15 @@ resource.getAge(), roundConfiguration.calculateTokens(resource.getAge()), clientStats.tokens, - "harvest resource"); + "harvest resource"); System.err.println("harvest resource request: " + line); writer.println(line); } } } } - - + + public static class AggregateTimeIntervalProcessor extends SaveFileProcessor.Base { private static int secondsPerInterval = 5; public void process(SavedRoundData savedRoundData, PrintWriter writer) { @@ -681,32 +537,32 @@ RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); TreeSet<Identifier> orderedIdentifiers = new TreeSet<Identifier>(serverDataModel.getClientDataMap().keySet()); List<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); - -// XXX: not really any better than the below, and actually more inefficient to boot. Damn. -// List<String> foo = Utils.map(orderedIdentifiers, new Utils.MapOp<Identifier, String>() { -// public String apply(Identifier id) { -// return id + " movement"; -// } -// }); - + // XXX: not really any better than the below, and actually more inefficient to boot. Damn. + // List<String> foo = Utils.map(orderedIdentifiers, new Utils.MapOp<Identifier, String>() { + // public String apply(Identifier id) { + // return id + " movement"; + // } + // }); + + List<String> movementHeader = new ArrayList<String>(); List<String> collectedTokensHeader = new ArrayList<String>(); for (Identifier id: orderedIdentifiers) { movementHeader.add(id + " moves"); collectedTokensHeader.add(id + " tokens collected"); } - + // headers for average probability of a token for each group -// List<String> tokenProbabilityGroupNumberHeader = new ArrayList<String>(); + // List<String> tokenProbabilityGroupNumberHeader = new ArrayList<String>(); // headers for tokens left in each group -// List<String> tokensLeftGroupNumberHeader = new ArrayList<String>(); + // List<String> tokensLeftGroupNumberHeader = new ArrayList<String>(); List<String> distanceHeader = new ArrayList<String>(); for (int groupIndex = 0; groupIndex < groups.size(); groupIndex++) { String groupNumber = "Group-" + groupIndex; -// tokenProbabilityGroupNumberHeader.add(groupNumber + " avg token P"); -// tokensLeftGroupNumberHeader.add(groupNumber + " tokens left"); + // tokenProbabilityGroupNumberHeader.add(groupNumber + " avg token P"); + // tokensLeftGroupNumberHeader.add(groupNumber + " tokens left"); List<Identifier> ids = new ArrayList<Identifier>(groups.get(groupIndex).getOrderedClientIdentifiers()); for (int i = 0; i < ids.size(); i++) { Identifier id = ids.get(i); @@ -716,28 +572,28 @@ } } } - + // write out the header String header = Utils.join(',', "Period", - // moves taken - Utils.join(',', movementHeader), - // tokens - Utils.join(',', collectedTokensHeader), - // group token probabilities -// Utils.join(',', tokenProbabilityGroupNumberHeader), - // group total tokens left -// Utils.join(',', tokensLeftGroupNumberHeader), - // distance between participants - Utils.join(',', distanceHeader) - ); + // moves taken + Utils.join(',', movementHeader), + // tokens + Utils.join(',', collectedTokensHeader), + // group token probabilities + // Utils.join(',', tokenProbabilityGroupNumberHeader), + // group total tokens left + // Utils.join(',', tokensLeftGroupNumberHeader), + // distance between participants + Utils.join(',', distanceHeader) + ); writer.println(header); - + int currentInterval = 0; for (PersistableEvent event: savedRoundData.getActions()) { int secondsElapsed = savedRoundData.getElapsedTimeInSeconds(event); int endOfInterval = (currentInterval + 1) * secondsPerInterval; -// System.err.println("seconds elapsed: " + secondsElapsed); -// System.err.println("end of interval: " + endOfInterval); + // System.err.println("seconds elapsed: " + secondsElapsed); + // System.err.println("end of interval: " + endOfInterval); // see if the current persistable event is past the threshold, // meaning we should take a snapshot of our currently @@ -757,13 +613,13 @@ stats.reset(); } String dataline = - Utils.join(',', endOfInterval, - Utils.join(',', movesTaken), - Utils.join(',', harvestedTokens), - Utils.join(',', expectedTokenProbabilities), - Utils.join(',', tokensLeft), - Utils.join(',', distances) - ); + Utils.join(',', endOfInterval, + Utils.join(',', movesTaken), + Utils.join(',', harvestedTokens), + Utils.join(',', expectedTokenProbabilities), + Utils.join(',', tokensLeft), + Utils.join(',', distances) + ); writer.println(dataline); currentInterval++; } @@ -821,7 +677,7 @@ } return distances; } - + private List<Double> getExpectedTokenProbabilities(ServerDataModel state) { List<Double> expectedTokens = new ArrayList<Double>(); Set<GroupDataModel> groups = state.getGroups(); @@ -840,7 +696,7 @@ } return expectedTokens; } - + private List<Integer> getTokensLeft(Collection<GroupDataModel> groups) { List<Integer> tokensLeft = new ArrayList<Integer>(); for (GroupDataModel group: groups) { @@ -848,15 +704,15 @@ } return tokensLeft; } - + @Override public String getOutputFileExtension() { return "-aggregated-time-interval-data.txt"; } - + } - + private static class ClientMovementTokenCount { private int moves = 0; private int tokens = 0; @@ -864,7 +720,7 @@ moves = 0; tokens = 0; } - + } public static Map<Identifier, ClientMovementTokenCount> createClientMovementTokenCounts(ServerDataModel model) { Map<Identifier, ClientMovementTokenCount> clientStats = new HashMap<Identifier, ClientMovementTokenCount>(); Added: foraging/trunk/src/main/java/edu/asu/commons/foraging/util/MovieCreatorProcessor.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/util/MovieCreatorProcessor.java (rev 0) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/util/MovieCreatorProcessor.java 2009-10-30 22:18:42 UTC (rev 350) @@ -0,0 +1,150 @@ +package edu.asu.commons.foraging.util; + +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; + +/** + * $Id$ + * + * Foraging save file processor to create quicktime movies. + * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev$ + */ +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 stream) { + // hmm, there needs to be one output stream per group because we write 1 video per group. + // QuickTimeOutputStream quickTimeOutputStream = new QuickTimeOutputStream(stream, videoFormat); + 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(); + 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-" + groupViewList.size() + "-" + saveFilePath + ".mov"); + groupViewMap.put(groupView, new QuickTimeOutputStream(groupMovieFile, videoFormat)); + } + catch (IOException exception) { + exception.printStackTrace(); + } + JFrame jframe = new JFrame("Group: " + groupViewList.size()); + jframe.add(groupView); + jframe.pack(); + jframe.setVisible(true); + jframes.add(jframe); + } + int secondHasPassedCheck = -1; + // 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); + } +... [truncated message content] |
From: Kalin J. <kj...@as...> - 2009-10-29 23:17:18
|
Checking out at 16:00pm(3hr today) It looks like the locations are showing up so that things say Harbor, Bay1, etc. again. Code appears to be synchronized with Seema's. On Thu, Oct 29, 2009 at 2:06 PM, Kalin Jonas <kj...@as...> wrote: > I am coming back at 14:00pm. > Talking to Seema and Allen, will be testing the new code, and starting > looking into the locations problem. > > > On Thu, Oct 29, 2009 at 11:22 AM, Kalin Jonas <kj...@as...> wrote: > >> Checking out at 11:00 for now. I'm pretty sure the error was because the >> daybydaydecisions component was not initialized when it loads. I'm not sure >> why, but I'm changing it now. >> >> >> On Thu, Oct 29, 2009 at 10:13 AM, Kalin Jonas <kj...@as...> wrote: >> >>> Checked out at 14:00(3.25hr yesterday) >>> >>> checking in today at 10:00am. >>> I'll be testing the code, to see if i can replicate the error that seema >>> was getting, and figure out what is causing it. >>> >>> >>> On Wed, Oct 28, 2009 at 1:25 PM, Kalin Jonas <kj...@as...> wrote: >>> >>>> checking back in at 13:15pm >>>> >>>> >>>> On Wed, Oct 28, 2009 at 12:16 PM, Kalin Jonas <kj...@as...> wrote: >>>> >>>>> checking out for lunch at 12:15pm >>>>> >>>>> >>>>> On Wed, Oct 28, 2009 at 9:56 AM, Kalin Jonas <kj...@as...> wrote: >>>>> >>>>>> Today I came in at 9:45am, and have read over the last email Seema >>>>>> sent me. >>>>>> I'll be committing my code and then trying to make the ArrayCollection >>>>>> locations pass between the components. >>>>>> >>>>> >>>>> >>>> >>> >> > |
From: <kj...@us...> - 2009-10-29 23:15:46
|
Revision: 349 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=349&view=rev Author: kjonas Date: 2009-10-29 23:15:38 +0000 (Thu, 29 Oct 2009) Log Message: ----------- Trying to code the passing of the list of locations so that it can be passed later in the experiment if something goes wrong (with small delay only) Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/InstructionPage.mxml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-29 22:38:51 UTC (rev 348) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-29 23:15:38 UTC (rev 349) @@ -17,7 +17,7 @@ <mx:State name="instructionsLoad"> <mx:AddChild relativeTo="{content}"> <comp:InstructionPage id="instructions" initialize="gotoInstructions()" x="0" y="0" - preinitialize="instructions.locations=locations"/> + preinitialize="instructions.setLocations(locations)"/> </mx:AddChild> </mx:State> @@ -422,7 +422,12 @@ { if(event.result is ArrayCollection) { + Alert.show(""+(event.result as ArrayCollection).length,"locations received"); locations = event.result as ArrayCollection; + if(instructions != null) + { + instructions.setLocations(locations); + } } } private function strategyResultHandler(event:ResultEvent):void Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-10-29 22:38:51 UTC (rev 348) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-10-29 23:15:38 UTC (rev 349) @@ -222,6 +222,15 @@ return block; } + public function setLocations(newLocations:ArrayCollection):void + { + locations = newLocations; + if(pageDisplay != null) + { + pageDisplay.locations = newLocations; + } + } + ]]> </mx:Script> Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2009-10-29 22:38:51 UTC (rev 348) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2009-10-29 23:15:38 UTC (rev 349) @@ -143,7 +143,7 @@ { assignGroups(game); getLogger().debug("system has assigned groups. "); - //pushBlock(game); + pushBlock(game); flag = true; } else Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-10-29 22:39:06
|
Revision: 348 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=348&view=rev Author: kjonas Date: 2009-10-29 22:38:51 +0000 (Thu, 29 Oct 2009) Log Message: ----------- Modified the code for creating new locations to try and accommodate the changes to Location class that Seema made. Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/custom/InstructionPage.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastComponent.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -297,7 +297,7 @@ str += ">\n"; } selectCurrentWindows( tempArray ); - Alert.show(str,"Information Windows:"); +// Alert.show(str,"Information Windows:"); } } Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-10-29 22:38:51 UTC (rev 348) @@ -32,9 +32,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -32,9 +32,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -38,9 +38,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -19,9 +19,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastComponent.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastComponent.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastComponent.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -41,9 +41,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -43,9 +43,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -38,9 +38,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -18,9 +18,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -11,9 +11,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-10-29 21:26:06 UTC (rev 347) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-10-29 22:38:51 UTC (rev 348) @@ -53,9 +53,7 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-10-29 21:26:22
|
Revision: 347 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=347&view=rev Author: kjonas Date: 2009-10-29 21:26:06 +0000 (Thu, 29 Oct 2009) Log Message: ----------- Modified Paths: -------------- mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-10-29 21:24:55
|
Revision: 346 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=346&view=rev Author: kjonas Date: 2009-10-29 21:24:47 +0000 (Thu, 29 Oct 2009) Log Message: ----------- fixing DayByDayDecisionsQuestionC.mxml error that Seema was getting Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-10-28 23:13:18 UTC (rev 345) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-10-29 21:24:47 UTC (rev 346) @@ -185,6 +185,10 @@ cumTotal += day.presentTotal; } + if(txtPrompt == null) + { + this.initialize(); + } txtPrompt.text = "It's Day "+(dayByDayContent.numChildren+1)+". Where will you go to fish, or will you stay in the harbor?"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Kalin J. <kj...@as...> - 2009-10-29 21:06:50
|
I am coming back at 14:00pm. Talking to Seema and Allen, will be testing the new code, and starting looking into the locations problem. On Thu, Oct 29, 2009 at 11:22 AM, Kalin Jonas <kj...@as...> wrote: > Checking out at 11:00 for now. I'm pretty sure the error was because the > daybydaydecisions component was not initialized when it loads. I'm not sure > why, but I'm changing it now. > > > On Thu, Oct 29, 2009 at 10:13 AM, Kalin Jonas <kj...@as...> wrote: > >> Checked out at 14:00(3.25hr yesterday) >> >> checking in today at 10:00am. >> I'll be testing the code, to see if i can replicate the error that seema >> was getting, and figure out what is causing it. >> >> >> On Wed, Oct 28, 2009 at 1:25 PM, Kalin Jonas <kj...@as...> wrote: >> >>> checking back in at 13:15pm >>> >>> >>> On Wed, Oct 28, 2009 at 12:16 PM, Kalin Jonas <kj...@as...> wrote: >>> >>>> checking out for lunch at 12:15pm >>>> >>>> >>>> On Wed, Oct 28, 2009 at 9:56 AM, Kalin Jonas <kj...@as...> wrote: >>>> >>>>> Today I came in at 9:45am, and have read over the last email Seema sent >>>>> me. >>>>> I'll be committing my code and then trying to make the ArrayCollection >>>>> locations pass between the components. >>>>> >>>> >>>> >>> >> > |
From: Kalin J. <kj...@as...> - 2009-10-29 18:22:13
|
Checking out at 11:00 for now. I'm pretty sure the error was because the daybydaydecisions component was not initialized when it loads. I'm not sure why, but I'm changing it now. On Thu, Oct 29, 2009 at 10:13 AM, Kalin Jonas <kj...@as...> wrote: > Checked out at 14:00(3.25hr yesterday) > > checking in today at 10:00am. > I'll be testing the code, to see if i can replicate the error that seema > was getting, and figure out what is causing it. > > > On Wed, Oct 28, 2009 at 1:25 PM, Kalin Jonas <kj...@as...> wrote: > >> checking back in at 13:15pm >> >> >> On Wed, Oct 28, 2009 at 12:16 PM, Kalin Jonas <kj...@as...> wrote: >> >>> checking out for lunch at 12:15pm >>> >>> >>> On Wed, Oct 28, 2009 at 9:56 AM, Kalin Jonas <kj...@as...> wrote: >>> >>>> Today I came in at 9:45am, and have read over the last email Seema sent >>>> me. >>>> I'll be committing my code and then trying to make the ArrayCollection >>>> locations pass between the components. >>>> >>> >>> >> > |
From: Kalin J. <kj...@as...> - 2009-10-29 17:13:46
|
Checked out at 14:00(3.25hr yesterday) checking in today at 10:00am. I'll be testing the code, to see if i can replicate the error that seema was getting, and figure out what is causing it. On Wed, Oct 28, 2009 at 1:25 PM, Kalin Jonas <kj...@as...> wrote: > checking back in at 13:15pm > > > On Wed, Oct 28, 2009 at 12:16 PM, Kalin Jonas <kj...@as...> wrote: > >> checking out for lunch at 12:15pm >> >> >> On Wed, Oct 28, 2009 at 9:56 AM, Kalin Jonas <kj...@as...> wrote: >> >>> Today I came in at 9:45am, and have read over the last email Seema sent >>> me. >>> I'll be committing my code and then trying to make the ArrayCollection >>> locations pass between the components. >>> >> >> > |
From: <see...@us...> - 2009-10-28 23:13:26
|
Revision: 345 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=345&view=rev Author: seematalele Date: 2009-10-28 23:13:18 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Figured out the problem with birth year. The problem was it was sending 0 every time. So, changed the line newStudent.birthYear = ((obj as SocioDemographicPage).getYear()) as int; To newStudent.birthYear = (int)((obj as SocioDemographicPage).getYear()); Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-28 21:13:44 UTC (rev 344) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-28 23:13:18 UTC (rev 345) @@ -189,9 +189,9 @@ private function newLocation(maxCapacity:Number,growth:Number):Location { var newLoc:Location = new Location(); - newLoc.maxCapacity = maxCapacity; + //newLoc.maxCapacity = maxCapacity; newLoc.growthRate = growth; - newLoc.initialPopulation = maxCapacity / 2.0; + //newLoc.initialPopulation = maxCapacity / 2.0; return newLoc; } @@ -501,7 +501,7 @@ expiredContent.addChild(obj); var newStudent:actionscript.Student = new actionscript.Student(); - newStudent.birthYear = ((obj as SocioDemographicPage).getYear() as int); + newStudent.birthYear = (int)((obj as SocioDemographicPage).getYear()); newStudent.gender = (obj as SocioDemographicPage).getGender(); newStudent.major = (obj as SocioDemographicPage).getMajor(); newStudent.semester = (obj as SocioDemographicPage).getSemester(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-10-28 21:50:41
|
Revision: 342 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=342&view=rev Author: seematalele Date: 2009-10-28 21:01:17 +0000 (Wed, 28 Oct 2009) Log Message: ----------- 1) Changed the DayByDayDecisions class. Made changes in the DayByDayDecisions.as also. 2) Tested following functions in DayByDayDecisionsService class - saveStudentDecision - allocateStudentForEachBay - Getting NULL pointer exception error in calculateHarvest. Need to solve that. - Other functions related to strategy execution need to be tested. 3) Revised the location entity and its relationship with other entities. Created new relationship between location and group. So for that created new entity named as GroupLocation.java. Created HibernateGroupLocationDao.java and corresponding GroupLocation.as class also. Made changes accordingly in Location.as also. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as mentalmodels/trunk/flex/src/actionscript/Location.as mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/GroupLocation.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGroupLocationDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GroupLocation.java Modified: mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as 2009-10-28 21:01:17 UTC (rev 342) @@ -1,4 +1,4 @@ -package actionscript.questions +package actionscript { import mx.collections.ArrayCollection; @@ -11,7 +11,7 @@ public var location:Location; public var earnings:Number; public var money:Number; - public var student:Student; + public var student:actionscript.Student; public var otherStudents:ArrayCollection; } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/GroupLocation.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/GroupLocation.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/GroupLocation.as 2009-10-28 21:01:17 UTC (rev 342) @@ -0,0 +1,24 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.GroupLocation")] + public class GroupLocation + { + public var id:Number; + + public var location:Location; + + public var currentPopulation:Number; + + public var fishLeaving:Number; + + public var fishReturned:Number; + + public var group:Group; + + public var maxCapacity:Number; + + public var initialPopulation:Number; + + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/Location.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Location.as 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/flex/src/actionscript/Location.as 2009-10-28 21:01:17 UTC (rev 342) @@ -7,12 +7,7 @@ { public var id:Number; public var locationName:String; - public var maxCapacity:int; public var growthRate:Number; - public var initialPopulation:int; - public var currentPopulation:Number; - public var fishLeaving:Number; - public var fishReturned:Number; - public var gameConfig:GameConfig; + } } \ No newline at end of file Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-10-28 21:01:17 UTC (rev 342) @@ -209,23 +209,6 @@ -- Table structure for table `day_by_day_decision` -- -DROP TABLE IF EXISTS `day_by_day_decision`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `day_by_day_decision` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `dayNumber` int(11) NOT NULL, - `earnings` double NOT NULL, - `money` double NOT NULL, - `location_id` bigint(20) NOT NULL, - `student_id` bigint(20) NOT NULL, - PRIMARY KEY (`id`), - KEY `FK5B92B164224FD013` (`location_id`), - KEY `FK5B92B164992B5A41` (`student_id`), - CONSTRAINT `FK5B92B164992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`), - CONSTRAINT `FK5B92B164224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `day_by_day_decision` @@ -383,6 +366,39 @@ UNLOCK TABLES; -- +-- Table structure for table `group_location` +-- + +DROP TABLE IF EXISTS `group_location`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `group_location` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `current_population` double DEFAULT NULL, + `fish_leaving` double DEFAULT NULL, + `fish_return` double DEFAULT NULL, + `initial_population` double NOT NULL, + `max_capacity` double NOT NULL, + `group_id` bigint(20) NOT NULL, + `location_id` bigint(20) NOT NULL, + PRIMARY KEY (`id`), + KEY `FKCFF7B975224FD013` (`location_id`), + KEY `FKCFF7B97565663181` (`group_id`), + CONSTRAINT `FKCFF7B97565663181` FOREIGN KEY (`group_id`) REFERENCES `grp` (`id`), + CONSTRAINT `FKCFF7B975224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `group_location` +-- + +LOCK TABLES `group_location` WRITE; +/*!40000 ALTER TABLE `group_location` DISABLE KEYS */; +/*!40000 ALTER TABLE `group_location` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `grp` -- @@ -439,18 +455,10 @@ /*!40101 SET character_set_client = utf8 */; CREATE TABLE `location` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, - `current_population` double DEFAULT NULL, - `fish_leaving` double DEFAULT NULL, - `fish_return` double DEFAULT NULL, `growth_rate` double NOT NULL, - `initial_population` double NOT NULL, `location_name` varchar(255) NOT NULL, - `max_capacity` double NOT NULL, - `gameConfig_id` bigint(20) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `FK714F9FB55E134D93` (`gameConfig_id`), - CONSTRAINT `FK714F9FB55E134D93` FOREIGN KEY (`gameConfig_id`) REFERENCES `game_config` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -459,6 +467,7 @@ LOCK TABLES `location` WRITE; /*!40000 ALTER TABLE `location` DISABLE KEYS */; +INSERT INTO `location` VALUES (1,0,'Harbor'),(2,0.5,'Bay1'),(3,0.15,'Bay2'),(4,0.05,'Bay3'); /*!40000 ALTER TABLE `location` ENABLE KEYS */; UNLOCK TABLES; @@ -849,4 +858,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-09-28 18:29:10 +-- Dump completed on 2009-10-19 22:05:41 Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDao.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDao.java 2009-10-28 21:01:17 UTC (rev 342) @@ -6,6 +6,7 @@ import org.apache.log4j.Logger; import org.hibernate.Criteria; +import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.criterion.DetachedCriteria; @@ -170,7 +171,7 @@ return logger; } - protected Session getCurrentSession() { + public Session getCurrentSession() { return getSessionFactory().getCurrentSession(); } @@ -209,4 +210,5 @@ Criteria criteria = getCriteria().add(example); return (List<E>) criteria.list(); } + } \ No newline at end of file Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGroupLocationDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGroupLocationDao.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGroupLocationDao.java 2009-10-28 21:01:17 UTC (rev 342) @@ -0,0 +1,13 @@ +package edu.asu.commons.mme.dao; + +import edu.asu.commons.mme.entity.GroupLocation; + +public class HibernateGroupLocationDao extends HibernateDao<GroupLocation>{ + + public HibernateGroupLocationDao() + { + super(GroupLocation.class); + } + + +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java 2009-10-28 21:01:17 UTC (rev 342) @@ -33,10 +33,10 @@ private Location location; //earning will be in pound - @Column(nullable=false) + @Column private Double earnings; - @Column(nullable=false) + @Column private Double money; @ManyToOne @@ -69,7 +69,6 @@ return earnings; } - public void setMoney(Double money) { this.money = money; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-10-28 21:01:17 UTC (rev 342) @@ -52,8 +52,8 @@ /* @OneToMany(mappedBy = "gameConfig") private List<GameRound> gameRounds;*/ - @OneToMany(mappedBy = "gameConfig") - private List<Location> locations; +// @OneToMany(mappedBy = "gameConfig") +// private List<Location> locations; public void setId(Long id) { @@ -93,12 +93,12 @@ public void setImageLocation(String imageLocation) { this.imageLocation = imageLocation; } - public void setLocations(List<Location> locations) { + /*public void setLocations(List<Location> locations) { this.locations = locations; } public List<Location> getLocations() { return locations; - } + }*/ /*public void setGameRounds(List<GameRound> gameRounds) { this.gameRounds = gameRounds; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-10-28 21:01:17 UTC (rev 342) @@ -2,11 +2,13 @@ import java.io.Serializable; +import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +import javax.persistence.OneToMany; import javax.persistence.OrderBy; import javax.persistence.Table; @@ -34,6 +36,9 @@ @JoinColumn(nullable = false) private Game game;*/ + /*@OneToMany(mappedBy="group") + private List<Location> locations;*/ + public Long getId() { return id; } @@ -49,6 +54,14 @@ public void setNumber(Integer no) { this.number = no; } + +/* public void setLocations(List<Location> locations) { + this.locations = locations; + } + + public List<Location> getLocations() { + return locations; + }*/ /*public void setGame(Game game) { this.game = game; Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GroupLocation.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GroupLocation.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GroupLocation.java 2009-10-28 21:01:17 UTC (rev 342) @@ -0,0 +1,113 @@ +package edu.asu.commons.mme.entity; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "group_location") +public class GroupLocation implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -9153306249781210088L; + + @Id + @GeneratedValue + private Long id; + + @ManyToOne + @JoinColumn(nullable=false) + private Location location; + + @Column(name="current_population", scale=2) + private Double currentPopulation; + + @Column(name="fish_leaving", scale=2) + private Double fishLeaving; + + @Column(name="fish_return", scale=2) + private Double fishReturned; + + @ManyToOne + @JoinColumn(nullable=false) + private Group group; + + @Column(nullable=false,name="max_capacity", scale=2) + private Double maxCapacity; + + @Column(nullable=false,name="initial_population", scale=2) + private Double initialPopulation; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setCurrentPopulation(Double currentPopulation) { + this.currentPopulation = currentPopulation; + } + + public Double getCurrentPopulation() { + return currentPopulation; + } + + public void setFishLeaving(Double fishLeaving) { + this.fishLeaving = fishLeaving; + } + + public Double getFishLeaving() { + return fishLeaving; + } + + public void setFishReturned(Double fishReturned) { + this.fishReturned = fishReturned; + } + + public Double getFishReturned() { + return fishReturned; + } + + public void setGroup(Group group) { + this.group = group; + } + + public Group getGroup() { + return group; + } + + public void setLocation(Location location) { + this.location = location; + } + + public Location getLocation() { + return location; + } + + public void setMaxCapacity(Double maxCapacity) { + this.maxCapacity = maxCapacity; + } + + public Double getMaxCapacity() { + return maxCapacity; + } + + public void setInitialPopulation(Double initialPopulation) { + this.initialPopulation = initialPopulation; + } + + public Double getInitialPopulation() { + return initialPopulation; + } + +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-10-28 21:01:17 UTC (rev 342) @@ -6,6 +6,7 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @@ -22,13 +23,13 @@ @Column(nullable=false,name="location_name") private String locationName; - @Column(nullable=false,name="max_capacity", scale=2) - private Double maxCapacity; + /*@Column(nullable=false,name="max_capacity", scale=2) + private Double maxCapacity;*/ @Column(nullable=false,name="growth_rate", scale=2) private Double growthRate; - @Column(nullable=false,name="initial_population", scale=2) + /*@Column(nullable=false,name="initial_population", scale=2) private Double initialPopulation; @Column(name="current_population", scale=2) @@ -38,11 +39,15 @@ private Double fishLeaving; @Column(name="fish_return", scale=2) - private Double fishReturned; + private Double fishReturned;*/ - @ManyToOne + /*@ManyToOne private GameConfig gameConfig; + @ManyToOne + @JoinColumn(nullable=false) + private Group group;*/ + public void setId(Long id) { this.id = id; } @@ -63,7 +68,7 @@ public void setLocationName(String locationName) { this.locationName = locationName; } - public Double getMaxCapacity() { + /*public Double getMaxCapacity() { return maxCapacity; } public void setMaxCapacity(Double maxCapacity) { @@ -97,8 +102,8 @@ public Double getFishReturned() { return fishReturned; } - - public void setGameConfig(GameConfig gameConfig) { +*/ + /*public void setGameConfig(GameConfig gameConfig) { this.gameConfig = gameConfig; } @@ -106,4 +111,11 @@ return gameConfig; } + public void setGroup(Group group) { + this.group = group; + } + + public Group getGroup() { + return group; + }*/ } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java 2009-10-28 21:01:17 UTC (rev 342) @@ -24,7 +24,7 @@ @ManyToOne @JoinColumn(nullable=false) - private Round roundConfig; + private Round round; @ManyToOne @JoinColumn(nullable=false) @@ -61,11 +61,11 @@ } public void setRoundConfig(Round roundconfig) { - this.roundConfig = roundconfig; + this.round = roundconfig; } public Round getRoundConfig() { - return roundConfig; + return round; } public void setStudent(Student student) { @@ -75,7 +75,5 @@ public Student getStudent() { return student; } - - - + } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -4,6 +4,7 @@ import org.springframework.transaction.annotation.Transactional; +import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; import edu.asu.commons.mme.dao.HibernateStudentResponseDao; import edu.asu.commons.mme.dao.HibernateStudentStrategyDao; import edu.asu.commons.mme.entity.DayByDayDecisions; @@ -18,14 +19,18 @@ //private HibernateStudentDao studentDao; private HibernateStudentStrategyDao studentStrategyDao; //private HibernateDayByDayDecisionsDao dayByDayDecisionsDao; - private DayByDayDecisionsService dayByDayDecisionsService; +// private DayByDayDecisionsService dayByDayDecisionsService; private ModuleService moduleService; + private HibernateDayByDayDecisionsDao dayByDayDecisionsDao; - StudentResponse studentResponse; StudentStrategy studentStrategy; Student student; + /** + * This method is for Psychometric, Categorical and text question types. + * @param studentResponses + */ public void saveQuestion(List<StudentResponse> studentResponses) { StudentResponse clientStudentResponse = new StudentResponse(); @@ -45,6 +50,11 @@ } + /** + * this method is for saving strategies of students. + * @param studentStrategies + */ + public void saveStrategy(List<StudentStrategy> studentStrategies) { StudentStrategy clientStudentStrategy = new StudentStrategy(); @@ -63,23 +73,20 @@ } } - public void daybydayOutput(DayByDayDecisions studentDecision) - { - dayByDayDecisionsService.saveStudentDecision(studentDecision); - } + /*public void setDayByDayDecisionsDao(HibernateDayByDayDecisionsDao dayByDayDecisionsDao) { this.dayByDayDecisionsDao = dayByDayDecisionsDao; }*/ - public void setDayByDayDecisionsService(DayByDayDecisionsService dayByDayDecisionsService) { + /*public void setDayByDayDecisionsService(DayByDayDecisionsService dayByDayDecisionsService) { this.dayByDayDecisionsService = dayByDayDecisionsService; } public DayByDayDecisionsService getDayByDayDecisionsService() { return dayByDayDecisionsService; - } + }*/ public void setModuleService(ModuleService moduleService) { this.moduleService = moduleService; @@ -96,4 +103,13 @@ public HibernateStudentStrategyDao getStudentStrategyDao() { return studentStrategyDao; } + + public void setDayByDayDecisionsDao(HibernateDayByDayDecisionsDao dayByDayDecisionsDao) { + this.dayByDayDecisionsDao = dayByDayDecisionsDao; + } + + public HibernateDayByDayDecisionsDao getDayByDayDecisionsDao() { + return dayByDayDecisionsDao; + } + } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -2,15 +2,25 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import org.hibernate.Query; import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; +import edu.asu.commons.mme.dao.HibernateGameDao; +import edu.asu.commons.mme.dao.HibernateGroupDao; +import edu.asu.commons.mme.dao.HibernateGroupLocationDao; +import edu.asu.commons.mme.dao.HibernateLocationDao; +import edu.asu.commons.mme.dao.HibernateStudentDao; import edu.asu.commons.mme.entity.DayByDayDecisions; +import edu.asu.commons.mme.entity.Game; import edu.asu.commons.mme.entity.Group; +import edu.asu.commons.mme.entity.GroupLocation; import edu.asu.commons.mme.entity.Location; +import edu.asu.commons.mme.entity.Student; /*** 1) Harvesting - Find out the amount of fish per agent and calculate the current population after harvesting @@ -35,7 +45,7 @@ 6) Loss: Some fish are lost in the process (e.g. eaten by predatory fish or died in the open ocean). These losses also model reduction of the growth/reproduction rate of overcrowded locations according to a tradi-tional concept of the logistic growth. However, for the pilot experiments the losses are set to 0. For the pilot experiments the losses will be set to 0. To simulate the one-location condition, this parameter can be set to 1. - + totalLeaving = leaving_1 + leaving_2 + leaving_3 totalLoss = totalLeaving \xD7 lossRate totalReturn = totalLeaving \x96 totalLoss @@ -58,25 +68,41 @@ 8) New population: The new fish population, with which the next simulation day starts, is calculated as actualPopulation_i = actualPopulation_i + returning_i -*/ + */ @Transactional public class DayByDayDecisionsService extends Service.Base<DayByDayDecisions, HibernateDayByDayDecisionsDao> { - LocationService locationService; - StudentService studentService; - private List<DayByDayDecisions> studentDecisions = new ArrayList<DayByDayDecisions>(); - private double totalFishLeaving; + HibernateGameDao gameDao; - public void setStudentDecisions(List<DayByDayDecisions> studentDecisions) { - this.studentDecisions = studentDecisions; + public void setGameDao(HibernateGameDao gameDao) { + this.gameDao = gameDao; } - public List<DayByDayDecisions> getStudentDecisions() { - return studentDecisions; + HibernateLocationDao locationDao; + public void setLocationDao(HibernateLocationDao locationDao) { + this.locationDao = locationDao; } + HibernateStudentDao studentDao; + public void setStudentDao(HibernateStudentDao studentDao) { + this.studentDao = studentDao; + } + + HibernateGroupLocationDao groupLocationDao; + public void setGroupLocationDao(HibernateGroupLocationDao groupLocationDao) { + this.groupLocationDao = groupLocationDao; + } + + HibernateGroupDao groupDao; + + public void setGroupDao(HibernateGroupDao groupDao) { + this.groupDao = groupDao; + } + + private double totalFishLeaving; + public double getTotalFishLeaving() { return totalFishLeaving; } @@ -84,17 +110,18 @@ public void setTotalFishLeaving(double totalFishLeaving) { this.totalFishLeaving = totalFishLeaving; } - - public StudentService getStudentService() { - return studentService; - } - public void setStudentService(StudentService studentService) { - this.studentService = studentService; - } + static final String groupsWithinGame = "select distinct student.group from Student student where student.game =:current_game_id "; + static final String studentDecisionsForGame = "SELECT d FROM DayByDayDecisions d, Student s where s.game =:game and s=d.student"; + static final String groupLocation = "SELECT * FROM mme.group_location g where g.group =:group and g.location =:location;"; - public void saveStudentDecision(DayByDayDecisions studentDecision) + public List<DayByDayDecisions> saveStudentDecision(DayByDayDecisions studentDecision,Game game) { + getLogger().debug("Student Id: " + studentDecision.getStudent().getId() + + "Decision is: " + studentDecision.getLocation().getLocationName()); + + List<DayByDayDecisions> studentDecisions = new ArrayList<DayByDayDecisions>(); + if (studentDecisions == null) { studentDecisions = new ArrayList<DayByDayDecisions>(); @@ -102,43 +129,125 @@ } else { - if(!this.studentDecisions.contains(studentDecision)) + if(!studentDecisions.contains(studentDecision)) { studentDecisions.add(studentDecision); + DayByDayDecisions studentDayDecision = new DayByDayDecisions(); + studentDayDecision.setDayNumber(studentDecision.getDayNumber()); + studentDayDecision.setLocation(studentDecision.getLocation()); + studentDayDecision.setStudent(studentDecision.getStudent()); + getDao().save(studentDayDecision); + getLogger().debug("Student Id: " + studentDecision.getStudent().getId() + + "Decision is: " + studentDecision.getLocation().getLocationName() + + "is saved with Id..." + studentDayDecision.getId()); } else { System.out.println("Student Decision already exists!!"); } } + return studentDecisions; + //allocateStudentForEachBay(game,studentDecisions); } - public void allocateStudentForEachBay() + public void allocateStudentForEachBay(Game game) { + + List<DayByDayDecisions> studentDecisions = new ArrayList<DayByDayDecisions>(); + //studentDao.find(gameDao.find(game.getId()); + //studentDecisions = getDao(). + + Query query = getDao().getCurrentSession().createQuery(studentDecisionsForGame); + + query.setEntity("game", game); + + Iterator studentDecisionsIterator = query.list().iterator(); + + //getLogger().debug("student Decision Iterator is " + studentDecisionIterator.hasNext()); + while(studentDecisionsIterator.hasNext()) + { + studentDecisions.add((DayByDayDecisions)studentDecisionsIterator.next()); + // getLogger().info("decision is: " + decision.getId() + "location number: " + decision.getLocation().getLocationName()); + } + DayByDayDecisions studentDecision = new DayByDayDecisions(); + List<DayByDayDecisions> bay1Students = new ArrayList<DayByDayDecisions>(); - List<DayByDayDecisions> bay2Students = new ArrayList<DayByDayDecisions>(); - List<DayByDayDecisions> bay3Students = new ArrayList<DayByDayDecisions>(); - List<DayByDayDecisions> harborStudents = new ArrayList<DayByDayDecisions>(); + //Bay1Service bay1 = new Bay1Service(); + // List<DayByDayDecisions> bay2Students = new ArrayList<DayByDayDecisions>(); + // List<DayByDayDecisions> bay3Students = new ArrayList<DayByDayDecisions>(); + // List<DayByDayDecisions> harborStudents = new ArrayList<DayByDayDecisions>(); + + Map<Long,List<DayByDayDecisions>> bay1StudentMap = new HashMap<Long,List<DayByDayDecisions>>(); + Map<Long,List<DayByDayDecisions>> bay2StudentMap = new HashMap<Long,List<DayByDayDecisions>>(); + Map<Long,List<DayByDayDecisions>> bay3StudentMap = new HashMap<Long,List<DayByDayDecisions>>(); + Map<Long,List<DayByDayDecisions>> harborStudentMap = new HashMap<Long,List<DayByDayDecisions>>(); + for(int i = 0; i < studentDecisions.size(); i++) { studentDecision = studentDecisions.get(i); if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay1")) { - bay1Students.add(studentDecision); + if(!bay1StudentMap.containsKey(studentDecision.getStudent().getGroup().getId() )) + { + //group = decision.getStudent().getGroup(); + List<DayByDayDecisions> decisions = new ArrayList<DayByDayDecisions>(); + decisions.add(studentDecision); + bay1StudentMap.put(studentDecision.getStudent().getGroup().getId(),decisions); + } + else + { + List<DayByDayDecisions> decisions = bay1StudentMap.get(studentDecision.getStudent().getGroup().getId()); + decisions.add(studentDecision); + } + } else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay2")) { - bay2Students.add(studentDecision); + if(!bay2StudentMap.containsKey(studentDecision.getStudent().getGroup().getId() )) + { + //group = decision.getStudent().getGroup(); + List<DayByDayDecisions> decisions = new ArrayList<DayByDayDecisions>(); + decisions.add(studentDecision); + bay2StudentMap.put(studentDecision.getStudent().getGroup().getId(),decisions); + } + else + { + List<DayByDayDecisions> decisions = bay1StudentMap.get(studentDecision.getStudent().getGroup().getId()); + decisions.add(studentDecision); + } + } else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay3")) { - bay3Students.add(studentDecision); + if(!bay3StudentMap.containsKey(studentDecision.getStudent().getGroup().getId() )) + { + //group = decision.getStudent().getGroup(); + List<DayByDayDecisions> decisions = new ArrayList<DayByDayDecisions>(); + decisions.add(studentDecision); + bay3StudentMap.put(studentDecision.getStudent().getGroup().getId(),decisions); + } + else + { + List<DayByDayDecisions> decisions = bay1StudentMap.get(studentDecision.getStudent().getGroup().getId()); + decisions.add(studentDecision); + } } else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Harbor")) { - harborStudents.add(studentDecision); + if(!harborStudentMap.containsKey(studentDecision.getStudent().getGroup().getId() )) + { + //group = decision.getStudent().getGroup(); + List<DayByDayDecisions> decisions = new ArrayList<DayByDayDecisions>(); + decisions.add(studentDecision); + harborStudentMap.put(studentDecision.getStudent().getGroup().getId(),decisions); + } + else + { + List<DayByDayDecisions> decisions = bay1StudentMap.get(studentDecision.getStudent().getGroup().getId()); + decisions.add(studentDecision); + } } } @@ -153,110 +262,220 @@ */ - calculateHarvest(bay1Students,"Bay1"); - calculateHarvest(bay2Students,"Bay2"); - calculateHarvest(bay3Students,"Bay3"); - calculateHarvest(harborStudents,"Harbor"); + // bay1.executeStrategy(); + + //print bay1 map for testing - calculateTotalFishLeaving(); + - calculateFishReturned(); + /*Iterator<Long> keys = bay1StudentMap.keySet().iterator(); + while(keys.hasNext()) + { + Long groupId = keys.next(); + getLogger().info("key is: " + groupId + "values are : " ); + List<DayByDayDecisions> decisions = bay1StudentMap.get(groupId); + for(DayByDayDecisions decision:decisions) + { + getLogger().info("decision is: " + decision.getDayNumber() + "location number: " + decision.getLocation().getLocationName()); + } + + }*/ + - calculateNewPopulation(); + calculateHarvest(bay1StudentMap,"Bay1"); + /**calculateHarvest(bay2StudentMap,"Bay2"); + calculateHarvest(bay3StudentMap,"Bay3"); + calculateHarvest(harborStudentMap,"Harbor"); + calculateTotalFishLeaving(game); + + calculateFishReturned(); + + calculateNewPopulation(); **/ + } //FIXME: max_fish_capacity is hard coded to 5 but actually this value should get from game object - - - public void calculateHarvest(List<DayByDayDecisions> bayStudents,String locationName) + + + public void calculateHarvest(Map<Long, List<DayByDayDecisions>> bay1StudentMap,String locationName) { + // TODO Auto-generated method stub double maxFishCapacity = 5.0; double amountPerAgent = 0.0; double actualPopulation = 0.0; double growth = 0.0; double fishLeaving = 0.0; + Long groupId; + List<DayByDayDecisions> groupStudentDecisions = new ArrayList<DayByDayDecisions>(); + getLogger().debug("bay1StudentMap size is : " + bay1StudentMap.size() + "location name is : " + locationName); + Iterator<Long> keys1 = bay1StudentMap.keySet().iterator(); + while(keys1.hasNext()) + { + Long groupId1 = keys1.next(); + getLogger().info("key is: " + groupId1 + "values are : " ); + List<DayByDayDecisions> decisions = bay1StudentMap.get(groupId1); + for(DayByDayDecisions decision:decisions) + { + getLogger().info("decision is: " + decision.getDayNumber() + "location number: " + decision.getLocation().getLocationName()); + } + + } try { - Location location = locationService.getLocation(locationName); + Iterator<Long> keys = bay1StudentMap.keySet().iterator(); + while(keys.hasNext()) + { + Location location = locationDao.findByProperty("locationName","Bay1"); + groupId = keys.next(); + getLogger().debug("group id is : " + groupId + "location id is: " + location.getId()); + groupStudentDecisions = bay1StudentMap.get(groupId); + Group group = groupDao.find(groupId); - actualPopulation = location.getCurrentPopulation(); + GroupLocation groupLocation = new GroupLocation(); + groupLocation.setLocation(location); + groupLocation.setGroup(group); - //1)Harvesting - //Find out the amount of fish per agent + + List<GroupLocation> groupLocations = groupLocationDao.findByExample(groupLocation); + + getLogger().debug("groupLocations size is: " + groupLocations.size()); - amountPerAgent = maxFishCapacity * location.getCurrentPopulation() / location.getMaxCapacity(); + if(groupLocations.size()== 1) + { + groupLocation = groupLocations.get(0); + } + else + { + //Error, should result only one result + } - if((bayStudents.size() * amountPerAgent) > actualPopulation) - { - amountPerAgent = actualPopulation / bayStudents.size(); - } - //FIXME: allocate this amountPerAgent to each student + //get current population + actualPopulation = groupLocation.getCurrentPopulation(); - //calculate the current population after harvesting - actualPopulation = actualPopulation - bayStudents.size() * amountPerAgent; + //1)Harvesting + //Find out the amount of fish per agent - location.setCurrentPopulation(actualPopulation); + amountPerAgent = maxFishCapacity * groupLocation.getCurrentPopulation() / groupLocation.getMaxCapacity(); - //2)Growth - growth = actualPopulation * location.getGrowthRate(); - getLogger().info("Fish growth at " + locationName + " is: " + growth); + if((groupStudentDecisions.size() * amountPerAgent) > actualPopulation) + { + amountPerAgent = actualPopulation / groupStudentDecisions.size(); + } + //FIXME: allocate this amountPerAgent to each student - //3) Fish leaving location - fishLeaving = actualPopulation * growth / location.getMaxCapacity(); - getLogger().info("Fish leaving at " + locationName + " is: " + fishLeaving); - - location.setFishLeaving(fishLeaving); + //calculate the current population after harvesting + actualPopulation = actualPopulation - groupStudentDecisions.size() * amountPerAgent; - //4) Population after diffusion - actualPopulation = actualPopulation + growth - fishLeaving; - getLogger().info("Fish population at " + locationName + " after diffusion is: " + actualPopulation); - locationService.save(location); - - for(DayByDayDecisions dayByDayDecisions : bayStudents) - { - dayByDayDecisions.setEarnings(amountPerAgent); - Group group = dayByDayDecisions.getStudent().getGroup(); - + groupLocation.setCurrentPopulation(actualPopulation); + + //2)Growth + growth = actualPopulation * location.getGrowthRate(); + getLogger().info("Fish growth at " + locationName + " is: " + growth); + + //3) Fish leaving location + fishLeaving = actualPopulation * growth / groupLocation.getMaxCapacity(); + getLogger().info("Fish leaving at " + locationName + " is: " + fishLeaving); + + groupLocation.setFishLeaving(fishLeaving); + + + //4) Population after diffusion + actualPopulation = actualPopulation + growth - fishLeaving; + getLogger().info("Fish population at " + locationName + " after diffusion is: " + actualPopulation); + groupLocationDao.save(groupLocation); + + for(DayByDayDecisions dayByDayDecision : groupStudentDecisions) + { + + //set earning + dayByDayDecision.setEarnings(amountPerAgent); + + //set money + dayByDayDecision.setMoney(0.0); + + //set other students + + List<Student> otherStudents = new ArrayList<Student>(); + Long currentStudentId = dayByDayDecision.getStudent().getId(); + for(DayByDayDecisions students:groupStudentDecisions) + { + if(students.getStudent().getId() != currentStudentId) + { + otherStudents.add(students.getStudent()); + } + } + + dayByDayDecision.setOtherStudents(otherStudents); + + //Group group = dayByDayDecisions.getStudent().getGroup(); + getDao().save(dayByDayDecision); + } + } - }catch(Exception e) { - getLogger().error(e.fillInStackTrace()); + e.printStackTrace(); } + } - private void calculateTotalFishLeaving() { - + private void calculateTotalFishLeaving(Game game) { + double totalFishLeaving = 0; - - for(Location location : locationService.getAllLocations()) + + + Query query = studentDao.getCurrentSession().createQuery(groupsWithinGame); + + query.setLong("current_game_id", game.getId()); + Iterator groups = query.list().iterator(); + while(groups.hasNext()) { + getLogger().debug("group id is: " + groups.next()); + } + /*List<Student> students = studentDao.findAllByProperty("game", game); + List<Long> groups = null; + for(Student student:students) + { + if(groups == null) + { + groups = new ArrayList<Long>(); + groups.add(student.getGroup().getId()); + } + else if(!groups.contains(student.getGroup().getId())) + { + groups.add(student.getGroup().getId()); + } + } + */ + + /* for(Group group : groups) + { totalFishLeaving = totalFishLeaving + location.getFishLeaving(); } - setTotalFishLeaving(totalFishLeaving); - + setTotalFishLeaving(totalFishLeaving);*/ + } -/**INFO: loss rate is 0 - according to the Dr Tobias' document, loss rate for the pilot experiment is 0 + /**INFO: loss rate is 0 - according to the Dr Tobias' document, loss rate for the pilot experiment is 0 but for single location it will be 1 */ private void calculateFishReturned() { - - double totalLoss = 0.0; + + /*double totalLoss = 0.0; double lossRate = 0.0; double totalReturn = 0.0; double maxFishCapacity = 5.0; double totalReceptivity = 0.0; double receptivity = 0.0; - - + + Map<String,Double> bayReceptivity = new HashMap<String, Double>(); try { - + //calculate loss totalLoss = getTotalFishLeaving() * lossRate; totalReturn = getTotalFishLeaving() - totalLoss; @@ -274,12 +493,12 @@ getLogger().info("Total receptivity is: " + totalReceptivity); //calculte the returning for each bay - /**FOR i = 1 TO 3 + *//**FOR i = 1 TO 3 IF receptivity_total = 0 returning_i = 0 ELSE returning_i = receptivity_i \xD7 totalReturn \xD7 receptivity_i / receptivity_total - END FOR */ + END FOR *//* receptivity = 0.0; for(Location location : locationService.getAllLocations()) { @@ -298,25 +517,18 @@ }catch(Exception e) { e.printStackTrace(); - } + }*/ } - + private void calculateNewPopulation() { - - for(Location location:locationService.getAllLocations()) + + /*for(Location location:locationService.getAllLocations()) { location.setCurrentPopulation(location.getCurrentPopulation() + location.getFishReturned()); getLogger().debug("New population at " + location.getLocationName() + " is: " + location.getCurrentPopulation()); } - + */ } - public LocationService getLocationService() { - return locationService; - } - public void setLocationService(LocationService locationService) { - this.locationService = locationService; - } - } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -14,6 +14,7 @@ import edu.asu.commons.mme.dao.HibernateGameDao; import edu.asu.commons.mme.dao.HibernateGameRoundDao; import edu.asu.commons.mme.dao.HibernateGroupDao; +import edu.asu.commons.mme.dao.HibernateGroupLocationDao; import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.dao.HibernateModuleDao; import edu.asu.commons.mme.dao.HibernateModuleRoundConfigDao; @@ -27,6 +28,7 @@ import edu.asu.commons.mme.entity.GameConfig; import edu.asu.commons.mme.entity.GameRound; import edu.asu.commons.mme.entity.Group; +import edu.asu.commons.mme.entity.GroupLocation; import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Module; import edu.asu.commons.mme.entity.ModuleRoundConfig; @@ -50,6 +52,7 @@ private HibernateGroupDao groupDao; private HibernateStudentDao studentDao; private HibernateLocationDao locationDao; + private HibernateGroupLocationDao groupLocationDao; private int blockSeqNo; @@ -73,7 +76,7 @@ newGameConfig.setNumberOfLocations(gameConfig.getNumberOfLocations()); getGameConfigDao().save(newGameConfig); initializeGameRounds(newGameConfig); - setAllLocations(newGameConfig); + //setAllLocations(newGameConfig); }catch(Exception e) { @@ -111,7 +114,7 @@ newGame.setGameCode(str); getDao().save(newGame); getLogger().info("Created the game: " + newGame.getId()); - setAllLocations(gameConfig); + //setAllLocations(gameConfig); initializeGame(newGame); } }catch(Exception e) @@ -132,18 +135,39 @@ * 4)Once the timer is over, push the next block * */ - public void startGame(Game game) { + public boolean startGame(Game game) { - assignGroups(game); - getLogger().debug("system has assigned groups. "); - pushBlock(game); + boolean flag = false; + + if(isSufficientStudents(game)) + { + assignGroups(game); + getLogger().debug("system has assigned groups. "); + //pushBlock(game); + flag = true; + } + else + { + flag = false; + } + + return flag; } + private boolean isSufficientStudents(Game game) { + // TODO Auto-generated method stub + boolean flag = false; + Game currentGame = getDao().find(game.getId()); + if(getStudentDao().findAllByProperty("game", currentGame).size() > 0) + flag = true; + + return flag; + } + private void pushBlock(Game game) { Game newGameState = null; Block block = null; - boolean running = false; getLogger().info("game start is: " + game.getId()); newGameState = getDao().find(game.getId()); //FIXME: Do not know if this is a right way, I do not think because it will create refrecne to message handler for every block @@ -191,15 +215,7 @@ pushBlock(game); } - private int getNumberOfBlock(Game game) { - // TODO Auto-generated method stub - - //game.getGameConfig() - - return 0; - } - - + public void assignGroups(Game currentGame) { @@ -220,23 +236,14 @@ int noOfGroupsWithSize5=0; int x; - //no of groups noOfGroupsWithSize5=((int)(totalStudents/5)); - - x= totalStudents%5; - /* if(x==0) - { - totalGroups=groupSize5; - } - else*/ if(x==1) { noOfGroupsWithSize5=noOfGroupsWithSize5 - 1; noOfGroupsWithSize3=2; - // totalGroups=groupSize5 + groupSize3; } else if(x==2) @@ -244,18 +251,15 @@ noOfGroupsWithSize5=noOfGroupsWithSize5-1; noOfGroupsWithSize4=1; noOfGroupsWithSize3=1; - // totalGroups=groupSize5 + groupSize3 + groupSize4; } else if(x==3) { noOfGroupsWithSize3=1; - // totalGroups=groupSize3 + groupSize5; } else if(x==4) { noOfGroupsWithSize4=1; - // totalGroups=groupSize4 + groupSize5; } @@ -305,32 +309,9 @@ if(students != null) { - /*MessageBroker msgBroker = MessageBroker.getMessageBroker("_messageBroker"); - - String clientID = UUIDUtils.createUUID(); - AsyncMessage msg = new AsyncMessage(); - msg.setDestination("mme"); - String msgDestination = game.getGameCode(); - msg.setHeader("DSSubtopic", msgDestination); - msg.setClientId(clientID); - msg.setMessageId(UUIDUtils.createUUID()); - msg.setTimestamp(System.currentTimeMillis()); - for(Student student: studentWithGroupsAssigned) - { - initializeStudent(student); - } - msg.setBody(studentWithGroupsAssigned); - System.out.println("Message broker is: "+ msgBroker); - System.out.println("Students size is: " + studentWithGroupsAssigned.size()); - - msgBroker.routeMessageToService(msg, null);*/ msgHandler = new MessageHandler(null); msgHandler.setDestination("mme"); msgHandler.setSubtopic(game.getGameCode()); - /*for(Student student: studentWithGroupsAssigned) - { - initializeStudent(student); - }*/ msgHandler.send(studentWithGroupsAssigned); } } @@ -346,11 +327,13 @@ { //create group Group grp = new Group(); - grp.setNumber(++groupNo); groupDao.save(grp); - getLogger().info("Group is created with id: " + grp.getId()); + + //set all location for the group + setAllLocations(grp,groupSize); + int studentNo = 1; int j = 0; for(int i = 0; i <= groupSize-1 ; i++) @@ -376,11 +359,87 @@ return studentWithGroupsAssigned; } + private void setAllLocations(Group grp, int groupSize) { + // TODO Auto-generated method stub + getLogger().info("in setAllLocations...group size is: " + groupSize); + double maxCapacity = 0.0; + double initCapacity = 0.0; + + + List<Location> locations = new ArrayList<Location>(); + locations = locationDao.findAll(); + for(Location location:locations) + { + getLogger().info("Locations is: " + location.getLocationName()); + GroupLocation groupLocation = new GroupLocation(); + groupLocation.setGroup(groupDao.find(grp.getId())); + if(location.getLocationName().equalsIgnoreCase("bay1")) + { + + groupLocation.setLocation(location); + maxCapacity = 3.0*groupSize; + + groupLocation.setMaxCapacity(maxCapacity); + initCapacity = maxCapacity/2; + + groupLocation.setInitialPopulation(initCapacity); + groupLocation.setCurrentPopulation(initCapacity); + getLogger().info("initiali population set is: " + initCapacity); + groupLocationDao.save(groupLocation); + getLogger().info("group location is created and id is: " + groupLocation.getId()); + } + if(location.getLocationName().equalsIgnoreCase("bay2")) + { + groupLocation.setLocation(location); + maxCapacity = 5.0*groupSize; + + groupLocation.setMaxCapacity(maxCapacity); + initCapacity = maxCapacity/2; + + groupLocation.setInitialPopulation(initCapacity); + groupLocation.setCurrentPopulation(initCapacity); + getLogger().info("initiali population set is: " + initCapacity); + groupLocationDao.save(groupLocation); + getLogger().info("group location is created and id is: " + groupLocation.getId()); + } + if(location.getLocationName().equalsIgnoreCase("bay3")) + { + groupLocation.setLocation(location); + maxCapacity = 10.0*groupSize; + + groupLocation.setMaxCapacity(maxCapacity); + initCapacity = maxCapacity/2; + + groupLocation.setInitialPopulation(initCapacity); + groupLocation.setCurrentPopulation(initCapacity); + getLogger().info("initiali population set is: " + initCapacity); + groupLocationDao.save(groupLocation); + getLogger().info("group location is created and id is: " + groupLocation.getId()); + } + if(location.getLocationName().equalsIgnoreCase("harbor")) + { + groupLocation.setLocation(location); + maxCapacity = 0.0*groupSize; + + groupLocation.setMaxCapacity(maxCapacity); + initCapacity = maxCapacity/2; + + groupLocation.setInitialPopulation(initCapacity); + groupLocation.setCurrentPopulation(initCapacity); + getLogger().info("initiali population set is: " + initCapacity); + groupLocationDao.save(groupLocation); + getLogger().info("group location is created and id is: " + groupLocation.getId()); + } + + } + } + + private void initializeStudent(Student student) { Hibernate.initialize(student); Hibernate.initialize(student.getGame()); Hibernate.initialize(student.getGame().getGameConfig()); - Hibernate.initialize(student.getGame().getGameConfig().getLocations()); + //Hibernate.initialize(student.getGame().getGameConfig().getLocations()); Hibernate.initialize(student.getGroup()); } @@ -407,18 +466,18 @@ getGameConfigDao().save(gameConfig); } - private List<Location> setAllLocations(GameConfig gameConfig) + /*private List<Location> setAllLocations(GameConfig gameConfig) { //FIXME: For the pilot experiment locations are set manually but in future might want to take inputs from user List<Location> locations = new ArrayList<Location>(); try{ Location harbor = new Location(); harbor.setLocationName("Harbor"); - harbor.setCurrentPopulation(0.0); + // harbor.setCurrentPopulation(0.0); harbor.setGrowthRate(0.0); harbor.setInitialPopulation(0.0); harbor.setMaxCapacity(0.0); - harbor.setGameConfig(gameConfig); + //harbor.setGameConfig(gameConfig); getLocationDao().save(harbor); getLogger().info("Saved Location "+harbor.getLocationName()+" with id " + harbor.getId()); locations.add(harbor); @@ -428,8 +487,8 @@ bay1.setCurrentPopulation(5.0); bay1.setInitialPopulation(5.0); bay1.setGrowthRate(0.5); - bay1.setMaxCapacity(10.0); - bay1.setGameConfig(gameConfig); + //bay1.setMaxCapacity(10.0); + //bay1.setGameConfig(gameConfig); getLocationDao().save(bay1); getLogger().info("Saved Location " + bay1.getLocationName() +" with id "+ bay1.getId()); locations.add(bay1); @@ -439,8 +498,8 @@ bay2.setCurrentPopulation(10.0); bay2.setInitialPopulation(10.0); bay2.setGrowthRate(0.15); - bay2.setMaxCapacity(20.0); - bay2.setGameConfig(gameConfig); + //bay2.setMaxCapacity(20.0); + //bay2.setGameConfig(gameConfig); getLocationDao().save(bay2); getLogger().info("Saved Location " + bay2.getLocationName() +" with id "+ bay2.getId()); locations.add(bay2); @@ -450,8 +509,8 @@ bay3.setCurrentPopulation(15.0); bay3.setInitialPopulation(15.0); bay3.setGrowthRate(0.05); - bay3.setMaxCapacity(30.0); - bay3.setGameConfig(gameConfig); + //bay3.setMaxCapacity(30.0); + //bay3.setGameConfig(gameConfig); getLocationDao().save(bay3); getLogger().info("Saved Location " + bay3.getLocationName() +" with id "+ bay3.getId()); locations.add(bay3); @@ -462,7 +521,7 @@ return locations; } - +*/ public Module getNextModule(int sequenceNo) { return getModule(sequenceNo); @@ -688,11 +747,11 @@ GameConfig gameconfig = game.getGameConfig(); Hibernate.initialize(gameconfig); - for(Location location:gameconfig.getLocations()) + /*for(Location location:gameconfig.getLocations()) { Hibernate.initialize(location); - } + }*/ Round round = game.getCurrentRound(); Hibernate.initialize(round); @@ -750,6 +809,7 @@ } } + @SuppressWarnings("unused") private void initializeCurrentBlock(Block block) { Hibernate.initialize(block); @@ -1119,8 +1179,9 @@ return roundService; } + public void setGroupLocationDao(HibernateGroupLocationDao groupLocationDao) { + this.groupLocationDao = groupLocationDao; + } - - } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -35,13 +35,13 @@ public void initializeLocation(Location location) { // TODO Auto-generated method stub Hibernate.initialize(location); - Hibernate.initialize(location.getGameConfig()); + /*Hibernate.initialize(location.getGameConfig()); for(Location loc:location.getGameConfig().getLocations()) { Hibernate.initialize(loc); } - //getLogger().debug("the game rounds for round objects are : " + game.getCurrentRound().getGameRounds().get(0)); +*/ //getLogger().debug("the game rounds for round objects are : " + game.getCurrentRound().getGameRounds().get(0)); } public Location getLocation(String locationName) @@ -61,17 +61,17 @@ return location; } //FIXME: For the pilot experiment locations are set manually but in future might want to take inputs from user - public List<Location> setAllLocations(GameConfig gameConfig) +/* public List<Location> setAllLocations(GameConfig gameConfig) { List<Location> locations = new ArrayList<Location>(); try{ Location harbor = new Location(); harbor.setLocationName("Harbor"); - harbor.setCurrentPopulation(0.0); + //harbor.setCurrentPopulation(0.0); harbor.setGrowthRate(0.0); - harbor.setInitialPopulation(0.0); - harbor.setMaxCapacity(0.0); - harbor.setGameConfig(gameConfig); + //harbor.setInitialPopulation(0.0); + //harbor.setMaxCapacity(0.0); + //harbor.setGameConfig(gameConfig); getDao().save(harbor); getLogger().info("Saved Location "+harbor.getLocationName()+" with id " + harbor.getId()); locations.add(harbor); @@ -81,19 +81,19 @@ bay1.setCurrentPopulation(5.0); bay1.setInitialPopulation(5.0); bay1.setGrowthRate(0.5); - bay1.setMaxCapacity(10.0); - bay1.setGameConfig(gameConfig); + //bay1.setMaxCapacity(10.0); + //bay1.setGameConfig(gameConfig); getDao().save(bay1); getLogger().info("Saved Location " + bay1.getLocationName() +" with id "+ bay1.getId()); locations.add(bay1); Location bay2 = new Location(); bay2.setLocationName("Bay2"); - bay2.setCurrentPopulation(10.0); - bay2.setInitialPopulation(10.0); +// bay2.setCurrentPopulation(10.0); +// bay2.setInitialPopulation(10.0); bay2.setGrowthRate(0.15); - bay2.setMaxCapacity(20.0); - bay2.setGameConfig(gameConfig); + //bay2.setMaxCapacity(20.0); + //bay2.setGameConfig(gameConfig); getDao().save(bay2); getLogger().info("Saved Location " + bay2.getLocationName() +" with id "+ bay2.getId()); locations.add(bay2); @@ -104,7 +104,7 @@ bay3.setInitialPopulation(15.0); bay3.setGrowthRate(0.05); bay3.setMaxCapacity(30.0); - bay3.setGameConfig(gameConfig); + //bay3.setGameConfig(gameConfig); getDao().save(bay3); getLogger().info("Saved Location " + bay3.getLocationName() +" with id "+ bay3.getId()); locations.add(bay3); @@ -114,5 +114,5 @@ } return locations; - } + }*/ } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -138,7 +138,7 @@ private void initializeLocations(GameConfig gameConfig) { - gameConfig.setLocations(locationService.setAllLocations(gameConfig)); + //gameConfig.setLocations(locationService.setAllLocations(gameConfig)); getGameConfigDao().save(gameConfig); } @@ -152,11 +152,11 @@ GameConfig gameconfig = game.getGameConfig(); Hibernate.initialize(gameconfig); - for(Location location:gameconfig.getLocations()) + /*for(Location location:gameconfig.getLocations()) { Hibernate.initialize(location); - } + }*/ Round round = game.getCurrentRound(); Hibernate.initialize(round); Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -61,7 +61,7 @@ Game game = student.getGame(); Hibernate.initialize(game); Hibernate.initialize(game.getGameConfig()); - Hibernate.initialize(game.getGameConfig().getLocations()); + //Hibernate.initialize(game.getGameConfig().getLocations()); Hibernate.initialize(student.getGroup()); } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-28 21:01:17 UTC (rev 342) @@ -1,9 +1,9 @@ package edu.asu.commons.mme.utility; import org.apache.log4j.Logger; + import edu.asu.commons.mme.entity.Block; import edu.asu.commons.mme.entity.Game; -import edu.asu.commons.mme.service.GameService; import edu.asu.commons.mme.service.StartGame; import flex.messaging.MessageBroker; import flex.messaging.messages.AcknowledgeMessage; Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-10-28 21:01:17 UTC (rev 342) @@ -89,6 +89,10 @@ <property name='sessionFactory' ref='sessionFactory'/> </bean> + <bean id='groupLocationDao' class='edu.asu.commons.mme.dao.HibernateGroupLocationDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + <bean id='locationDao' class='edu.asu.commons.mme.dao.HibernateLocationDao'> <property name='sessionFactory' ref='sessionFactory'/> </bean> @@ -118,16 +122,24 @@ <property name='gameConfigDao' ref='gameConfigDao' /> <property name='moduleRoundDao' ref='moduleRoundDao' /> <property name='locationDao' ref='locationD... [truncated message content] |
From: <kj...@us...> - 2009-10-28 21:13:58
|
Revision: 344 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=344&view=rev Author: kjonas Date: 2009-10-28 21:13:44 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Corrected BlockInformationWindow.as and InformationWindow.as to have the right data members. InformationWindowCreator.as calls .invalidateDisplayList() when it updates. appropriate changes in FisheryExperimentShell.mxml to reflect the above. new swf files. Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/actionscript/BlockInformationWindow.as mentalmodels/trunk/flex/src/actionscript/InformationWindow.as mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-10-28 21:10:12 UTC (rev 343) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-10-28 21:13:44 UTC (rev 344) @@ -290,7 +290,7 @@ } else { - var windowID:int = (temp as BlockInformationWindow).infoWindowID; + var windowID:int = (temp as BlockInformationWindow).infoWindow.indexID; tempArray.addItem(windowID); str += "(id:" + windowID + ")"; } Modified: mentalmodels/trunk/flex/src/actionscript/BlockInformationWindow.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/BlockInformationWindow.as 2009-10-28 21:10:12 UTC (rev 343) +++ mentalmodels/trunk/flex/src/actionscript/BlockInformationWindow.as 2009-10-28 21:13:44 UTC (rev 344) @@ -5,11 +5,8 @@ [RemoteClass(alias="edu.asu.commons.mme.entity.BlockInformationWindow")] public class BlockInformationWindow { - public var id:Number; public var sequenceNo:int; - public var infoWindowID:int; public var infoWindow:InformationWindow; - } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/InformationWindow.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/InformationWindow.as 2009-10-28 21:10:12 UTC (rev 343) +++ mentalmodels/trunk/flex/src/actionscript/InformationWindow.as 2009-10-28 21:13:44 UTC (rev 344) @@ -5,13 +5,7 @@ public class InformationWindow { public var id:int; - - public var sequenceNo:int; - + public var indexID:int; public var title:String; - - public var block:Block; - - } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as 2009-10-28 21:10:12 UTC (rev 343) +++ mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as 2009-10-28 21:13:44 UTC (rev 344) @@ -38,40 +38,50 @@ public function updateGoals(saved:ArrayCollection):void { - (goals.getItemAt(0) as CategoricalQuestionC).load(saved.getItemAt(0) as ArrayCollection); - (goals.getItemAt(1) as CategoricalQuestionC).load(saved.getItemAt(1) as ArrayCollection); - (goals.getItemAt(2) as CategoricalQuestionC).load(saved.getItemAt(2) as ArrayCollection); + for(var i:int=0; i<3; i++) + { + (goals.getItemAt(i) as CategoricalQuestionC).load(saved.getItemAt(i) as ArrayCollection); + (goals.getItemAt(i) as CategoricalQuestionC).invalidateDisplayList(); + } } public function updateLearned(saved:ArrayCollection):void { - (learned.getItemAt(0) as TextQuestionC).load(saved.getItemAt(0) as ArrayCollection); - (learned.getItemAt(1) as TextQuestionC).load(saved.getItemAt(1) as ArrayCollection); - (learned.getItemAt(2) as TextQuestionC).load(saved.getItemAt(2) as ArrayCollection); + for(var i:int=0; i<3; i++) + { + (learned.getItemAt(i) as TextQuestionC).load(saved.getItemAt(i) as ArrayCollection); + (learned.getItemAt(i) as TextQuestionC).invalidateDisplayList(); + } } public function updateLearnedWithCommunication(saved:ArrayCollection):void { - (learnedComm.getItemAt(0) as TextQuestionC).load(saved.getItemAt(0) as ArrayCollection); - (learnedComm.getItemAt(1) as TextQuestionC).load(saved.getItemAt(1) as ArrayCollection); - (learnedComm.getItemAt(2) as TextQuestionC).load(saved.getItemAt(2) as ArrayCollection); - (learnedComm.getItemAt(3) as TextQuestionC).load(saved.getItemAt(3) as ArrayCollection); + for(var i:int=0; i<4; i++) + { + (learnedComm.getItemAt(i) as TextQuestionC).load(saved.getItemAt(i) as ArrayCollection); + (learnedComm.getItemAt(i) as TextQuestionC).invalidateDisplayList(); + } } public function updateStrategyDesign(saved:ArrayCollection):void { strategy.load(saved); strategyResults.loadFromStrategy(saved); + + strategy.invalidateDisplayList(); + strategyResults.invalidateDisplayList(); } public function updateForecasting(savedFish:ArrayCollection, savedPeople:ArrayCollection):void { forecasting.load(savedFish, savedPeople); + forecasting.invalidateDisplayList(); } public function updateDayByDayDecisions(saved:ArrayCollection):void { dayByDayResults.load(saved); + dayByDayResults.invalidateDisplayList(); } //// Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-10-28 21:10:37
|
Revision: 343 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=343&view=rev Author: seematalele Date: 2009-10-28 21:10:12 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Put GroupLocation.Java in hibernate.cfg.xml Modified Paths: -------------- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-10-28 21:01:17 UTC (rev 342) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-10-28 21:10:12 UTC (rev 343) @@ -19,8 +19,8 @@ <mapping class='edu.asu.commons.mme.entity.Communication'/> <mapping class='edu.asu.commons.mme.entity.Group'/> <mapping class='edu.asu.commons.mme.entity.Student'/> + <mapping class='edu.asu.commons.mme.entity.GroupLocation'/> - <mapping class='edu.asu.commons.mme.entity.StudentRoundConfig'/> <mapping class='edu.asu.commons.mme.entity.StudentStrategy'/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Kalin J. <kj...@as...> - 2009-10-28 20:26:05
|
checking back in at 13:15pm On Wed, Oct 28, 2009 at 12:16 PM, Kalin Jonas <kj...@as...> wrote: > checking out for lunch at 12:15pm > > > On Wed, Oct 28, 2009 at 9:56 AM, Kalin Jonas <kj...@as...> wrote: > >> Today I came in at 9:45am, and have read over the last email Seema sent >> me. >> I'll be committing my code and then trying to make the ArrayCollection >> locations pass between the components. >> > > |
From: Kalin J. <kj...@as...> - 2009-10-28 19:16:16
|
checking out for lunch at 12:15pm On Wed, Oct 28, 2009 at 9:56 AM, Kalin Jonas <kj...@as...> wrote: > Today I came in at 9:45am, and have read over the last email Seema sent me. > I'll be committing my code and then trying to make the ArrayCollection > locations pass between the components. > |
From: <see...@us...> - 2009-10-28 19:01:45
|
Revision: 341 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=341&view=rev Author: seematalele Date: 2009-10-28 19:01:39 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Changed the filed name indexId to IndexID Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/InformationWindow.java Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/InformationWindow.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/InformationWindow.java 2009-10-28 18:48:36 UTC (rev 340) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/InformationWindow.java 2009-10-28 19:01:39 UTC (rev 341) @@ -23,7 +23,7 @@ private Long id; @Column(name="indexId",nullable=false) - private Long indexId; + private Long indexID; @Column(name="title",nullable=false) private String title; @@ -56,12 +56,12 @@ return blockInfoWindows; } - public void setIndexId(Long indexId) { - this.indexId = indexId; + public void setIndexID(Long indexID) { + this.indexID = indexID; } - public Long getIndexId() { - return indexId; + public Long getIndexID() { + return indexID; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-10-28 18:48:51
|
Revision: 340 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=340&view=rev Author: kjonas Date: 2009-10-28 18:48:36 +0000 (Wed, 28 Oct 2009) Log Message: ----------- new swf files Modified Paths: -------------- mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-10-28 17:42:26
|
Revision: 339 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=339&view=rev Author: kjonas Date: 2009-10-28 17:42:18 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Added error-checking so that the Instruction Pages are not updated with information that doesn't exist (information.saved* is null) increased duration to 20s Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-27 06:53:06 UTC (rev 338) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-28 17:42:18 UTC (rev 339) @@ -11,7 +11,6 @@ x="{(content.width-socioDemographic.width)/2}" y="{(content.height-socioDemographic.height)/2}"/> </mx:AddChild> - <mx:SetProperty target="{content}" name="x"/> <mx:SetStyle target="{content}" name="horizontalCenter" value="0"/> </mx:State> @@ -35,7 +34,9 @@ </mx:State> <mx:State name="none"> - <mx:RemoveChild target="{instructions}"/> + <!--<mx:RemoveChild target="{instructions}"/>--> + <mx:AddChild relativeTo="{expiredContent}" target="{instructions}"/> + <mx:SetProperty target="{instructions}" name="visible" value="false"/> <mx:AddChild relativeTo="{content}"> <mx:Label id="end" text="Thank you for playing!" fontSize="30"/> </mx:AddChild> @@ -332,13 +333,23 @@ private function saveDataToShell():void { - shell.updateObjectA.updateDayByDayDecisions(instructions.savedDayByDayDecisions); - shell.updateObjectA.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); - shell.updateObjectA.updateStrategyDesign(instructions.savedStrategyDesign); + if(instructions.savedDayByDayDecisions != null) + { + shell.updateObjectA.updateDayByDayDecisions(instructions.savedDayByDayDecisions); + shell.updateObjectB.updateDayByDayDecisions(instructions.savedDayByDayDecisions); + } - shell.updateObjectB.updateDayByDayDecisions(instructions.savedDayByDayDecisions); - shell.updateObjectB.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); - shell.updateObjectB.updateStrategyDesign(instructions.savedStrategyDesign); + if(instructions.savedForecastFish != null && instructions.savedForecastPeople != null) + { + shell.updateObjectA.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); + shell.updateObjectB.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); + } + + if(instructions.savedStrategyDesign != null) + { + shell.updateObjectA.updateStrategyDesign(instructions.savedStrategyDesign); + shell.updateObjectB.updateStrategyDesign(instructions.savedStrategyDesign); + } } private function loadNextBlock(nextBlock:Block):void @@ -359,6 +370,7 @@ || currentBlock.questionGroups.length < 1) { currentState = "none"; + Alert.show("block is null or no question groups"); return; } @@ -377,30 +389,30 @@ shell.setProgressBarTime(0,0,currentBlock.duration); shell.progressBarInit(); } - private function moduleResultHandler(event:ResultEvent):void - { - currentModule = (event.result as actionscript.Module); - - if(currentModule == null) - { - currentState = "none"; - } - else if(currentModule.blocks == null || currentModule.blocks.length < 1 || - (currentModule.blocks.getItemAt(0) as Block) == null || - (currentModule.blocks.getItemAt(0) as Block).questionGroups == null || - (currentModule.blocks.getItemAt(0) as Block).questionGroups.length < 1) - { - currentState = "none"; - } - else if(!instructionsLoaded) - { - currentState = "instructionsLoad"; - } - else - { - gotoInstructions(); - } - } +// private function moduleResultHandler(event:ResultEvent):void +// { +// currentModule = (event.result as actionscript.Module); +// +// if(currentModule == null) +// { +// currentState = "none"; +// } +// else if(currentModule.blocks == null || currentModule.blocks.length < 1 || +// (currentModule.blocks.getItemAt(0) as Block) == null || +// (currentModule.blocks.getItemAt(0) as Block).questionGroups == null || +// (currentModule.blocks.getItemAt(0) as Block).questionGroups.length < 1) +// { +// currentState = "none"; +// } +// else if(!instructionsLoaded) +// { +// currentState = "instructionsLoad"; +// } +// else +// { +// gotoInstructions(); +// } +// } public function getLocation():void { @@ -543,4 +555,3 @@ </mx:Script> </mx:Canvas> - Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-27 06:53:06 UTC (rev 338) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-28 17:42:18 UTC (rev 339) @@ -79,7 +79,7 @@ { //int duration = block.getDuration(); - int duration = 5; + int duration = 20; Timer timer = new Timer(); Long startTime = System.currentTimeMillis()/1000; System.out.println("Started time is : " + System.currentTimeMillis()/1000); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Kalin J. <kj...@as...> - 2009-10-28 16:56:36
|
Today I came in at 9:45am, and have read over the last email Seema sent me. I'll be committing my code and then trying to make the ArrayCollection locations pass between the components. |
From: <al...@us...> - 2009-10-27 06:53:19
|
Revision: 338 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=338&view=rev Author: alllee Date: 2009-10-27 06:53:06 +0000 (Tue, 27 Oct 2009) Log Message: ----------- updated configuration for indiana pretest Modified Paths: -------------- irrigation/trunk/build.properties.example irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round0.xml Added Paths: ----------- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round1.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round10.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round11.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round12.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round13.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round14.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round15.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round16.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round2.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round3.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round4.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round5.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round6.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round7.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round8.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round9.xml Modified: irrigation/trunk/build.properties.example =================================================================== --- irrigation/trunk/build.properties.example 2009-10-27 06:36:01 UTC (rev 337) +++ irrigation/trunk/build.properties.example 2009-10-27 06:53:06 UTC (rev 338) @@ -20,7 +20,7 @@ # part of the URL you can just set the server.address and leave this property # blank since the build.xml that loads this properties file sets the codebase # url to the ${server.address} + "/foraging" by default. -codebase.url=http://${server.address}:8080/ +codebase.url=http://${server.address}:8080/irrigation # set to whatever port you want the Java experiment server to run on (this is # *not* the webserver port, this is the experiment server port used to Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,722 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment server configuration</comment> +<entry key="hostname">@SERVER_ADDRESS@</entry> +<entry key="port">@PORT_NUMBER@</entry> +<entry key="round0">round0.xml</entry> +<entry key="round1">round1.xml</entry> +<entry key="round2">round2.xml</entry> +<entry key="round3">round3.xml</entry> +<entry key="round4">round4.xml</entry> +<entry key="round5">round5.xml</entry> +<entry key="round6">round6.xml</entry> +<entry key="round7">round7.xml</entry> +<entry key="round8">round8.xml</entry> +<entry key="round9">round9.xml</entry> +<entry key="round10">round10.xml</entry> +<entry key="round11">round11.xml</entry> +<entry key="round12">round12.xml</entry> +<entry key="round13">round13.xml</entry> +<entry key="round14">round14.xml</entry> +<entry key="round15">round15.xml</entry> +<entry key="round16">round16.xml</entry> + +<entry key="wait-for-participants">true</entry> +<entry key="number-of-rounds">17</entry> + +<entry key="q1">4</entry> +<entry key="q2">identity</entry> +<entry key="q3">49</entry> +<entry key="q4">76</entry> +<entry key="q5">20</entry> +<entry key="q6">5</entry> +<entry key="q7">25</entry> +<entry key="q8">7</entry> +<entry key="q9">19</entry> +<entry key="q10">1.50</entry> + +<entry key='final-instructions'> +<![CDATA[ +<p> +The experiment is almost over. We have a brief survey for you to fill out while the +facilitator prepares your payments. When the facilitator has finished preparing +payments and you have all completed your surveys your computer number will be +called. You can then go next door to receive your payment. For privacy reasons we +must pay you one at a time. +</p> +<p> +Thanks for participating! +</p> +]]> +</entry> + + +<entry key="initial-instructions"> +<![CDATA[ +<h3>Welcome</h3> +<p> +Please be patient while the experimental environment is set up. +<b>Please do not close this window or open any other windows.</b> +</p> +]]> +</entry> + + +<entry key="facilitator-instructions"> +<![CDATA[ +<h3>Facilitator Instructions</h3> +<p> +Welcome to the facilitator interface. This interface allows you to control +the experiment. You may only modify configuration parameters <b>before</b> +you start the experiment by selecting the Configuration menu. When all the +participants are ready to begin the experiment, you can start the experiment +by selecting Experiment -> Start. After a round has been completed you +will be able to view the statistics for all of the participants. You can +begin the next round by selecting Round -> Start. +</p> +]]> +</entry> + + + +<entry key="general-instructions0"> +<![CDATA[ +<center><h3>Welcome to the experiment. Please do not close this window or open any +other applications.</h3></center> +]]> +</entry> + +<entry key="general-instructions1"> +<![CDATA[ +<h3>General Instructions</h3> +<p>Welcome. You have already earned 5 dollars by showing up for this exercise. +You can earn more, up to an extra 25 dollars, by participating in the exercise +which will last for about one hour. You will participate in this exercise as a +part of a group. Each group has five participants. Your group has been formed +by randomly assigning you to FOUR other participants in the room. The amount +of money you earn will depend on the decisions made by you and the rest of the +group. That is, your earnings will depend on your decisions as well as the +other members of your group. +</p> +<p> +This exercise mimics decisions people make in irrigation systems. In each round you +will receive 10 tokens which you can choose to keep or invest in the irrigation +infrastructure (for example canals and water diversion structures). Depending on the +state of repair of the irrigation infrastructure, it will be capable of directing +water to your field when you use your water diversion structure (called an +irrigation gate). Depending on the amount of water you can get to your field, you +can grow crops. Depending on the number of crops you grow you earn tokens. Each +token is worth 5 cents and you will be paid cash in private at the end of the +experiment based on the number of tokens you earned. +</p> +<p> +The experiment consists of a number of rounds. In each round you will first make a +decision as to how much to invest in the irrigation infrastructure. Without periodic +investment, the irrigation infrastructure will break down over time. Based on the +combined contributions of all 5 participants in your group in each round, as +explained below, your group can maintain the performance of the irrigation +infrastructure. The condition of the irrigation infrastructure determines +its capacity to deliver water which you can use to grow crops. +</p> +]]> +</entry> + +<entry key="general-instructionsq1"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +How many OTHER people in the room will be in your group?<br> +<input type="radio" name="q1" value="0">0<br> +<input type="radio" name="q1" value="1">1<br> +<input type="radio" name="q1" value="4">4<br> +<input type="radio" name="q1" value="Everybody">Everybody<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions2"> +<![CDATA[ +<h3>Chat</h3> +<p>Before each round you will have a chat period of 40 seconds where you can send +text messages to the other participants. You may discuss any aspect of the exercise +with two important exceptions: +</p> +<ol> +<li>You are <b>not allowed</b> to promise the other participants +side-payments or threaten them with any consequence after the experiment is +finished. +</li> +<li>You are <b>not allowed to reveal your real identity</b>.</li> +</ol> +<p> +We will be monitoring the chat traffic. If we detect any violation of these rules, +we will have to remove <b>all members of the group where the violation occurred</b> +from the experiment. That group will have to wait until the entire experiment is +finished to receive their payment. +</p> +<p> +You will see a text box appear on your screen when a chat period starts. The amount +of time left in the chat period will be shown at the <b>top left of the screen</b>.<br> +</p> +]]> +</entry> + +<entry key="general-instructionsq2"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +Which of the following topics are you <b>not allowed</b> to discuss in chat?<br> +<input type="radio" name="q2" value="weather">the weather<br> +<input type="radio" name="q2" value="identity">your real identity<br> +<input type="radio" name="q2" value="experiment">the experiment<br> +<input type="radio" name="q2" value="earnings">what you will do with the money you earn from this experiment<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions3"> +<![CDATA[ +<h3>Creating Irrigation Infrastructure</h3> +<p> +After the chat period ends you and each other participant will be given 10 tokens. +You must then decide what to do with these tokens. You may decide to invest in the +irrigation infrastructure or to keep the tokens. If you keep the tokens you will +earn at a minimum 10 tokens X 5 cents = $0.50 for each round. If you do this every +round after twenty rounds you will end up with at least $10 (plus any crops that you +may be able to grow as we will discuss later). Your total earnings for +participating in the experiment would then be at least $10 plus your show-up payment +of $5, for a grand total of at least $15. +</p> +<p> +On the other hand, if you invest some of your tokens in the irrigation +infrastructure, you may be able to earn more than this amount by growing crops. If +the irrigation infrastructure is operating at near maximum capacity you can earn +close to $1.50 each round. Thus if you grow crops you can roughly triple your +earnings compared to doing nothing. The actual earnings depend on the decisions you +and the other participants in your group make in terms of investment and when to +grow crops. +</p> +<p> +In each round the condition of the irrigation system declines such that its water +delivery efficiency drops by 25%. Investment is necessary to keep the irrigation +infrastructure from deteriorating. If you decide to invest in irrigation +infrastructure you must decide on the amount to invest out of your initial 10 +tokens. Keep in mind that the irrigation infrastructure must exceed a certain level +before you can grow crops. The tokens invested by all participants in your group +are added together and will total up to an amount 0 and 50 tokens. Each token +invested increases the irrigation infrastructure efficiency by one percentage point, +up to a <b>maximum of 100%</b>. This means that if the irrigation infrastructure +efficiency is at 80% it would not make sense for your group to invest a total of 50 +tokens, as any investment beyond 20 tokens would be wasted. In the table below you +can see the water delivery capacity measured in water units per second as a function +of the condition of the irrigation infrastructure. When the infrastructure is at +100% efficiency, 40 cubic feet of water per second (cfps) will be available. When the +irrigation infrastructure efficiency falls below 45%, there is no capacity left for +transporting water and thus there is no water available for anyone. +</p> +<p> +Your initial irrigation infrastructure will start at 75% efficiency but <b>will +carry over from round to round</b>. As an example, let's say that no one in a +group invests any tokens in the first round. The irrigation infrastructure +efficiency will be set at 75% for that first round. The table below lists the water +delivery in cubic feet per second (cfps) corresponding to the irrigation infrastructure +efficiency. If you look at the second to last row you can see that at 75% +efficiency the irrigation infrastructure will deliver 35 cfps. So in the first +round the group will have 35 cfps of water available to them. +</p> +<p> +Recall that each round the irrigation infrastructure efficiency deteriorates by 25%, +so at the start of the second round the infrastructure efficiency decreases to 50%. +At this point all five members of the group decide to invest 7 tokens each. This +increases the infrastructure efficiency by 35%, resulting in a total infrastructure +efficiency of 85%. If you look at the table again you can see that an +infrastructure efficiency of 85% will deliver 40 cfps. +</p> +<p> +The actual amount of water that is available for the group depends on the amount of +water available. Your group might have created an irrigation infrastructure with a +capacity of 40 cfps, but due to lack of rainfall only 30 cfps is available. On the +other hand, if the infrastructure capacity allows 30 cfps and 40 cfps of water is available +to the system, only 30 cfps can be delivered. +</p> + +<p> +To recap, at the beginning of each round you will be informed of the current +irrigation infrastructure efficiency. You will then decide how many tokens (between +0 and 10) to invest in the irrigation infrastructure. After everybody has made +their decision, you will be notified of the condition of the irrigation +infrastructure and the corresponding water delivery capacity. +</p> + +<b>Table 1:</b> The water delivery capacity as a function of the irrigation +infrastructure condition +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Infrastructure efficiency (percent)</th> +<th>Water delivery (cubic feet per second)</th> +</thead> +<tr> +<td>≤ 45</td><td>0</td> +</tr> +<tr> +<td>46-51</td><td>5</td> +</tr> +<tr> +<td>52-55</td><td>10</td> +</tr> +<tr> +<td>56-58</td><td>15</td> +</tr> +<tr> +<td>59-61</td><td>20</td> +</tr> +<tr> +<td>62-65</td><td>25</td> +</tr> +<tr> +<td>66-70</td><td>30</td> +</tr> +<tr> +<td>71-80</td><td>35</td> +</tr> +<tr> +<td>81-100</td><td>40</td> +</tr> +</table> + +]]> +</entry> + +<entry key="general-instructionsq3"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following questions:<br> +<form> +Question 1:<br> +Given an existing infrastructure efficiency of 20%, if the five participants invest +a <b>total of 29 additional tokens</b>, what is the new irrigation infrastructure +efficiency? +(<small><b>Note: only enter a number, you don't need to add the % sign</b></small>)<br> +<input type="text" name="q3" value = ""> +<br><br> + +Question 2:<br> +Given an existing infrastructure efficiency of 50%, if <b>two participants invest 10 tokens each</b> +while the <b>three other participants invest 2 tokens each</b>, what is the new +irrigation infrastructure efficiency? +(<b>Note: only enter a number, you don't need to add the % sign</b>)<br> +<input type="text" name="q4" value = ""> +<br><br> +<input type="submit" name="submit" value="Submit"><br> +<br> +</form> +]]> +</entry> + +<entry key="general-instructions4"> +<![CDATA[ +<h3>Growing crops</h3> +<p>There are <b>five</b> participants in each group, each of which is randomly assigned to +one of the five positions, A, B, C, D or E. Below is a screenshot of the +graphical interface representation of the irrigation system. Water comes from +the box to the left and the five players are located from upstream (leftmost) +to downstream (rightmost) accordingly. To illustrate, assume you are in +position C. The black lines represent "gates" that you open and close by +clicking on the large button on the lower left corner of the screen. +Each round consists of 50 seconds and the amount of time left in the +experiment is indicated by a bar at the top of the screen. +</p> +<img src="http://dev.commons.asu.edu/irrigation/images/game-interface-screenshot.jpg"> +<br><br> +<p> +You can irrigate your field during the round by opening your gate. Your +earnings depend on the amount of water you can draw onto your fields and will +be explained in more detail on the next page. The speed at which you can grow +a crop depends on the amount of water available to you <b>at the time that you +open your gate</b>. The maximum flow capacity of the main canal shared by A, +B, C, D, and E is forty cubic feet per second. +</p> +<p> +The maximum amount of water that can flow through your gate when it is opened +is 25 cubic feet per second. If other people are using the canal, the water +flow available to you might be less, and it may take longer to get water to +your field since you are also limited by the amount of water that is flowing +through the shared canal. +</p> +]]> +</entry> + +<entry key="general-instructionsq4"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +Question 3:<br> +<form> +What is the minimum time to deliver 500 cubic feet of water to your field when +your maximum water flow capacity is available? +<br> +<input type="radio" name="q5" value="12.5">12.5 seconds<br> +<input type="radio" name="q5" value="20">20 seconds<br> +<input type="radio" name="q5" value="25">25 seconds<br> +<input type="radio" name="q5" value="50">50 seconds<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + + +<entry key="general-instructions5"> +<![CDATA[ +<h3>Positions A,B,C,D and E</h3> +<p> +The animation above illustrates how water flows to each player when their gates are +opened and closed. When a player opens their gate, the black line will rotate to a +vertical position, allowing water (represented by white dots) to flow to them. Note +that the water available downstream of a player with an open port is reduced, +illustrated by a narrowing of the canal. +</p> +<p> +Access to water depends on your position as shown in the window. Water originates +in the box at the upper left part of the screen and travels to the right. Thus, +participant A will have first access to the available water. Water not used by +participant A is then available to be used by participant B. Water not used by +participants A and B is then available for C. Water not used by participants A, B +and C is available for D. Finally, water not used by participants A, B, C and D is +available for E. +</p> +<p> +You can only get water to your field if you have water available to your position. +Suppose that the total irrigation capacity available is 40 cfps and 40 cfps of water +is available. If player A opens their gate they will consume 25 cfps of water and 15 +cfps is left for B. Suppose on the other hand, A does not open the gate, then a +total of 40 cfps is left for B, allowing B to extract water at the maximum rate of +25 cfps. +</p> +<p> +As another example, suppose that the canal system has been allowed to deteriorate +so that the total irrigation capacity available is 20 cfps. While player A’s gate is +open, no water is available for B. If A is NOT using water, 20 cfps is available for +B. +</p> +]]> +</entry> + +<entry key="general-instructionsq5"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +Suppose the irrigation efficiency is between 71 and 80% so that the canal flow +capacity is 30 cfps. If A opens their gate and diverts water at 25 cfps what is the +available water flow for B? +<br> +<input type="radio" name="q6" value="30">30 cfps<br> +<input type="radio" name="q6" value="25">25 cfps<br> +<input type="radio" name="q6" value="15">15 cfps<br> +<input type="radio" name="q6" value="5">5 cfps<br> +<br><br> +If the canal flow capacity available is 25 cfps and A,B,C and D are not using water, +what is the available water for E? +<br> +<input type="radio" name="q7" value="40">40 cfps<br> +<input type="radio" name="q7" value="25">25 cfps<br> +<input type="radio" name="q7" value="15">15 cfps<br> +<input type="radio" name="q7" value="0">0 cfps<br> + +<input type="submit" name="submit" value="Submit"> +<br><br> +</form> +]]> +</entry> + +<entry key="general-instructions6"> +<![CDATA[ +<h3>How to grow crops</h3> +<p> +To start growing crops, click on the yellow button labeled "open gate". +This will open your irrigation gate and allow water to flow to your field if it is +available. The text on the button will change to "close gate" - if +you would like to close the gate and stop extracting water from the canal, just +click on the yellow button again. Your gate will close and the text on the button +will change back to "open gate". +</p> +<p> +The amount of water units (cubic feet) your field has received is shown on the +screen, as well as the resulting amount of tokens earned from growing a crop. +The number of tokens earned in each round depends on how much water you have +diverted to your field. If you receive less than 150 cubic feet (cf) the crop has +not received enough water to grow a crop and you will thus not receive any tokens. +The maximum earnings are received when between 500 cf and 549 cf are diverted to +your field. If more than 549 cf water is diverted to your field, this will +negatively affect the growth of the crop (i.e. overwatering) and less tokens will be +earned. In the table below you can see the amount of tokens earned for amount of +water applied to your field. +</p> +<b>Table 2</b>: Earnings resulting from the amount of water applied to your field. + +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Water units received (cubic feet)</th> +<th>Tokens earned</th> +</thead> +<tr> +<td>< 150</td><td>0</td> +</tr> +<tr> +<td>150-199</td><td>1</td> +</tr> +<tr> +<td>200-249</td><td>4</td> +</tr> +<tr> +<td>250-299</td><td>10</td> +</tr> +<tr> +<td>300-349</td><td>15</td> +</tr> +<tr> +<td>350-399</td><td>18</td> +</tr> +<tr> +<td>400-499</td><td>19</td> +</tr> +<tr> +<td>500-549</td><td>20</td> +</tr> +<tr> +<td>550-649</td><td>19</td> +</tr> +<tr> +<td>650-699</td><td>18</td> +</tr> +<tr> +<td>700-749</td><td>15</td> +</tr> +<tr> +<td>750-799</td><td>10</td> +</tr> +<tr> +<td>800-849</td><td>4</td> +</tr> +<tr> +<td>850-899</td><td>1</td> +</tr> +<tr> +<td>> 899</td><td>0</td> +</tr> +</table> + +Your earnings at the end of the round depend on your investment and the number of +tokens received for the crop. For example, suppose you invest 6 out of the 10 +tokens you are endowed with at the start of the round and you receive 333 cubic feet +of water. Your total earnings will be the amount of tokens leftover from your +initial endowment (10 - 6) plus the tokens you earned from your crop (15 tokens for +333 cubic feet of water, see Table 2). The total number of tokens earned is 19 +($0.85 since each token is $0.05). + +]]> +</entry> + +<entry key='water-collected-to-tokens-table'> +<![CDATA[ +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Water applied to your field</th> +<th>Tokens earned</th> +</thead> +<tr> +<td>< 150</td><td>0</td> +</tr> +<tr> +<td>150-199</td><td>1</td> +</tr> +<tr> +<td>200-249</td><td>4</td> +</tr> +<tr> +<td>250-299</td><td>10</td> +</tr> +<tr> +<td>300-349</td><td>15</td> +</tr> +<tr> +<td>350-399</td><td>18</td> +</tr> +<tr> +<td>400-499</td><td>19</td> +</tr> +<tr> +<td>500-549</td><td>20</td> +</tr> +<tr> +<td>550-649</td><td>19</td> +</tr> +<tr> +<td>650-699</td><td>18</td> +</tr> +<tr> +<td>700-749</td><td>15</td> +</tr> +<tr> +<td>750-799</td><td>10</td> +</tr> +<tr> +<td>800-849</td><td>4</td> +</tr> +<tr> +<td>850-899</td><td>1</td> +</tr> +<tr> +<td>> 899</td><td>0</td> +</tr> +</table> +]]> +</entry> + + +<entry key="general-instructionsq6"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +If you invest 7 of the 10 tokens you started with, and you put 202 cf of water +on your field, what is the <b>total number of tokens</b> you will have earned +for that round? +<br> +<input type="radio" name="q8" value="3">3<br> +<input type="radio" name="q8" value="5">5<br> +<input type="radio" name="q8" value="7">7<br> +<input type="radio" name="q8" value="13">13<br> +<br><br> +If you invest all 10 tokens you start with, and you put 555 cf of water on your +field, what is the total number of tokens your will have earned for that round? +<br> +<input type="radio" name="q9" value="10">10<br> +<input type="radio" name="q9" value="19">19<br> +<input type="radio" name="q9" value="20">20<br> +<input type="radio" name="q9" value="29">29<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions7"> +<![CDATA[ +<h3>Scores</h3> +<p> +The total number of tokens collected during a round is shown on the screen with the +message: +<br><br> +Total tokens earned this round: 0 +<br><br> +This the total of tokens not invested in irrigation structure plus additional +tokens earned by growing a crop. +<br> +You will also see the scores of the other participants summarized on the screen. +Finally, you will see the water flow capacity of each player at any given moment, as +illustrated in the figure below. + +]]> +</entry> + + +<entry key="general-instructionsq7"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +Each token is worth 5 cents, thus if you collected 30 tokens in a round you earned: +<br> +<input type="radio" name="q10" value=".15">$0.15<br> +<input type="radio" name="q10" value=".50">$0.50<br> +<input type="radio" name="q10" value="1.50">$1.50<br> +<input type="radio" name="q10" value="2.50">$2.50<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +<br><br> +</form> +]]> +</entry> + +<entry key="general-instructions8"> +<![CDATA[ +<p> +We will now start with two practice rounds. This practice round will not +contribute to your earnings – it is intended to acquaint you with the +functioning of the exercise environment. +</p> +<p> +You will first chat via text with other participants in your group and then +decide how much you wish to invest in irrigation infrastructure maintenance. +After all investment decisions have been made you will begin the actual round +and make real-time decisions on when to open your gates and irrigate your +fields. +</p> +<p> +If you have any questions feel free to raise your hand and to ask your question. +<b>Do you have any questions so far?</b> +</p> +]]> +</entry> + +<entry key="investment-instructions"> +<![CDATA[ +<h3>Invest tokens in the irrigation infrastructure</h3> +<p> +You have been endowed with 10 tokens to invest. You must make a decision about +how much you wish to invest [0,10] in the irrigation infrastructure. You can +see the relationship between total investment and irrigation infrastructure in +the table below. After you have entered the number of tokens you'd like to +invest, hit the enter key or click the submit button to confirm your +investment. When everybody has made their decision, the total investment will +be calculated and the overall irrigation infrastructure will be displayed. +Each token you invest corresponds to one percent of infrastructure efficiency, +so if you invest 10 tokens you are contributing 10% to the overall +infrastructure efficiency. +</p> +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Total Infrastructure Efficiency (percent)</th> +<th>Water delivery (cubic feet per second)</th> +</thead> +<tr> +<td> ≤ 45</td><td>0</td> +</tr> +<tr> +<td>46-51</td><td>5</td> +</tr> +<tr> +<td>52-55</td><td>10</td> +</tr> +<tr> +<td>56-58</td><td>15</td> +</tr> +<tr> +<td>59-61</td><td>20</td> +</tr> +<tr> +<td>62-65</td><td>25</td> +</tr> +<tr> +<td>66-70</td><td>30</td> +</tr> +<tr> +<td>71-80</td><td>35</td> +</tr> +<tr> +<td>81-100</td><td>40</td> +</tr> +</table> +]]> +</entry> + +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key="practice-round">true</entry> + +<entry key="instructions"> +<![CDATA[ +<p> +We will now start with two practice rounds. This practice round will not contribute +to your earnings. If you have any questions feel free to raise your hand and to ask +your question. +<br> +<b>Do you have any questions?</b> +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round1.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round1.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round1.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> +<entry key="practice-round">true</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Practice Round 2</h3> +<p> +This is the second practice round of the experiment. If you have any questions +after participating in the first round, please ask them now. +</p> +]]> +</entry> +</properties> + Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round10.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round10.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round10.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='infrastructure-degradation-factor'>10</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 9 Instructions</h3> +<p> +This round is the same as the previous round. +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round11.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round11.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round11.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='infrastructure-degradation-factor'>85</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 10 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round12.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round12.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round12.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>27</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 11 Instructions</h3> +<p> +In the past rounds the water availability was stable at a level of 30 cubic +feet per second for each round. In the following 10 rounds the <b>average water +supply</b> remains 30 cfps, but the <b>actual water supply</b> in each round +will vary between 20 cfps and 40 cfps. After you have made your investment +decisions, the infrastructure level will be displayed as well as the actual +water supply for that round. + +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round13.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round13.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round13.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>31</entry> + +<entry key="instructions"> +<![CDATA[ + +<h3>Round 12 Instructions</h3> +<p> +This is round 12/20. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round14.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round14.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round14.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>22</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 13 Instructions</h3> +<p> +This is round 13/20. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round15.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round15.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round15.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> +<entry key='max-canal-flow-capacity'>36</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 14 Instructions</h3> +<p> +This is round 14/20. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round16.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round16.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round16.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>25</entry> + + +<entry key="instructions"> +<![CDATA[ +<h3>Round 15 Instructions</h3> +<p> +This is round 15/20. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round2.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round2.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round2.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='reset-infrastructure-efficiency'>true</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 1 Instructions</h3> +<p> +This is the first actual round of the experiment. Before this round begins +you will have the opportunity to text chat with the other participant for +forty seconds, then decide on your level of investment in the irrigation +infrastructure. After the total irrigation infrastructure investment has been +determined you will begin the experiment and make decisions on when to open +your irrigation gates and grow crops. +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round3.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round3.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round3.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 2 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round4.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round4.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round4.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 3 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round5.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round5.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round5.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='infrastructure-degradation-factor'>10</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 4 Instructions</h3> +<p> +In the past rounds the infrastructure efficiency declined from one round to +the next at a constant amount of 25%. In the following rounds the <b>average +decline</b> of the infrastructure efficiency will remain the same, but the +<b>actual amount</b> of decline can vary from round to round. This means that +in some rounds the decline will be larger than 25% and some rounds the decline +will be smaller than 25%. Before each round begins you will continue to make a +decision on how much to invest in the irrigation infrastructure. After all of +your investment contributions have been submitted the resulting level of +infrastructure efficiency will be displayed and then the round will begin. If +you have any questions, please ask them now. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round6.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round6.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round6.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='infrastructure-degradation-factor'>85</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 5 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round7.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round7.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round7.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='infrastructure-degradation-factor'>10</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 6 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round8.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round8.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round8.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='infrastructure-degradation-factor'>10</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 7 Instructions</h3> +<p> +This round is the same as the previous round. +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round9.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round9.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round9.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='infrastructure-degradation-factor'>10</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 8 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round0.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round0.xml 2009-10-27 06:36:01 UTC (rev 337) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round0.xml 2009-10-27 06:53:06 UTC (rev 338) @@ -2,8 +2,7 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Irrigation experiment round configuration</comment> -<entry key='max-canal-flow-capacity'>40</entry> -<entry key='max-client-flow-capacity'>25</entry> + <entry key="practice-round">true</entry> <entry key="instructions"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-27 06:36:11
|
Revision: 337 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=337&view=rev Author: alllee Date: 2009-10-27 06:36:01 +0000 (Tue, 27 Oct 2009) Log Message: ----------- moving configuration files into treatment 1 (t1) folder Added Paths: ----------- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/irrigation.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round0.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round1.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round10.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round11.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round12.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round13.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round14.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round15.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round16.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round17.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round18.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round19.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round2.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round20.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round21.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round3.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round4.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round5.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round6.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round7.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round8.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/round9.xml Removed Paths: ------------- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round12.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round13.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round14.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round15.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round16.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round17.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round18.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round19.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round20.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round21.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round3.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round4.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,735 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<!--<entry key="hostname">localhost</entry>--> -<entry key="hostname">@SERVER_ADDRESS@</entry> -<entry key="port">@PORT_NUMBER@</entry> -<entry key="round0">round0.xml</entry> -<entry key="round1">round1.xml</entry> -<entry key="round2">round2.xml</entry> -<entry key="round3">round3.xml</entry> -<entry key="round4">round4.xml</entry> -<entry key="round5">round5.xml</entry> -<entry key="round6">round6.xml</entry> -<entry key="round7">round7.xml</entry> -<entry key="round8">round8.xml</entry> -<entry key="round9">round9.xml</entry> -<entry key="round10">round10.xml</entry> -<entry key="round11">round11.xml</entry> -<entry key="round12">round12.xml</entry> -<entry key="round13">round13.xml</entry> -<entry key="round14">round14.xml</entry> -<entry key="round15">round15.xml</entry> -<entry key="round16">round16.xml</entry> - -<entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">17</entry> - -<entry key="undisrupted-flow-required">true</entry> - -<entry key="q1">4</entry> -<entry key="q2">identity</entry> -<entry key="q3">49</entry> -<entry key="q4">76</entry> -<entry key="q5">20</entry> -<entry key="q6">5</entry> -<entry key="q7">25</entry> -<entry key="q8">7</entry> -<entry key="q9">19</entry> -<entry key="q10">1.50</entry> - -<entry key='final-instructions'> -<![CDATA[ -<p> -The experiment is almost over. We have a brief survey for you to fill out while the -facilitator prepares your payments. When the facilitator has finished preparing -payments and you have all completed your surveys your computer number will be -called. You can then go next door to receive your payment. For privacy reasons we -must pay you one at a time. -</p> -<p> -Thanks for participating! -</p> -]]> -</entry> - - -<entry key="initial-instructions"> -<![CDATA[ -<h3>Welcome</h3> -<p> -Please be patient while the experimental environment is set up. -<b>Please do not close this window or open any other windows.</b> -</p> -]]> -</entry> - - -<entry key="facilitator-instructions"> -<![CDATA[ -<h3>Facilitator Instructions</h3> -<p> -Welcome to the facilitator interface. This interface allows you to control -the experiment. You may only modify configuration parameters <b>before</b> -you start the experiment by selecting the Configuration menu. When all the -participants are ready to begin the experiment, you can start the experiment -by selecting Experiment -> Start. After a round has been completed you -will be able to view the statistics for all of the participants. You can -begin the next round by selecting Round -> Start. -</p> -]]> -</entry> - - - -<entry key="general-instructions0"> -<![CDATA[ -<center><h3>Welcome to the experiment. Please do not close this window or open any -other applications.</h3></center> -]]> -</entry> - -<entry key="general-instructions1"> -<![CDATA[ -<h3>General Instructions</h3> -<p>Welcome. You have already earned 5 dollars by showing up for this exercise. -You can earn more, up to an extra 25 dollars, by participating in the exercise -which will last for about one hour. You will participate in this exercise as a -part of a group. Each group has five participants. Your group has been formed -by randomly assigning you to FOUR other participants in the room. The amount -of money you earn will depend on the decisions made by you and the rest of the -group. That is, your earnings will depend on your decisions as well as the -other members of your group. -</p> -<p> -This exercise mimics decisions people make in irrigation systems. In each round you -will receive 10 tokens which you can choose to keep or invest in the irrigation -infrastructure (for example canals and water diversion structures). Depending on the -state of repair of the irrigation infrastructure, it will be capable of directing -water to your field when you use your water diversion structure (called an -irrigation gate). Depending on the amount of water you can get to your field, you -can grow crops. Depending on the number of crops you grow you earn tokens. Each -token is worth 5 cents and you will be paid cash in private at the end of the -experiment based on the number of tokens you earned. -</p> -<p> -The experiment consists of a number of rounds. In each round you will first make a -decision as to how much to invest in the irrigation infrastructure. Without periodic -investment, the irrigation infrastructure will break down over time. Based on the -combined contributions of all 5 participants in your group in each round, as -explained below, your group can maintain the performance of the irrigation -infrastructure. The condition of the irrigation infrastructure determines -its capacity to deliver water which you can use to grow crops. -</p> -]]> -</entry> - -<entry key="general-instructionsq1"> -<![CDATA[ -<br><br> -To continue to the next page, please answer the following question:<br> -<form> -How many OTHER people in the room will be in your group?<br> -<input type="radio" name="q1" value="0">0<br> -<input type="radio" name="q1" value="1">1<br> -<input type="radio" name="q1" value="4">4<br> -<input type="radio" name="q1" value="Everybody">Everybody<br> -<br><br> -<input type="submit" name="submit" value="Submit"> -</form> -]]> -</entry> - -<entry key="general-instructions2"> -<![CDATA[ -<h3>Chat</h3> -<p>Before each round you will have a chat period of 40 seconds where you can send -text messages to the other participants. You may discuss any aspect of the exercise -with two important exceptions: -</p> -<ol> -<li>You are <b>not allowed</b> to promise the other participants -side-payments or threaten them with any consequence after the experiment is -finished. -</li> -<li>You are <b>not allowed to reveal your real identity</b>.</li> -</ol> -<p> -We will be monitoring the chat traffic. If we detect any violation of these rules, -we will have to remove <b>all members of the group where the violation occurred</b> -from the experiment. That group will have to wait until the entire experiment is -finished to receive their payment. -</p> -<p> -You will see a text box appear on your screen when a chat period starts. The amount -of time left in the chat period will be shown at the <b>top left of the screen</b>.<br> -</p> -]]> -</entry> - -<entry key="general-instructionsq2"> -<![CDATA[ -<br><br> -To continue to the next page, please answer the following question:<br> -<form> -Which of the following topics are you <b>not allowed</b> to discuss in chat?<br> -<input type="radio" name="q2" value="weather">the weather<br> -<input type="radio" name="q2" value="identity">your real identity<br> -<input type="radio" name="q2" value="experiment">the experiment<br> -<input type="radio" name="q2" value="earnings">what you will do with the money you earn from this experiment<br> -<br><br> -<input type="submit" name="submit" value="Submit"> -</form> -]]> -</entry> - -<entry key="general-instructions3"> -<![CDATA[ -<h3>Creating Irrigation Infrastructure</h3> -<p> -After the chat period ends you and each other participant will be given 10 tokens. -You must then decide what to do with these tokens. You may decide to invest in the -irrigation infrastructure or to keep the tokens. If you keep the tokens you will -earn at a minimum 10 tokens X 5 cents = $0.50 for each round. If you do this every -round after twenty rounds you will end up with at least $10 (plus any crops that you -may be able to grow as we will discuss later). Your total earnings for -participating in the experiment would then be at least $10 plus your show-up payment -of $5, for a grand total of at least $15. -</p> -<p> -On the other hand, if you invest some of your tokens in the irrigation -infrastructure, you may be able to earn more than this amount by growing crops. If -the irrigation infrastructure is operating at near maximum capacity you can earn -close to $1.50 each round. Thus if you grow crops you can roughly triple your -earnings compared to doing nothing. The actual earnings depend on the decisions you -and the other participants in your group make in terms of investment and when to -grow crops. -</p> -<p> -In each round the condition of the irrigation system declines such that its water -delivery efficiency drops by 25%. Investment is necessary to keep the irrigation -infrastructure from deteriorating. If you decide to invest in irrigation -infrastructure you must decide on the amount to invest out of your initial 10 -tokens. Keep in mind that the irrigation infrastructure must exceed a certain level -before you can grow crops. The tokens invested by all participants in your group -are added together and will total up to an amount 0 and 50 tokens. Each token -invested increases the irrigation infrastructure efficiency by one percentage point, -up to a <b>maximum of 100%</b>. This means that if the irrigation infrastructure -efficiency is at 80% it would not make sense for your group to invest a total of 50 -tokens, as any investment beyond 20 tokens would be wasted. In the table below you -can see the water delivery capacity measured in water units per second as a function -of the condition of the irrigation infrastructure. When the infrastructure is at -100% efficiency, 40 cubic feet of water per second (cfps) will be available. When the -irrigation infrastructure efficiency falls below 45%, there is no capacity left for -transporting water and thus there is no water available for anyone. -</p> -<p> -Your initial irrigation infrastructure will start at 75% efficiency but <b>will -carry over from round to round</b>. As an example, let's say that no one in a -group invests any tokens in the first round. The irrigation infrastructure -efficiency will be set at 75% for that first round. The table below lists the water -delivery in cubic feet per second (cfps) corresponding to the irrigation infrastructure -efficiency. If you look at the second to last row you can see that at 75% -efficiency the irrigation infrastructure will deliver 35 cfps. So in the first -round the group will have 35 cfps of water available to them. -</p> -<p> -Recall that each round the irrigation infrastructure efficiency deteriorates by 25%, -so at the start of the second round the infrastructure efficiency decreases to 50%. -At this point all five members of the group decide to invest 7 tokens each. This -increases the infrastructure efficiency by 35%, resulting in a total infrastructure -efficiency of 85%. If you look at the table again you can see that an -infrastructure efficiency of 85% will deliver 40 cfps. -</p> -<p> -The actual amount of water that is available for the group depends on the amount of -water available. Your group might have created an irrigation infrastructure with a -capacity of 40 cfps, but due to lack of rainfall only 30 cfps is available. On the -other hand, if the infrastructure capacity allows 30 cfps and 40 cfps of water is available -to the system, only 30 cfps can be delivered. -</p> - -<p> -To recap, at the beginning of each round you will be informed of the current -irrigation infrastructure efficiency. You will then decide how many tokens (between -0 and 10) to invest in the irrigation infrastructure. After everybody has made -their decision, you will be notified of the condition of the irrigation -infrastructure and the corresponding water delivery capacity. -</p> - -<b>Table 1:</b> The water delivery capacity as a function of the irrigation -infrastructure condition -<table border="1" cellspacing="2" cellpadding="2"> -<thead> -<th>Infrastructure efficiency (percent)</th> -<th>Water delivery (cubic feet per second)</th> -</thead> -<tr> -<td>≤ 45</td><td>0</td> -</tr> -<tr> -<td>46-51</td><td>5</td> -</tr> -<tr> -<td>52-55</td><td>10</td> -</tr> -<tr> -<td>56-58</td><td>15</td> -</tr> -<tr> -<td>59-61</td><td>20</td> -</tr> -<tr> -<td>62-65</td><td>25</td> -</tr> -<tr> -<td>66-70</td><td>30</td> -</tr> -<tr> -<td>71-80</td><td>35</td> -</tr> -<tr> -<td>81-100</td><td>40</td> -</tr> -</table> - -]]> -</entry> - -<entry key="general-instructionsq3"> -<![CDATA[ -<br><br> -To continue to the next page, please answer the following questions:<br> -<form> -Question 1:<br> -Given an existing infrastructure efficiency of 20%, if the five participants invest -a <b>total of 29 additional tokens</b>, what is the new irrigation infrastructure -efficiency? -(<b>Note: only enter a number, you don't need to add the % sign</b>)<br> -<input type="text" name="q3" value = ""> -<br><br> - -Question 2:<br> -Given an existing infrastructure efficiency of 50%, if <b>two participants invest 10 tokens each</b> -while the <b>three other participants invest 2 tokens each</b>, what is the new -irrigation infrastructure efficiency? -(<b>Note: only enter a number, you don't need to add the % sign</b>)<br> -<input type="text" name="q4" value = ""> -<br><br> -<input type="submit" name="submit" value="Submit"><br> -<br> -</form> -]]> -</entry> - -<entry key="general-instructions4"> -<![CDATA[ -<h3>Growing crops</h3> -<p>There are <b>five</b> participants in each group, each of which is randomly assigned to -one of the five positions, A, B, C, D or E. Below is a screenshot of the -graphical interface representation of the irrigation system. Water comes from -the box to the left and the five players are located from upstream (leftmost) -to downstream (rightmost) accordingly. To illustrate, assume you are in -position C. The black lines represent "gates" that you open and close by -clicking on the large button on the lower left corner of the screen. -Each round consists of 50 seconds and the amount of time left in the -experiment is indicated by a bar at the top of the screen. -</p> -<img src="http://dev.commons.asu.edu/irrigation/images/game-interface-screenshot.jpg"> -<br><br> -<p> -You can irrigate your field during the round by opening your gate. Your -earnings depend on the amount of water you can draw onto your fields and will -be explained in more detail on the next page. The speed at which you can grow -a crop depends on the amount of water available to you <b>at the time that you -open your gate</b>. The maximum flow capacity of the main canal shared by A, -B, C, D, and E is forty cubic feet per second. -</p> -<p> -The maximum amount of water that can flow through your gate when it is opened -is 25 cubic feet per second. If other people are using the canal, the water -flow available to you might be less, and it may take longer to get water to -your field since you are also limited by the amount of water that is flowing -through the shared canal. -</p> -]]> -</entry> - -<entry key="general-instructionsq4"> -<![CDATA[ -<br><br> -To continue to the next page, please answer the following question:<br> -Question 3:<br> -<form> -What is the minimum time to deliver 500 cubic feet of water to your field when -your maximum water flow capacity is available? -<br> -<input type="radio" name="q5" value="12.5">12.5 seconds<br> -<input type="radio" name="q5" value="20">20 seconds<br> -<input type="radio" name="q5" value="25">25 seconds<br> -<input type="radio" name="q5" value="50">50 seconds<br> -<br><br> -<input type="submit" name="submit" value="Submit"> -</form> -]]> -</entry> - - -<entry key="general-instructions5"> -<![CDATA[ -<h3>Positions A,B,C,D and E</h3> -<p> -The animation above illustrates how water flows to each player when their gates are -opened and closed. When a player opens their gate, the black line will rotate to a -vertical position, allowing water (represented by white dots) to flow to them. Note -that the water available downstream of a player with an open port is reduced, -illustrated by a narrowing of the canal. -</p> -<p> -Access to water depends on your position as shown in the window. Water originates -in the box at the upper left part of the screen and travels to the right. Thus, -participant A will have first access to the available water. Water not used by -participant A is then available to be used by participant B. Water not used by -participants A and B is then available for C. Water not used by participants A, B -and C is available for D. Finally, water not used by participants A, B, C and D is -available for E. -</p> -<p> -You can only get water to your field if you have water available to your position. -Suppose that the total irrigation capacity available is 40 cfps and 40 cfps of water -is available. If player A opens their gate they will consume 25 cfps of water and 15 -cfps is left for B. Suppose on the other hand, A does not open the gate, then a -total of 40 cfps is left for B, allowing B to extract water at the maximum rate of -25 cfps. -</p> -<p> -As another example, suppose that the canal system has been allowed to deteriorate -so that the total irrigation capacity available is 20 cfps. While player A’s gate is -open, no water is available for B. If A is NOT using water, 20 cfps is available for -B. -</p> -]]> -</entry> - -<entry key="general-instructionsq5"> -<![CDATA[ -<br><br> -To continue to the next page, please answer the following question:<br> -<form> -Suppose the irrigation efficiency is between 71 and 80% so that the canal flow -capacity is 30 cfps. If A opens their gate and diverts water at 25 cfps what is the -available water flow for B? -<br> -<input type="radio" name="q6" value="30">30 cfps<br> -<input type="radio" name="q6" value="25">25 cfps<br> -<input type="radio" name="q6" value="15">15 cfps<br> -<input type="radio" name="q6" value="5">5 cfps<br> -<br><br> -If the canal flow capacity available is 25 cfps and A,B,C and D are not using water, -what is the available water for E? -<br> -<input type="radio" name="q7" value="40">40 cfps<br> -<input type="radio" name="q7" value="25">25 cfps<br> -<input type="radio" name="q7" value="15">15 cfps<br> -<input type="radio" name="q7" value="0">0 cfps<br> - -<input type="submit" name="submit" value="Submit"> -<br><br> -</form> -]]> -</entry> - -<entry key="general-instructions6"> -<![CDATA[ -<h3>How to grow crops</h3> -<p> -To start growing crops, click on the yellow button labeled "open gate". -This will open your irrigation gate and allow water to flow to your field if it is -available. The text on the button will change to "close gate" - if -you would like to close the gate and stop extracting water from the canal, just -click on the yellow button again. Your gate will close and the text on the button -will change back to "open gate". -</p> -<p> -The amount of water units (cubic feet) your field has received is shown on the -screen, as well as the resulting amount of tokens earned from growing a crop. -The number of tokens earned in each round depends on how much water you have -diverted to your field. If you receive less than 150 cubic feet (cf) the crop has -not received enough water to grow a crop and you will thus not receive any tokens. -The maximum earnings are received when between 500 cf and 549 cf are diverted to -your field. If more than 549 cf water is diverted to your field, this will -negatively affect the growth of the crop (i.e. overwatering) and less tokens will be -earned. In the table below you can see the amount of tokens earned for amount of -water applied to your field. -</p> -<b>Table 2</b>: Earnings resulting from the amount of water applied to your field. - -<table border="1" cellspacing="2" cellpadding="2"> -<thead> -<th>Water units received (cubic feet)</th> -<th>Tokens earned</th> -</thead> -<tr> -<td>< 150</td><td>0</td> -</tr> -<tr> -<td>150-199</td><td>1</td> -</tr> -<tr> -<td>200-249</td><td>4</td> -</tr> -<tr> -<td>250-299</td><td>10</td> -</tr> -<tr> -<td>300-349</td><td>15</td> -</tr> -<tr> -<td>350-399</td><td>18</td> -</tr> -<tr> -<td>400-499</td><td>19</td> -</tr> -<tr> -<td>500-549</td><td>20</td> -</tr> -<tr> -<td>550-649</td><td>19</td> -</tr> -<tr> -<td>650-699</td><td>18</td> -</tr> -<tr> -<td>700-749</td><td>15</td> -</tr> -<tr> -<td>750-799</td><td>10</td> -</tr> -<tr> -<td>800-849</td><td>4</td> -</tr> -<tr> -<td>850-899</td><td>1</td> -</tr> -<tr> -<td>> 899</td><td>0</td> -</tr> -</table> - -Your earnings at the end of the round depend on your investment and the number of -tokens received for the crop. For example, suppose you invest 6 out of the 10 -tokens you are endowed with at the start of the round and you receive 333 cubic feet -of water. Your total earnings will be the amount of tokens leftover from your -initial endowment (10 - 6) plus the tokens you earned from your crop (15 tokens for -333 cubic feet of water, see Table 2). The total number of tokens earned is 19 -($0.85 since each token is $0.05). - -]]> -</entry> - -<entry key='water-collected-to-tokens-table'> -<![CDATA[ -<table border="1" cellspacing="2" cellpadding="2"> -<thead> -<th>Water applied to your field</th> -<th>Tokens earned</th> -</thead> -<tr> -<td>< 150</td><td>0</td> -</tr> -<tr> -<td>150-199</td><td>1</td> -</tr> -<tr> -<td>200-249</td><td>4</td> -</tr> -<tr> -<td>250-299</td><td>10</td> -</tr> -<tr> -<td>300-349</td><td>15</td> -</tr> -<tr> -<td>350-399</td><td>18</td> -</tr> -<tr> -<td>400-499</td><td>19</td> -</tr> -<tr> -<td>500-549</td><td>20</td> -</tr> -<tr> -<td>550-649</td><td>19</td> -</tr> -<tr> -<td>650-699</td><td>18</td> -</tr> -<tr> -<td>700-749</td><td>15</td> -</tr> -<tr> -<td>750-799</td><td>10</td> -</tr> -<tr> -<td>800-849</td><td>4</td> -</tr> -<tr> -<td>850-899</td><td>1</td> -</tr> -<tr> -<td>> 899</td><td>0</td> -</tr> -</table> -]]> -</entry> - - -<entry key="general-instructionsq6"> -<![CDATA[ -<br><br> -To continue to the next page, please answer the following question:<br> -<form> -If you invest 7 of the 10 tokens you started with, and you put 202 cf of water -on your field, what is the <b>total number of tokens</b> you will have earned -for that round? -<br> -<input type="radio" name="q8" value="3">3<br> -<input type="radio" name="q8" value="5">5<br> -<input type="radio" name="q8" value="7">7<br> -<input type="radio" name="q8" value="13">13<br> -<br><br> -If you invest all 10 tokens you start with, and you put 555 cf of water on your -field, what is the total number of tokens your will have earned for that round? -<br> -<input type="radio" name="q9" value="10">10<br> -<input type="radio" name="q9" value="19">19<br> -<input type="radio" name="q9" value="20">20<br> -<input type="radio" name="q9" value="29">29<br> -<br><br> -<input type="submit" name="submit" value="Submit"> -</form> -]]> -</entry> - -<entry key="general-instructions7"> -<![CDATA[ -<h3>Scores</h3> -<p> -The total number of tokens collected during a round is shown on the screen with the -message: -<br><br> -Total tokens earned this round: 0 -<br><br> -This the total of tokens not invested in irrigation structure plus additional -tokens earned by growing a crop. -<br> -You will also see the scores of the other participants summarized on the screen. -Finally, you will see the water flow capacity of each player at any given moment, as -illustrated in the figure below. - -]]> -</entry> - - -<entry key="general-instructionsq7"> -<![CDATA[ -<br><br> -To continue to the next page, please answer the following question:<br> -<form> -Each token is worth 5 cents, thus if you collected 30 tokens in a round you earned: -<br> -<input type="radio" name="q10" value=".15">$0.15<br> -<input type="radio" name="q10" value=".50">$0.50<br> -<input type="radio" name="q10" value="1.50">$1.50<br> -<input type="radio" name="q10" value="2.50">$2.50<br> -<br><br> -<input type="submit" name="submit" value="Submit"> -<br><br> -</form> -]]> -</entry> - -<entry key="general-instructions8"> -<![CDATA[ -<p> -We will now start with two practice rounds. This practice round will not -contribute to your earnings – it is intended to acquaint you with the -functioning of the exercise environment. -</p> -<p> -You will first chat via text with other participants in your group and then -decide how much you wish to invest in irrigation infrastructure maintenance. -After all investment decisions have been made you will begin the actual round -and make real-time decisions on when to open your gates and irrigate your -fields. -</p> -<p> -If you have any questions feel free to raise your hand and to ask your question. -<b>Do you have any questions so far?</b> -</p> -]]> -</entry> - -<entry key="undisrupted-flow-instructions"> -<![CDATA[ -<p> -If the flow of water is disrupted while your gate is open your crop growing progress -will be halted. -</p> -]]> -</entry> - - -<entry key="investment-instructions"> -<![CDATA[ -<h3>Invest tokens in the irrigation infrastructure</h3> -<p> -You have been endowed with 10 tokens to invest. You must make a decision about -how much you wish to invest [0,10] in the irrigation infrastructure. You can -see the relationship between total investment and irrigation infrastructure in -the table below. After you have entered the number of tokens you'd like to -invest, hit the enter key or click the submit button to confirm your -investment. When everybody has made their decision, the total investment will -be calculated and the overall irrigation infrastructure will be displayed. -Each token you invest corresponds to one percent of infrastructure efficiency, -so if you invest 10 tokens you are contributing 10% to the overall -infrastructure efficiency. -</p> -<table border="1" cellspacing="2" cellpadding="2"> -<thead> -<th>Total Infrastructure Efficiency (percent)</th> -<th>Water delivery (cubic feet per second)</th> -</thead> -<tr> -<td> ≤ 45</td><td>0</td> -</tr> -<tr> -<td>46-51</td><td>5</td> -</tr> -<tr> -<td>52-55</td><td>10</td> -</tr> -<tr> -<td>56-58</td><td>15</td> -</tr> -<tr> -<td>59-61</td><td>20</td> -</tr> -<tr> -<td>62-65</td><td>25</td> -</tr> -<tr> -<td>66-70</td><td>30</td> -</tr> -<tr> -<td>71-80</td><td>35</td> -</tr> -<tr> -<td>81-100</td><td>40</td> -</tr> -</table> -]]> -</entry> - -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='max-canal-flow-capacity'>40</entry> -<entry key='max-client-flow-capacity'>25</entry> -<entry key="practice-round">true</entry> - -<entry key="instructions"> -<![CDATA[ -<p> -We will now start with two practice rounds. This practice round will not contribute -to your earnings. If you have any questions feel free to raise your hand and to ask -your question. -<br> -<b>Do you have any questions?</b> -</p> -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key="practice-round">true</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Practice Round 2</h3> -<p> -This is the second practice round of the experiment. If you have any questions -after participating in the first round, please ask them now. -</p> -]]> -</entry> -</properties> - Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key='infrastructure-degradation-factor'>10</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 9 Instructions</h3> -<p> -This round is the same as the previous round. -</p> -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key='infrastructure-degradation-factor'>85</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 10 Instructions</h3> -<p> -This round is the same as the previous round, but the infrastructure -irrigation efficiency has experienced a severe decline of 85%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round12.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round12.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round12.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>10</entry> - - -<entry key="instructions"> -<![CDATA[ -<h3>Round 11 Instructions</h3> -<p> -This is round 11/20. -</p> -<p> -In the past 10 rounds the infrastructure efficiency declined from one round to the -next at a constant rate of 25%. In the following 10 rounds the average decline of -the infrastructure efficiency remains the same, but the amount of decline can vary -from round to round. This means that in some rounds the decline will be larger than 25% -and some rounds the decline will be smaller than 25%. Before each round begins you -will continue to make a decision on how much to invest in the irrigation -infrastructure. After all of your investment contributions have been submitted the -resulting level of infrastructure efficiency will be displayed and then the round -will begin. If you have any questions, please ask them now. -</p> - -The infrastructure has been degraded by 10%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round13.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round13.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round13.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key="max-total-token-contribution">50</entry> -<entry key='infrastructure-degradation-factor'>10</entry> -<entry key="instructions"> -<![CDATA[ -<h3>Round 12 Instructions</h3> -<p> -This is round 12/20. The infrastructure has been degraded by 10%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round14.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round14.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round14.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>85</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 13 Instructions</h3> -<p> -This is round 13/20. The infrastructure has suffered a severe shock and has been degraded by 85%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round15.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round15.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round15.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>10</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 14 Instructions</h3> -<p> -This is round 14/20. The infrastructure has been degraded by 10%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round16.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round16.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round16.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>10</entry> - - -<entry key="instructions"> -<![CDATA[ -<h3>Round 15 Instructions</h3> -<p> -This is round 15/20. The infrastructure has been degraded by 10%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round17.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round17.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round17.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>10</entry> -<entry key="instructions"> -<![CDATA[ -<h3>Round 16 Instructions</h3> -<p> -This is round 16/20. The infrastructure has been degraded by 10%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round18.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round18.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round18.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>85</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 17 Instructions</h3> -<p> -This is round 17/20. The infrastructure has suffered a severe shock and has been degraded by 85%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round19.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round19.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round19.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>10</entry> - - -<entry key="instructions"> -<![CDATA[ -<h3>Round 18 Instructions</h3> -<p> -This is round 18/20. The infrastructure has been degraded by 10%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key='reset-infrastructure-efficiency'>true</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 1 Instructions</h3> -<p> -This is the first actual round of the experiment. Before this round begins -you will have the opportunity to text chat with the other participant for -forty seconds, then decide on your level of investment in the irrigation -infrastructure. After the total irrigation infrastructure investment has been -determined you will begin the experiment and make decisions on when to open -your irrigation gates and grow crops. -</p> -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round20.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round20.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round20.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>10</entry> -<entry key="clients-per-group">5</entry> - - -<entry key="instructions"> -<![CDATA[ -<h3>Round 19 Instructions</h3> -<p> -This is round 19/20. The infrastructure has been degraded by 10%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round21.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round21.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round21.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 20 Instructions</h3> -<p> -This is round 20/20. The infrastructure has been degraded by 10%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round3.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round3.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round3.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 2 Instructions</h3> -<p> -This round is the same as the previous round, but the infrastructure irrigation has -been decreased by 25%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round4.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round4.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round4.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 3 Instructions</h3> -<p> -This round is the same as the previous round, but the infrastructure irrigation has -been decreased by 25%. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key='infrastructure-degradation-factor'>10</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 4 Instructions</h3> -<p> -In the past rounds the infrastructure efficiency declined from one round to -the next at a constant amount of 25%. In the following rounds the <b>average -decline</b> of the infrastructure efficiency will remain the same, but the -<b>actual amount</b> of decline can vary from round to round. This means that -in some rounds the decline will be larger than 25% and some rounds the decline -will be smaller than 25%. Before each round begins you will continue to make a -decision on how much to invest in the irrigation infrastructure. After all of -your investment contributions have been submitted the resulting level of -infrastructure efficiency will be displayed and then the round will begin. If -you have any questions, please ask them now. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key='infrastructure-degradation-factor'>85</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 5 Instructions</h3> -<p> -This round is the same as the previous round. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key='infrastructure-degradation-factor'>10</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 6 Instructions</h3> -<p> -This round is the same as the previous round. -</p> - -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key='infrastructure-degradation-factor'>30</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 7 Instructions</h3> -<p> -This round is the same as the previous round. -</p> -]]> -</entry> -</properties> Deleted: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml 2009-10-27 05:49:09 UTC (rev 336) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Irrigation experiment round configuration</comment> - -<entry key='infrastructure-degradation-factor'>10</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 8 Instructions</h3> -<p> -This round is the same as the previous round. -</p> - -]]> -</entry> -</properties> Copied: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/irrigation.xml (from rev 336, irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml) =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/irrigation.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t1/irrigation.xml 2009-10-27 06:36:01 UTC (rev 337) @@ -0,0 +1,734 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment server configuration</comment> +<entry key="hostname">@SERVER_ADDRESS@</entry> +<entry key="port">@PORT_NUMBER@</entry> +<entry key="round0">round0.xml</entry> +<entry key="round1">round1.xml</entry> +<entry key="round2">round2.xml</entry> +<entry key="round3">round3.xml</entry> +<entry key="round4">round4.xml</entry> +<entry key="round5">round5.xml</entry> +<entry key="round6">round6.xml</entry> +<entry key="round7">round7.xml</entry> +<entry key="round8">round8.xml</entry> +<entry key="round9">round9.xml</entry> +<entry key="round10">round10.xml</entry> +<entry key="round11">round11.xml</entry> +<entry key="round12">round12.xml</entry> +<entry key="round13">round13.xml</entry> +<entry key="round14">round14.xml</entry> +<entry key="round15">round15.xml</entry> +<entry key="round16">round16.xml</entry> + +<entry key="wait-for-participants">true</entry> +<entry key="number-of-rounds">17</entry> + +<entry key="undisrupted-flow-required">true</entry> + +<entry key="q1">4</entry> +<entry key="q2">identity</entry> +<entry key="q3">49</entry> +<entry key="q4">76</entry> +<entry key="q5">20</entry> +<entry key="q6">5</entry> +<entry key="q7">25</entry> +<entry key="q8">7</entry> +<entry key="q9">19</entry> +<entry key="q10">1.50</entry> + +<entry key='final-instructions'> +<![CDATA[ +<p> +The experiment is almost over. We have a brief survey for you to fill out while the +facilitator prepares your payments. When the facilitator has finished preparing +payments and you have all completed your surveys your computer number will be +called. You can then go next door to receive your payment. For privacy reasons we +must pay you one at a time. +</p> +<p> +Thanks for participating! +</p> +]]> +</entry> + + +<entry key="initial-instructions"> +<![CDATA[ +<h3>Welcome</h3> +<p> +Please be patient while the experimental environment is set up. +<b>Please do not close this window or open any other windows.</b> +</p> +]]> +</entry> + + +<entry key="facilitator-instructions"> +<![CDATA[ +<h3>Facilitator Instructions</h3> +<p> +Welcome to the facilitator interface. This interface allows you to control +the experiment. You may only modify configuration parameters <b>before</b> +you start the experiment by selecting the Configuration menu. When all the +participants are ready to begin the experiment, you can start the experiment +by selecting Experiment -> Start. After a round has been completed you +will be able to view the statistics for all of the participants. You can +begin the next round by selecting Round -> Start. +</p> +]]> +</entry> + + + +<entry key="general-instructions0"> +<![CDATA[ +<center><h3>Welcome to the experiment. Please do not close this window or open any +other applications.</h3></center> +]]> +</entry> + +<entry key="general-instructions1"> +<![CDATA[ +<h3>General Instructions</h3> +<p>Welcome. You have already earned 5 dollars by showing up for this exercise. +You can earn more, up to an extra 25 dollars, by participating in the exercise +which will last for about one hour. You will participate in this exercise as a +part of a group. Each group has five participants. Your group has been formed +by randomly assigning you to FOUR other participants in the room. The amount +of money you earn will depend on the decisions made by you and the rest of the +group. That is, your earnings will depend on your decisions as well as the +other members of your group. +</p> +<p> +This exercise mimics decisions people make in irrigation systems. In each round you +will receive 10 tokens which you can choose to keep or invest in the irrigation +infrastructure (for example canals and water diversion structures). Depending on the +state of repair of the irrigation infrastructure, it will be capable of directing +water to your field when you use your water diversion structure (called an +irrigation gate). Depending on the amount of water you can get to your field, you +can grow crops. Depending on the number of crops you grow you earn tokens. Each +token is worth 5 cents and you will be paid cash in private at the end of the +experiment based on the number of tokens you earned. +</p> +<p> +The experiment consists of a number of rounds. In each round you will first make a +decision as to how much to invest in the irrigation infrastructure. Without periodic +investment, the irrigation infrastructure will break down over time. Based on the +combined contributions of all 5 participants in your group in each round, as +explained below, your group can maintain the performance of the irrigation +infrastructure. The condition of the irrigation infrastructure determines +its capacity to deliver water which you can use to grow crops. +</p> +]]> +</entry> + +<entry key="general-instructionsq1"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +How many OTHER people in the room will be in your group?<br> +<input type="radio" name="q1" value="0">0<br> +<input type="radio" name="q1" value="1">1<br> +<input type="radio" name="q1" value="4">4<br> +<input type="radio" name="q1" value="Everybody">Everybody<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions2"> +<![CDATA[ +<h3>Chat</h3> +<p>Before each round you will have a chat period of 40 seconds where you can send +text messages to the other participants. You may discuss any aspect of the exercise +with two important exceptions: +</p> +<ol> +<li>You are <b>not allowed</b> to promise the other participants +side-payments or threaten them with any consequence after the experiment is +finished. +</li> +<li>You are <b>not allowed to reveal your real identity</b>.</li> +</ol> +<p> +We will be monitoring the chat traffic. If we detect any violation of these rules, +we will have to remove <b>all members of the group where the violation occurred</b> +from the experiment. That group will have to wait until the entire experiment is +finished to receive their payment. +</p> +<p> +You will see a text box appear on your screen when a chat period starts. The amount +of time left in the chat period will be shown at the <b>top left of the screen</b>.<br> +</p> +]]> +</entry> + +<entry key="general-instructionsq2"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +Which of the following topics are you <b>not allowed</b> to discuss in chat?<br> +<input type="radio" name="q2" value="weather">the weather<br> +<input type="radio" name="q2" value="identity">your real identity<br> +<input type="radio" name="q2" value="experiment">the experiment<br> +<input type="radio" name="q2" value="earnings">what you will do with the money you earn from this experiment<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions3"> +<![CDATA[ +<h3>Creating Irrigation Infrastructure</h3> +<p> +After the chat period ends you and each other participant will be given 10 tokens. +You must then decide what to do with these tokens. You may decide to invest in the +irrigation infrastructure or to keep the tokens. If you keep the tokens you will +earn at a minimum 10 tokens X 5 cents = $0.50 for each round. If you do this every +round after twenty rounds you will end up with at least $10 (plus any crops that you +may be able to grow as we will discuss later). Your total earnings for +participating in the experiment would then be at least $10 plus your show-up payment +of $5, for a grand total of at least $15. +</p> +<p> +On the other hand, if you invest some of your tokens in the irrigation +infrastructure, you may be able to earn more than this amount by growing crops. If +the irrigation infrastructure is operating at near maximum capacity you can earn +close to $1.50 each round. Thus if you grow crops you can roughly triple your +earnings compared to doing nothing. The actual earnings depend on the decisions you +and the other participants in your group make in terms of investment and when to +grow crops. +</p> +<p> +In each round the condition of the irrigation system declines such that its water +delivery efficiency drops by 25%. Investment is necessary to keep the irrigation +infrastructure from deteriorating. If you decide to invest in irrigation +infrastructure you must decide on the amount to invest out of your initial 10 +tokens. Keep in mind that the irrigation infrastructure must exceed a certain level +before you can grow crops. The tokens invested by all participants in your group +are added together and will total up to an amount 0 and 50 tokens. Each token +invested increases the irrigation infrastructure efficiency by one percentage point, +up to a <b>maximum of 100%</b>. This means that if the irrigation infrastructure +efficiency is at 80% it would not make sense for your group to invest a total of 50 +tokens, as any investment beyond 20 tokens would be wasted. In the table below you +can see the water delivery capacity measured in water units per second as a functi... [truncated message content] |
From: <al...@us...> - 2009-10-27 05:49:17
|
Revision: 336 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=336&view=rev Author: alllee Date: 2009-10-27 05:49:09 +0000 (Tue, 27 Oct 2009) Log Message: ----------- fixing spacing between irrigation capacity and water supply labels. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-27 02:20:01 UTC (rev 335) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-27 05:49:09 UTC (rev 336) @@ -8,6 +8,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.GroupLayout; import javax.swing.JButton; @@ -45,7 +46,7 @@ //this contains the upstream and downstream Panel private JPanel jPanelUpStreamWindow = null; private JPanel jPanelDownStreamWindow = null; - private JPanel downloadScreenPanel = null; + private JPanel mainInterfacePanel = null; private IrrigationClient client; @@ -128,12 +129,11 @@ this.setLayout(new BorderLayout(4,4)); this.setSize(1130, 558); - this.add(getJPanelMain(),null); + this.add(getPanel(),null); } - private JPanel getJPanelMain() { - // TODO Auto-generated method stub + private JPanel getPanel() { if(jPanelMain == null){ jPanelMain = new JPanel(); jPanelMain.setLayout(new BorderLayout(4,4)); @@ -142,16 +142,17 @@ JPanel upperPanel = new JPanel(); upperPanel.setLayout(new BoxLayout(upperPanel, BoxLayout.X_AXIS)); upperPanel.add(getIrrigationCapacityLabel()); + upperPanel.add(Box.createHorizontalGlue()); upperPanel.add(getWaterSupplyLabel()); jPanelMain.add(upperPanel, BorderLayout.NORTH); - jPanelMain.add(getDownloadScreenPanel(), BorderLayout.CENTER); + jPanelMain.add(getMainInterfacePanel(), BorderLayout.CENTER); return jPanelMain; } return jPanelMain; } - private JPanel getDownloadScreenPanel() { - if(downloadScreenPanel == null){ + private JPanel getMainInterfacePanel() { + if(mainInterfacePanel == null){ scoreBoardLabel = new JLabel(); scoreBoardLabel.setBounds(new Rectangle(582,225+100+35,530,20)); scoreBoardLabel.setHorizontalAlignment(SwingConstants.CENTER); @@ -169,16 +170,16 @@ priorityjLabel = new JLabel(); priorityjLabel.setBounds(new Rectangle(780, 16, 44, 16)); priorityjLabel.setText(""); - downloadScreenPanel = new JPanel(); - downloadScreenPanel.setLayout(null); - downloadScreenPanel.setName("downloadScreenPanel"); - downloadScreenPanel.setBackground(Color.WHITE); - downloadScreenPanel.add(getCenterPanel(),null); - downloadScreenPanel.add(getTimeLeftProgressBar(), null); - downloadScreenPanel.add(gateSwitchLabel, null); - downloadScreenPanel.add(scoreBoardLabel, null); + mainInterfacePanel = new JPanel(); + mainInterfacePanel.setLayout(null); + mainInterfacePanel.setName("Main interface panel"); + mainInterfacePanel.setBackground(Color.WHITE); + mainInterfacePanel.add(getCenterPanel(),null); + mainInterfacePanel.add(getTimeLeftProgressBar(), null); + mainInterfacePanel.add(gateSwitchLabel, null); + mainInterfacePanel.add(scoreBoardLabel, null); } - return downloadScreenPanel; + return mainInterfacePanel; } private JProgressBar getTimeLeftProgressBar() { @@ -561,10 +562,10 @@ centerPanel.add(getCanalPanel(clientDataModel)); //switch(clientGameState.getPriority()){ - downloadScreenPanel.add(getJPanelUpStreamWindow(),null); - downloadScreenPanel.add(getJPanelDownStreamWindow(),null); + mainInterfacePanel.add(getJPanelUpStreamWindow(),null); + mainInterfacePanel.add(getJPanelDownStreamWindow(),null); //adding the in between Panel - downloadScreenPanel.add(getMiddleWindowPanel(),null); + mainInterfacePanel.add(getMiddleWindowPanel(),null); /*case 0 : downloadScreenPanel.add(getJPanelUpStreamWindow(0),null); downloadScreenPanel.add(getJPanelDownStreamWindow(0),null); //Assigning the Priorities on the Priority Label Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml 2009-10-27 02:20:01 UTC (rev 335) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml 2009-10-27 05:49:09 UTC (rev 336) @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> -<comment>Irrigation experiment round configuration</comment> -<!--<entry key="hostname">localhost</entry>--> +<comment>Irrigation experiment server configuration</comment> <entry key="hostname">@SERVER_ADDRESS@</entry> <entry key="port">@PORT_NUMBER@</entry> <entry key="round0">round0.xml</entry> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-27 02:20:14
|
Revision: 335 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=335&view=rev Author: alllee Date: 2009-10-27 02:20:01 +0000 (Tue, 27 Oct 2009) Log Message: ----------- refactoring code in an attempt to clearly disambiguate between the irrigation capacity (theoretical maximum) and water supply (actual amount of water available to flow through the irrigation canal). Fixed bug where chat logs were not being persisted properly. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-10-26 21:07:55 UTC (rev 334) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-10-27 02:20:01 UTC (rev 335) @@ -68,7 +68,7 @@ if (timer != null) { timer.stop(); } - this.maximumIrrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableFlowCapacity(); + this.maximumIrrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableWaterFlow(); this.clientDataModel = clientDataModel; initialize(); } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java 2009-10-26 21:07:55 UTC (rev 334) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java 2009-10-27 02:20:01 UTC (rev 335) @@ -117,5 +117,13 @@ return clientDataList; } + public int getWaterSupplyCapacity() { + return roundConfiguration.getWaterSupplyCapacity(); + } + public int getIrrigationCapacity() { + return groupDataModel.getIrrigationCapacity(); + } + + } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-26 21:07:55 UTC (rev 334) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-27 02:20:01 UTC (rev 335) @@ -507,20 +507,21 @@ int totalContributedTokens = groupDataModel.getTotalContributedTokens(); final StringBuilder builder = new StringBuilder(); builder.append("Infrastructure efficiency before investment: ") - .append(groupDataModel.getInitialInfrastructureEfficiency()) + .append(groupDataModel.getInfrastructureEfficiencyBeforeInvestment()) .append("%\n"); - builder.append("Irrigation capacity before investment: ").append(groupDataModel.getInitialFlowCapacity()).append(" cubic feet per second\n\n"); + builder.append("Irrigation capacity before investment: ").append(groupDataModel.getIrrigationCapacityBeforeInvestment()).append(" cubic feet per second\n\n"); builder.append( String.format( "Your group invested a total of %d tokens, increasing the infrastructure efficiency to %d%%.\n", totalContributedTokens, groupDataModel.getInfrastructureEfficiency())); - if (groupDataModel.getFlowCapacity() > groupDataModel.getInitialFlowCapacity()) { + if (groupDataModel.getIrrigationCapacity() > groupDataModel.getIrrigationCapacityBeforeInvestment()) { builder.append("Your group's investment has increased the irrigation capacity to "); } else { builder.append("Your group's investment was not enough to increase the irrigation capacity. Your group's irrigation capacity is still "); } - builder.append(groupDataModel.getFlowCapacity()).append(" cubic feet of water per second."); + builder.append(groupDataModel.getIrrigationCapacity()).append(" cubic feet of water per second. The amount of water available to pass through your irrigation canal is ") + .append(groupDataModel.getActualFlowCapacity()); SwingUtilities.invokeLater(new Runnable() { public void run() { contributionInformationTextArea.setText(builder.toString()); @@ -601,7 +602,7 @@ else { instructionsBuilder.append(roundConfiguration.getInstructions()); instructionsBuilder.append("<hr/>"); - int irrigationCapacity = clientDataModel.getGroupDataModel().getFlowCapacity(); + int irrigationCapacity = clientDataModel.getGroupDataModel().getIrrigationCapacity(); int clientCapacity = roundConfiguration.getMaximumClientFlowCapacity(); if (roundConfiguration.shouldResetInfrastructureEfficiency()) { instructionsBuilder.append("The irrigation infrastructure efficiency is currently 75%."); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java 2009-10-26 21:07:55 UTC (rev 334) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java 2009-10-27 02:20:01 UTC (rev 335) @@ -54,7 +54,7 @@ int x,y; GroupDataModel group = client.getClientDataModel().getGroupDataModel(); final int infrastructureEfficiency = group.getInfrastructureEfficiency(); - final int actualFlowCapacity = group.getFlowCapacity(); + final int actualFlowCapacity = group.getIrrigationCapacity(); for (y = 0; y <= actualFlowCapacity; y++) { actualFlowCapacitySeries.add(infrastructureEfficiency, y); } @@ -62,10 +62,10 @@ y = group.calculateFlowCapacity(x); potentialFlowCapacitySeries.add(x,y); } - final int initialInfrastructureEfficiency = group.getInitialInfrastructureEfficiency(); - final int initialFlowCapacity = group.calculateFlowCapacity(initialInfrastructureEfficiency); - for (y = 0; y <= initialFlowCapacity; y++) { - initialInfrastructureEfficiencySeries.add(initialInfrastructureEfficiency, y); + final int infrastructureEfficiencyBeforeInvestment = group.getInfrastructureEfficiencyBeforeInvestment(); + final int irrigationCapacityBeforeInvestment = group.getIrrigationCapacityBeforeInvestment(); + for (y = 0; y <= irrigationCapacityBeforeInvestment; y++) { + initialInfrastructureEfficiencySeries.add(infrastructureEfficiencyBeforeInvestment, y); } final XYSeriesCollection data = new XYSeriesCollection(); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java 2009-10-26 21:07:55 UTC (rev 334) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java 2009-10-27 02:20:01 UTC (rev 335) @@ -443,7 +443,7 @@ // getWaterCollectedToTokensTable().setText(clientDataModel.getServerConfiguration().getWaterCollectedToTokensTable()); // getScoreBoxPanel().initialize(clientDataModel); getMiddleWindowPanel().initialize(clientDataModel); - int irrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableFlowCapacity(); + int irrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableWaterFlow(); irrigationCapacityLabel.setText( String.format("Irrigation capacity: %d cubic feet per second (cfps)", irrigationCapacity)); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-26 21:07:55 UTC (rev 334) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-27 02:20:01 UTC (rev 335) @@ -8,6 +8,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.BoxLayout; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JLabel; @@ -22,21 +23,22 @@ import edu.asu.commons.irrigation.server.ClientData; import edu.asu.commons.util.HtmlEditorPane; - - - +/** + * $Id$ + * + * Primary game interface window for the irrigation game. + * + * @author <a href='mailto:All...@as...'>Allen Lee</a>, Sanket Joshi + * @version $Rev$ + */ public class MainIrrigationGameWindow extends JPanel { - //public ChartWindowPanelTokenBandwidth xySeriesDemo; + private static final long serialVersionUID = 5900368694556557132L; - public IrrigationGameWindow controlPanel; + public IrrigationGameWindow controlPanel; - //public ActivitySummaryPanel activitySummaryWindow; + private CanalPanel canalPanel; - public CanalPanel canalPanel; - - private static final long serialVersionUID = 1L; - private JPanel jPanelMain = null; //this contains the CanalPanel private JPanel centerPanel = null; @@ -88,8 +90,10 @@ private JLabel totalTokensEarnedLabel; private JLabel irrigationCapacityLabel; + private JLabel waterSupplyLabel; private JTextField irrigationCapacityTextField; + private JTextField waterSupplyTextField; private HtmlEditorPane waterCollectedToTokensTable; @@ -135,7 +139,11 @@ jPanelMain.setLayout(new BorderLayout(4,4)); jPanelMain.setBackground(Color.WHITE); jPanelMain.setForeground(Color.BLACK); - jPanelMain.add(getIrrigationCapacityLabel(), BorderLayout.NORTH); + JPanel upperPanel = new JPanel(); + upperPanel.setLayout(new BoxLayout(upperPanel, BoxLayout.X_AXIS)); + upperPanel.add(getIrrigationCapacityLabel()); + upperPanel.add(getWaterSupplyLabel()); + jPanelMain.add(upperPanel, BorderLayout.NORTH); jPanelMain.add(getDownloadScreenPanel(), BorderLayout.CENTER); return jPanelMain; } @@ -345,7 +353,7 @@ } return totalTokensEarnedLabel; } - + private JLabel getIrrigationCapacityLabel() { if (irrigationCapacityLabel == null) { irrigationCapacityLabel = new JLabel(); @@ -361,6 +369,21 @@ } return irrigationCapacityTextField; } + + private JLabel getWaterSupplyLabel() { + if (waterSupplyLabel == null) { + waterSupplyLabel = new JLabel("Water supply: "); + waterSupplyLabel.setLabelFor(getWaterSupplyTextField()); + waterSupplyLabel.setFont(new Font("sansserif", Font.BOLD, 16)); + } + return waterSupplyLabel; + } + private JTextField getWaterSupplyTextField() { + if (waterSupplyTextField == null) { + waterSupplyTextField = createTextField(); + } + return waterSupplyTextField; + } /** * This method initializes jPanel3 * summary scoreboard @@ -388,16 +411,6 @@ return waterCollectedToTokensScrollPane; } - private void setProgressBarColor(int timeLeft) { - if (timeLeft < 10) { -// timeLeftProgressBar.setForeground( Color.RED ); -// timeLeftProgressBar.setBackground( Color.RED ); -// return Color.RED; - } - else { -// timeLeftProgressBar.setBackground( Color.GREEN ); - } - } /** * Should be invoked every second throughout the experiment, from a ClientUpdateEvent sent by the server. */ @@ -408,6 +421,7 @@ String timeLeftString = String.format("%d sec", timeLeft); timeLeftProgressBar.setValue( timeLeft ); timeLeftProgressBar.setString(timeLeftString); + // FIXME: figure out how to reliably set the progress bar colors regardless of OS. // setProgressBarColor(timeLeft); for (final ClientData clientData : clientDataModel.getClientDataMap().values()) { if (clientData.isGateOpen()) { @@ -520,10 +534,14 @@ public void startRound() { open = false; getMiddleWindowPanel().initialize(clientDataModel); - int irrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableFlowCapacity(); + int irrigationCapacity = clientDataModel.getIrrigationCapacity(); + int waterSupply = clientDataModel.getWaterSupplyCapacity(); irrigationCapacityLabel.setText( String.format("Irrigation capacity: %d cubic feet per second (cfps)", irrigationCapacity)); + waterSupplyLabel.setText( + String.format("Water supply: %d cubic feet per second (cfps)", + waterSupply)); revalidate(); // mainIrrigationPanel.add(getJPanelUpStreamWindow(),null); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-26 21:07:55 UTC (rev 334) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-27 02:20:01 UTC (rev 335) @@ -30,11 +30,11 @@ private transient Logger logger = Logger.getLogger(GroupDataModel.class.getName()); private int currentlyAvailableFlowCapacity = 0; - private int maximumAvailableFlowCapacity = 0; + private int maximumAvailableWaterFlow = 0; private int infrastructureEfficiency; // infrastructure efficiency before investment (but post decline) - private int initialInfrastructureEfficiency; + private int infrastructureEfficiencyBeforeInvestment; private int totalContributedTokens = 0; @@ -87,7 +87,7 @@ return totalContributedTokens; } - public void calculateTotalFlowCapacity() { + public void initializeInfrastructure() { // for practice round and first round, initialize to initial infrastructure efficiency //setting the total contributed Bandwidth = 0 , so that for every round, // fresh totalContributed tokens are calculated @@ -96,7 +96,7 @@ totalContributedTokens += clientData.getInvestedTokens(); } updateInfrastructureEfficiency(totalContributedTokens); - currentlyAvailableFlowCapacity = maximumAvailableFlowCapacity = getFlowCapacity(); + currentlyAvailableFlowCapacity = maximumAvailableWaterFlow = getActualFlowCapacity(); } private void updateInfrastructureEfficiency(int totalContributedTokens) { @@ -111,7 +111,7 @@ } // set original infrastructure efficiency before token contributions getLogger().info("initial infrastructure efficiency: " + infrastructureEfficiency); - initialInfrastructureEfficiency = infrastructureEfficiency; + infrastructureEfficiencyBeforeInvestment = infrastructureEfficiency; // add total invested tokens to infrastructure efficiency, clamp at // 100 infrastructureEfficiency = Math.min(100, totalContributedTokens + infrastructureEfficiency); @@ -155,19 +155,34 @@ return 40; } - public int getInitialFlowCapacity() { - return Math.min(calculateFlowCapacity(initialInfrastructureEfficiency), getRoundConfiguration().getWaterSupplyCapacity()); + public int getIrrigationCapacityBeforeInvestment() { +// return Math.min(calculateFlowCapacity(initialInfrastructureEfficiency), getRoundConfiguration().getWaterSupplyCapacity()); + return calculateFlowCapacity(infrastructureEfficiencyBeforeInvestment); } - public int getFlowCapacity() { - return Math.min(calculateFlowCapacity(infrastructureEfficiency), getRoundConfiguration().getWaterSupplyCapacity()); + /** + * Returns the theoretical maximum amount of water that the infrastructure can handle. + * This is independent of the actual water supply. + */ + public int getIrrigationCapacity() { + return calculateFlowCapacity(infrastructureEfficiency); +// return Math.min(calculateFlowCapacity(infrastructureEfficiency), getRoundConfiguration().getWaterSupplyCapacity()); } + + /** + * Returns the actual maximum amount of water that can pass through the canal, which is the minimum + * of the irrigation capacity and the water supply. + * @return + */ + public int getActualFlowCapacity() { + return Math.min(getIrrigationCapacity(), getRoundConfiguration().getWaterSupplyCapacity()); + } public void resetCurrentlyAvailableFlowCapacity() { - currentlyAvailableFlowCapacity = maximumAvailableFlowCapacity; + currentlyAvailableFlowCapacity = maximumAvailableWaterFlow; } - public void allocateFlowCapacity(ClientData clientData) { + public void allocateWater(ClientData clientData) { int maximumClientFlowCapacity = getRoundConfiguration().getMaximumClientFlowCapacity(); if (currentlyAvailableFlowCapacity >= maximumClientFlowCapacity) { currentlyAvailableFlowCapacity -= maximumClientFlowCapacity; @@ -180,17 +195,16 @@ clientData.collectWater(); } - - public int getMaximumAvailableFlowCapacity() { - return maximumAvailableFlowCapacity; + public int getMaximumAvailableWaterFlow() { + return maximumAvailableWaterFlow; } public int getInfrastructureEfficiency() { return infrastructureEfficiency; } - public int getInitialInfrastructureEfficiency() { - return initialInfrastructureEfficiency; + public int getInfrastructureEfficiencyBeforeInvestment() { + return infrastructureEfficiencyBeforeInvestment; } public Logger getLogger() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-10-26 21:07:55 UTC (rev 334) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-10-27 02:20:01 UTC (rev 335) @@ -138,6 +138,7 @@ addEventProcessor(new EventTypeProcessor<BeginChatRoundRequest>(BeginChatRoundRequest.class) { @Override public void handle(BeginChatRoundRequest request) { + persister.clearChatData(); // pass it on to all the clients synchronized (clients) { for (Identifier id: clients.keySet()) { @@ -222,6 +223,7 @@ ChatEvent chatEvent = new ChatEvent(request.getTarget(), request.toString(), request.getSource()); transmit(chatEvent); } + persister.store(request); } }); addEventProcessor(new EventTypeProcessor<InvestedTokensEvent>(InvestedTokensEvent.class) { @@ -274,7 +276,7 @@ // post round cleanup ///////////////////////////////////////////////////////////////////////////////// for(GroupDataModel group : serverDataModel.getAllGroupDataModels()){ - group.calculateTotalFlowCapacity(); + group.initializeInfrastructure(); // iterate through all groups and send back their contribution status for (Identifier id : group.getClientDataMap().keySet()) { InfrastructureUpdateEvent infrastructureUpdateEvent = new InfrastructureUpdateEvent(id, group); @@ -309,7 +311,7 @@ // clientData.init(group.getCurrentlyAvailableFlowCapacity()); // } if (clientData.isGateOpen()) { - group.allocateFlowCapacity(clientData); + group.allocateWater(clientData); } else if (clientData.isGateClosed()) { clientData.init(group.getAvailableClientFlowCapacity()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-26 21:08:08
|
Revision: 334 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=334&view=rev Author: alllee Date: 2009-10-26 21:07:55 +0000 (Mon, 26 Oct 2009) Log Message: ----------- updated pom, ivy, and build xmls to deal with problems that came up with deployment at IU. - removed JUnit from ivy dependencies (still need to figure out what the problem is here, raises an error message about duplicate resources) - ivy version bump to 2.1.0 - setting Maven Jetty plugin version to 6.1.21. The jetty-maven-plugin version 7.0 appears to have problems with spaces in Windows and can't start properly. This also means that the default web app context is set to irrigation again. Modified Paths: -------------- irrigation/trunk/build.xml irrigation/trunk/ivy.xml irrigation/trunk/pom.xml Modified: irrigation/trunk/build.xml =================================================================== --- irrigation/trunk/build.xml 2009-10-24 21:34:10 UTC (rev 333) +++ irrigation/trunk/build.xml 2009-10-26 21:07:55 UTC (rev 334) @@ -13,7 +13,7 @@ uri='antlib:org.apache.ivy.ant' classpathref='ivy.lib.path'/> --> - <property name="ivy.install.version" value="2.1.0-rc2" /> + <property name="ivy.install.version" value="2.1.0" /> <condition property="ivy.home" value="${env.IVY_HOME}"> <isset property="env.IVY_HOME" /> </condition> @@ -22,21 +22,10 @@ <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" /> <target name="download-ivy" unless="offline"> - <mkdir dir="${ivy.jar.dir}"/> <!-- download Ivy from web site so that it can be used even without any special installation --> <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/> - <!-- - <get src="http://www.apache.org/dist/ant/ivy/${ivy.install.version}/ivy.jar" - dest="${ivy.jar.file}" usetimestamp="true"/> - <get src="http://www.apache.org/dist/ant/ivy/${ivy.install.version}/apache-ivy-${ivy.install.version}-bin.zip" - dest="${ivy.jar.dir}/ivy-${ivy.install.version}-bin.zip" usetimestamp="true"/> - --> - <!-- FIXME: this should be dependent on the download in the first place - <unzip src='${ivy.jar.dir}/ivy-${ivy.install.version}-bin.zip' dest='${ivy.jar.dir}' overwrite='false' /> - <move file='${ivy.jar.dir}/apache-ivy-${ivy.install.version}/ivy-${ivy.install.version}.jar' tofile='${ivy.jar.file}' overwrite='false' /> - --> </target> <target name="init-ivy" depends="download-ivy"> Modified: irrigation/trunk/ivy.xml =================================================================== --- irrigation/trunk/ivy.xml 2009-10-24 21:34:10 UTC (rev 333) +++ irrigation/trunk/ivy.xml 2009-10-26 21:07:55 UTC (rev 334) @@ -5,7 +5,6 @@ <ivy-module version="2.0"> <info organisation="edu.asu.commons" module="irrigation"/> <dependencies> - <dependency org="junit" name="junit" rev="latest.integration"/> <dependency org="edu.asu.commons" name="csidex" rev="0.2-SNAPSHOT"/> <dependency org="jfree" name="jfreechart" rev="1.0.13"/> <dependency org="jfree" name="jcommon" rev="1.0.16"/> Modified: irrigation/trunk/pom.xml =================================================================== --- irrigation/trunk/pom.xml 2009-10-24 21:34:10 UTC (rev 333) +++ irrigation/trunk/pom.xml 2009-10-26 21:07:55 UTC (rev 334) @@ -84,7 +84,8 @@ </plugin> <plugin> <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty-maven-plugin</artifactId> + <artifactId>maven-jetty-plugin</artifactId> + <version>6.1.21</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> </configuration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-24 21:34:20
|
Revision: 333 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=333&view=rev Author: alllee Date: 2009-10-24 21:34:10 +0000 (Sat, 24 Oct 2009) Log Message: ----------- changing == to >= for token submission round notification Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/Facilitator.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/Facilitator.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/Facilitator.java 2009-10-24 21:19:51 UTC (rev 332) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/Facilitator.java 2009-10-24 21:34:10 UTC (rev 333) @@ -138,7 +138,7 @@ SwingUtilities.invokeLater(createGuiRunnable); } - void sendBeginExperimentRequest(){ + void sendStartRoundOverride(){ transmit(new BeginExperimentRequest(id)); } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java 2009-10-24 21:19:51 UTC (rev 332) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java 2009-10-24 21:34:10 UTC (rev 333) @@ -72,7 +72,7 @@ buttonPanel.add(getBeginChatButton()); buttonPanel.add(getDisplayInvestmentButton()); buttonPanel.add(getStartRoundButton()); - buttonPanel.add(getBeginExperimentButton()); + buttonPanel.add(getStartRoundOverrideButton()); add(buttonPanel, BorderLayout.NORTH); editorPane = new HtmlEditorPane(); editorPane.setEditable(false); @@ -116,14 +116,13 @@ return beginChatButton; } - private JButton getBeginExperimentButton() { + private JButton getStartRoundOverrideButton() { if (beginExperimentButton == null) { - beginExperimentButton = new JButton("Begin experiment"); + beginExperimentButton = new JButton("Override"); beginExperimentButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { - facilitator.sendBeginExperimentRequest(); + facilitator.sendStartRoundOverride(); } - }); } return beginExperimentButton; Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-10-24 21:19:51 UTC (rev 332) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-10-24 21:34:10 UTC (rev 333) @@ -108,6 +108,7 @@ addEventProcessor(new EventTypeProcessor<BeginExperimentRequest>(BeginExperimentRequest.class) { @Override public void handle(BeginExperimentRequest event) { + // sends override and immediately starts the round. synchronized (roundSignal) { roundSignal.notifyAll(); } @@ -122,14 +123,9 @@ return; } // ignore the request if not every group has submit their tokens. - if (submittedClients == clients.size()) { - synchronized (roundSignal) { - roundSignal.notifyAll(); - } - } - else { - System.err.println("clients still haven't submitted their tokens: " + submittedClients + " - # clients: " + clients.size()); - } + synchronized (roundSignal) { + roundSignal.notifyAll(); + } } }); addEventProcessor(new EventTypeProcessor<EndRoundRequest>(EndRoundRequest.class) { @@ -234,7 +230,7 @@ ClientData clientData = clients.get(event.getId()); clientData.setInvestedTokens(event.getInvestedTokens()); submittedClients++; - if (submittedClients == clients.size()) { + if (submittedClients >= clients.size()) { // everyone's submitted their tokens so we can calculate the available bandwidth and // notify each client initializeInfrastructureEfficiency(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |