[virtualcommons-svn] commit/foraging: alllee: merging default back into stable, switching to csidex
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2012-02-09 01:58:03
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/d95ed5c0ebd9/ changeset: d95ed5c0ebd9 branch: stable user: alllee date: 2012-02-09 02:57:58 summary: merging default back into stable, switching to csidex-0.4 affected #: 14 files diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 ivy.xml --- a/ivy.xml +++ b/ivy.xml @@ -5,7 +5,7 @@ <ivy-module version="2.0"><info organisation="edu.asu.commons" module="foraging"/><dependencies> - <dependency org="edu.asu.commons" name="csidex" rev="0.3-SNAPSHOT" /> + <dependency org="edu.asu.commons" name="csidex" rev="0.4-SNAPSHOT" /><dependency org="net.java.dev.jogl" name="jogl" rev="1.1.1-rc6"/><dependency org="javax.media" name="jmf" rev="2.1.1e"/><dependency org="javax.jnlp" name="javaws" rev="1.6.0_30"/> diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 pom.xml --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,7 @@ <dependency><groupId>edu.asu.commons</groupId><artifactId>csidex</artifactId> - <version>0.3-SNAPSHOT</version> + <version>0.4-SNAPSHOT</version></dependency><dependency><groupId>net.java.dev.jogl</groupId> diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java --- a/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java @@ -285,8 +285,4 @@ throw new UnsupportedOperationException("3D support is currently unavailable"); } - public String getLastRoundDebriefing() { - return getRoundConfiguration().getLastRoundDebriefing(getId()); - } - } diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/client/ForagingClient.java --- a/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java +++ b/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java @@ -49,6 +49,7 @@ import edu.asu.commons.foraging.ui.GameWindow2D; import edu.asu.commons.foraging.ui.GameWindow3D; import edu.asu.commons.net.SocketIdentifier; +import edu.asu.commons.ui.UserInterfaceUtils; import edu.asu.commons.util.Duration; import edu.asu.commons.util.Utils; @@ -424,10 +425,7 @@ client.connect(); frame.setTitle("Client Window: " + client.getId()); frame.add(client.clientPanel); - frame.pack(); - frame.setExtendedState(Frame.MAXIMIZED_BOTH); - frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - frame.setVisible(true); + UserInterfaceUtils.maximize(frame); } }; SwingUtilities.invokeLater(createGuiRunnable); diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java --- a/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java +++ b/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java @@ -330,12 +330,6 @@ return getProperty("regulation-instructions"); } - public String getLastRoundDebriefing(Identifier id) { - ST template = createStringTemplate(getProperty("last-round-debriefing")); - template.add("id", id); - return template.render(); - } - /** * FIXME: quiz instructions and quiz enabled should be tightly coupled.. * diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/conf/ServerConfiguration.java --- a/src/main/java/edu/asu/commons/foraging/conf/ServerConfiguration.java +++ b/src/main/java/edu/asu/commons/foraging/conf/ServerConfiguration.java @@ -48,15 +48,15 @@ } public String getLogFileDestination() { - return assistant.getStringProperty("log", DEFAULT_LOG_FILE_DESTINATION); + return getStringProperty("log", DEFAULT_LOG_FILE_DESTINATION); } public boolean shouldUpdateFacilitator() { - return assistant.getBooleanProperty("update-facilitator", false); + return getBooleanProperty("update-facilitator", false); } public boolean isCensoredChat() { - return assistant.getBooleanProperty("censored-chat-enabled", false); + return getBooleanProperty("censored-chat-enabled", false); } public boolean shouldInitialize3D() { @@ -77,19 +77,19 @@ } public double getShowUpPayment() { - return assistant.getDoubleProperty("show-up-payment", DEFAULT_SHOW_UP_PAYMENT); + return getDoubleProperty("show-up-payment", DEFAULT_SHOW_UP_PAYMENT); } public double getQuizCorrectAnswerReward() { - return assistant.getDoubleProperty("quiz-correct-answer-reward", DEFAULT_QUIZ_CORRECT_ANSWER_REWARD); + return getDoubleProperty("quiz-correct-answer-reward", DEFAULT_QUIZ_CORRECT_ANSWER_REWARD); } public String getWelcomeInstructions() { - return assistant.getStringProperty("welcome-instructions", "Please wait quietly and do not open or close any programs on this computer."); + return getStringProperty("welcome-instructions", "Please wait quietly and do not open or close any programs on this computer."); } public String getGeneralInstructions() { - ST st = createStringTemplate(assistant.getStringProperty("general-instructions")); + ST st = createStringTemplate(getStringProperty("general-instructions")); NumberFormat formatter = NumberFormat.getCurrencyInstance(); st.add("showUpPayment", formatter.format(getShowUpPayment())); st.add("dollarsPerToken", formatter.format(getDollarsPerToken())); @@ -97,11 +97,11 @@ } public String getSameAsPreviousRoundInstructions() { - return assistant.getStringProperty("same-as-previous-round-instructions", SAME_ROUND_AS_PREVIOUS_INSTRUCTIONS); + return getStringProperty("same-as-previous-round-instructions", SAME_ROUND_AS_PREVIOUS_INSTRUCTIONS); } public String getFieldOfVisionInstructions() { - return assistant.getProperty("field-of-vision-instructions", + return getProperty("field-of-vision-instructions", "Your view of the resource will be limited in this round. The area visible to you will be shaded."); } @@ -114,20 +114,20 @@ } public String getFinalRoundFacilitatorInstructions() { - return assistant.getProperty("facilitator-payment-instructions", + return getProperty("facilitator-payment-instructions", "<h3>The experiment has ended and participant payments are listed above. We recommend that you copy and paste it into a text editor for your records.</h3>"); } public String getSurveyInstructions() { - return assistant.getProperty("survey-instructions"); + return getProperty("survey-instructions"); } public String getFacilitatorDebriefing() { - return assistant.getProperty("facilitator-debriefing"); + return getProperty("facilitator-debriefing"); } public String getClientDebriefing() { - return assistant.getProperty("client-debriefing"); + return getProperty("client-debriefing"); } public double getTotalIncome(ClientData data) { @@ -144,19 +144,19 @@ } public String getInitialVotingInstructions() { - return assistant.getProperty("initial-voting-instructions"); + return getProperty("initial-voting-instructions"); } public String getVotingResults() { - return assistant.getProperty("voting-results"); + return getProperty("voting-results"); } public int getServerSleepInterval() { - return assistant.getIntProperty("server-sleep-interval", 50); + return getIntProperty("server-sleep-interval", 50); } public String getWaitingRoomInstructions() { - return assistant.getProperty("waiting-room-instructions", "<h1>Please wait</h1><hr><p>Please wait while the rest of the participants complete the task.</p>"); + return getProperty("waiting-room-instructions", "<h1>Please wait</h1><hr><p>Please wait while the rest of the participants complete the task.</p>"); } } diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/data/AggregateTimeIntervalProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AggregateTimeIntervalProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AggregateTimeIntervalProcessor.java @@ -6,7 +6,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.TreeSet; import edu.asu.commons.event.PersistableEvent; @@ -29,7 +28,7 @@ import edu.asu.commons.util.Utils; /** - * $Id: AggregateTimeIntervalProcessor.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Generates aggregate statistics * @@ -50,7 +49,7 @@ } RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); TreeSet<Identifier> orderedIdentifiers = new TreeSet<Identifier>(serverDataModel.getClientDataMap().keySet()); - List<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); + List<GroupDataModel> groups = serverDataModel.getOrderedGroups(); List<String> movementHeader = new ArrayList<String>(); List<String> collectedTokensHeader = new ArrayList<String>(); @@ -60,17 +59,17 @@ } // 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"); + for (GroupDataModel group: groups) { + String groupNumber = group.toString(); + tokenProbabilityGroupNumberHeader.add(groupNumber + " avg token P"); + tokensLeftGroupNumberHeader.add(groupNumber + " tokens left"); - List<Identifier> ids = new ArrayList<Identifier>(groups.get(groupIndex).getOrderedClientIdentifiers()); + List<Identifier> ids = new ArrayList<Identifier>(group.getOrderedClientIdentifiers()); for (int i = 0; i < ids.size(); i++) { Identifier id = ids.get(i); for (int j = i+1; j < ids.size(); j++) { @@ -87,9 +86,9 @@ // tokens Utils.join(',', collectedTokensHeader), // group token probabilities - // Utils.join(',', tokenProbabilityGroupNumberHeader), + Utils.join(',', tokenProbabilityGroupNumberHeader), // group total tokens left - // Utils.join(',', tokensLeftGroupNumberHeader), + Utils.join(',', tokensLeftGroupNumberHeader), // distance between participants Utils.join(',', distanceHeader) ); @@ -190,15 +189,15 @@ return distances; } - private List<Double> getExpectedTokenProbabilities(ServerDataModel state) { + private List<Double> getExpectedTokenProbabilities(ServerDataModel serverDataModel) { List<Double> expectedTokens = new ArrayList<Double>(); - Set<GroupDataModel> groups = state.getGroups(); - ResourceDispenser dispenser = new ResourceDispenser(state); + List<GroupDataModel> groups = serverDataModel.getOrderedGroups(); + ResourceDispenser dispenser = new ResourceDispenser(serverDataModel); StochasticGenerator generator = dispenser.getDensityDependentGenerator(); for (GroupDataModel group: groups) { double tokenProbabilitySum = 0; - for (int x = 0; x < state.getBoardWidth(); x++) { - for (int y = 0; y < state.getBoardHeight(); y++) { + for (int x = 0; x < serverDataModel.getBoardWidth(); x++) { + for (int y = 0; y < serverDataModel.getBoardHeight(); y++) { if (! group.getResourcePositions().contains(new Point(x, y))) { tokenProbabilitySum += generator.getProbabilityForCell(group, x, y); } diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/data/AggregateTokenSpatialDistributionProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AggregateTokenSpatialDistributionProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AggregateTokenSpatialDistributionProcessor.java @@ -3,8 +3,8 @@ import java.awt.Dimension; import java.awt.Point; import java.io.PrintWriter; -import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.SortedSet; @@ -62,9 +62,8 @@ ServerDataModel serverDataModel, Map<Identifier, ClientSpatialDistribution> clientSpatialDistributionMap) { - ArrayList<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); + List<GroupDataModel> groups = serverDataModel.getOrderedGroups(); for (GroupDataModel group: groups) { -// String groupLabel = "Group # " + groups.indexOf(group); String groupLabel = group.toString(); writer.println("Time, Identifier, Group, # tokens, row stdev, column stdev"); double groupWeightedSpatialMetric = 0.0d; diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/data/CollectedTokenSpatialDistributionProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/CollectedTokenSpatialDistributionProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/CollectedTokenSpatialDistributionProcessor.java @@ -3,8 +3,8 @@ import java.awt.Dimension; import java.awt.Point; import java.io.PrintWriter; -import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.SortedSet; @@ -55,9 +55,8 @@ PrintWriter writer, ServerDataModel serverDataModel, Map<Identifier, ClientSpatialDistribution> clientSpatialDistributionMap) { - ArrayList<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); + List<GroupDataModel> groups = serverDataModel.getOrderedGroups(); for (GroupDataModel group: groups) { -// String groupLabel = "Group #" + groups.indexOf(group); String groupLabel = group.toString(); writer.println("Identifier, Group, # tokens, row stdev, column stdev"); double groupWeightedSpatialMetric = 0.0d; diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/SummaryProcessor.java @@ -29,7 +29,7 @@ @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); - List<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); + List<GroupDataModel> groups = serverDataModel.getOrderedGroups(); for (GroupDataModel group: groups) { int totalConsumedGroupTokens = 0; ArrayList<String> clientTokens = new ArrayList<String>(); @@ -49,9 +49,8 @@ group, Utils.join(',', clientTokens), group.getResourceDistributionSize(), - totalConsumedGroupTokens, - Utils.join(',', group.getResourceDistribution().keySet()) - )); + totalConsumedGroupTokens) + ); } Map<GroupDataModel, SortedSet<ChatRequest>> chatRequestMap = new HashMap<GroupDataModel, SortedSet<ChatRequest>>(); SortedSet<ChatRequest> allChatRequests = savedRoundData.getChatRequests(); diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java @@ -7,7 +7,6 @@ import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashSet; @@ -16,6 +15,7 @@ import java.util.Queue; import java.util.Random; import java.util.Set; +import java.util.TreeSet; import java.util.logging.Logger; import edu.asu.commons.event.Event; @@ -251,15 +251,11 @@ } public Set<GroupDataModel> getGroups() { - Set<GroupDataModel> groups = new LinkedHashSet<GroupDataModel>(); - groups.addAll(clientsToGroups.values()); - return groups; + return new LinkedHashSet<GroupDataModel>(clientsToGroups.values()); } public List<GroupDataModel> getOrderedGroups() { - ArrayList<GroupDataModel> groups = new ArrayList<GroupDataModel>(clientsToGroups.values()); - Collections.sort(groups); - return groups; + return new ArrayList<GroupDataModel>(new TreeSet<GroupDataModel>(clientsToGroups.values())); } protected ClientData getClientData(Identifier id) { diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/server/ForagingServer.java --- a/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java +++ b/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java @@ -13,10 +13,6 @@ import java.util.ListIterator; import java.util.Map; import java.util.Set; -import java.util.logging.FileHandler; -import java.util.logging.Handler; -import java.util.logging.Logger; -import java.util.logging.SimpleFormatter; import edu.asu.commons.event.BeginRoundRequest; import edu.asu.commons.event.ChatEvent; @@ -99,8 +95,6 @@ */ public class ForagingServer extends AbstractExperiment<ServerConfiguration, RoundConfiguration> { - private final Logger logger = Logger.getLogger(getClass().getName()); - private final Map<Identifier, ClientData> clients = new HashMap<Identifier, ClientData>(); private final HashSet<Identifier> syncSet = new HashSet<Identifier>(); @@ -138,14 +132,6 @@ public ForagingServer(ServerConfiguration configuration) { super(configuration); persister = new ForagingPersister(getEventChannel(), configuration); - try { - Handler logHandler = new FileHandler(configuration.getLogFileDestination(), true); - logHandler.setFormatter(new SimpleFormatter()); - logger.addHandler(logHandler); - } catch (IOException e) { - e.printStackTrace(); - logger.severe("Unable to log to file : " + configuration.getLogFileDestination()); - } } @Override @@ -258,6 +244,7 @@ // reassociation of clients to ids and data. should be // logged however so we can remember the context of the data transmit(new ClientMessageEvent(event.getId(), "The experiment has already started, we cannot add you at this time.")); + sendFacilitatorMessage(String.format("Experiment was already started, not adding %s", event.getId())); return; } Identifier identifier = event.getId(); @@ -273,7 +260,7 @@ public void handle(DisconnectionRequest event) { synchronized (clients) { Identifier id = event.getId(); - logger.warning("Disconnecting client, removing " + id + " from clients " + clients.keySet()); + getLogger().warning("Disconnecting client, removing " + id + " from clients " + clients.keySet()); clients.remove(id); serverDataModel.removeClient(id); } @@ -330,7 +317,7 @@ }); addEventProcessor(new EventTypeProcessor<PostRoundSanctionRequest>(PostRoundSanctionRequest.class) { public void handle(PostRoundSanctionRequest event) { - logger.info("Received post round sanction request"); + getLogger().info("Received post round sanction request"); clients.get(event.getId()).getGroupDataModel().handleSanctionRequest(event); // postRoundSanctionLatch.countDown(); numberOfCompletedSanctions++; @@ -495,7 +482,7 @@ GroupDataModel group = sourceClient.getGroupDataModel(); if (!group.equals(targetClient.getGroupDataModel())) { - logger.severe("source client and target client groups are different: " + sourceClient + targetClient); + getLogger().severe("source client and target client groups are different: " + sourceClient + targetClient); return; } EnforcementMechanism enforcementMechanism = group.getActiveEnforcementMechanism(); @@ -530,7 +517,7 @@ break; case NONE: default: - logger.severe("tried to sanction with EnforcementMechanism.NONE"); + getLogger().severe("tried to sanction with EnforcementMechanism.NONE"); } } @@ -543,7 +530,7 @@ || sourceClient.getGroupDataModel().isResourceDistributionEmpty(); if (invalidSanctionRequest) { // ignore the sanction request, send a message to the sanctioner. - logger.warning("Ignoring token reduction request, sending new client error message event to : " + sourceClient.getId()); + getLogger().warning("Ignoring token reduction request, sending new client error message event to : " + sourceClient.getId()); if (getCurrentRoundConfiguration().isSanctioningEnabled()) { transmit(new ClientMessageEvent(sourceClient.getId(), String.format("Ignoring token reduction request: # %d does not have any tokens to reduce.", targetClient.getAssignedNumber()))); @@ -570,7 +557,7 @@ // add sanction request to the target client so they can figure out who just sanctioned them sourceClient.getLatestSanctions().add(request); targetClient.getLatestSanctions().add(request); - logger.info("target client " + targetClient.getId() + " has sanctions: " + targetClient.getLatestSanctions()); + getLogger().info("target client " + targetClient.getId() + " has sanctions: " + targetClient.getLatestSanctions()); transmit(new ClientMessageEvent(sourceClient.getId(), String.format("Subtracting %d tokens from # %d at the cost of %d to yourself.", subtractedTokens, @@ -616,7 +603,7 @@ public void handle(BeginRoundRequest event) { if (event.getId().equals(facilitatorId)) { if (isReadyToStartRound()) { - logger.info("Begin round request from facilitator - starting round."); + getLogger().info("Begin round request from facilitator - starting round."); experimentStarted = true; Utils.notify(roundSignal); } @@ -707,7 +694,7 @@ for (GroupDataModel group : serverDataModel.getGroups()) { LinkedList<ClientData> clientList = new LinkedList<ClientData>(group.getClientDataMap().values()); Collections.shuffle(clientList); - logger.info("TRUST GAME shuffled client list: " + clientList); + getLogger().info("TRUST GAME shuffled client list: " + clientList); ClientData first = clientList.getFirst(); // using an iterator to consume both players and ensure that a player doesn't @@ -726,7 +713,7 @@ // why doesn't listIterator offer a currentIndex() method as well? // playerTwo = clientList.get(random.nextInt(iter.previousIndex() + 1)); // } - logger.info("TRUST GAME: about to pair " + playerOne + " with " + playerTwo); + getLogger().info("TRUST GAME: about to pair " + playerOne + " with " + playerTwo); TrustGameResult trustGameLog = serverDataModel.calculateTrustGame(playerOne, playerTwo); allTrustGameResults.add(trustGameLog); sendFacilitatorMessage(String.format("Pairing %s with %s for trust game resulted in:\n%s", playerOne, playerTwo, @@ -785,14 +772,14 @@ } private void sendFacilitatorMessage(String message) { - logger.info(message); + getLogger().info(message); if (facilitatorId != null) { transmit(new FacilitatorMessageEvent(facilitatorId, message)); } } private void warnFacilitator(String message) { - logger.warning(message); + getLogger().warning(message); if (facilitatorId != null) { transmit(new FacilitatorMessageEvent(facilitatorId, "!. " + message)); } @@ -899,7 +886,7 @@ } RoundConfiguration nextRoundConfiguration = getConfiguration().nextRound(); serverDataModel.setRoundConfiguration(nextRoundConfiguration); - logger.info("Advancing to round # " + getConfiguration().getCurrentRoundNumber()); + getLogger().info("Advancing to round # " + getConfiguration().getCurrentRoundNumber()); // send the next round configuration to each client for (Identifier id : clients.keySet()) { transmit(new SetConfigurationEvent<RoundConfiguration>(id, nextRoundConfiguration)); @@ -928,7 +915,7 @@ // } for (ClientData data: clients.values()) { if (shouldSynchronize(data)) { - logger.info("Sending full sync to: " + data); + getLogger().info("Sending full sync to: " + data); transmit(new SynchronizeClientEvent(data, currentRoundDuration.getTimeLeft())); syncSet.add(data.getId()); } @@ -1035,11 +1022,11 @@ private void initializeGroups() { // reset group linkages if necessary if (shouldShuffleParticipants()) { - logger.info("Shuffling participants"); + getLogger().info("Shuffling participants"); shuffleParticipants(); } else { - logger.info("Didn't need to shuffle participants : " + getCurrentRoundConfiguration()); + getLogger().info("Didn't need to shuffle participants : " + getCurrentRoundConfiguration()); // shuffleParticipants automatically initializes the client positions // if we don't shuffle, we need to manually re-initialize them. initializeClientPositions(); @@ -1064,7 +1051,7 @@ currentRoundDuration = roundConfiguration.getRoundDuration(); if (roundConfiguration.isVotingAndRegulationEnabled()) { monitorRotationInterval = Math.max(Duration.toSeconds(currentRoundDuration.getTimeLeft()) / roundConfiguration.getClientsPerGroup(), 1); - logger.info("monitor rotation interval: " + monitorRotationInterval); + getLogger().info("monitor rotation interval: " + monitorRotationInterval); } currentRoundDuration.start(); transmit(new FacilitatorUpdateEvent(facilitatorId, serverDataModel, currentRoundDuration.getTimeLeft())); diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java --- a/src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java +++ b/src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java @@ -637,31 +637,31 @@ // FIXME: replace with StringTemplate private void postSanctionDebriefingText(final PostRoundSanctionUpdateEvent event) { - instructionsBuilder.delete(0, instructionsBuilder.length()); - ClientData clientData = event.getClientData(); - // FIXME: split into tokens used to sanction others and tokens taken - // away by other people. - instructionsBuilder.append( - String.format("<h3>Your statistics from the last round have been updated as follows:</h3>" + - "<ul>" + - "<li>Tokens collected last round: %d</li>" + - "<li>Tokens subtracted by other players: %d</li>" + - "<li>Tokens used to subtract tokens from other players: %d</li>" + - "<li>Net earned tokens in the last round: %d</li>" + - "<li>Net income from the last round: $%3.2f</li>" + - "</ul>", - clientData.getTokensCollectedLastRound(), - clientData.getSanctionPenalties(), - clientData.getSanctionCosts(), - clientData.getCurrentTokens(), - getIncome(clientData.getCurrentTokens())) - ); - instructionsBuilder.append(String.format("Your <b>total income</b> so far is: $%3.2f<hr>", - getIncome(clientData.getTotalTokens()))); - if (event.isLastRound()) { - instructionsBuilder.append(client.getDataModel().getLastRoundDebriefing()); - } - setInstructions(instructionsBuilder.toString()); +// instructionsBuilder.delete(0, instructionsBuilder.length()); +// ClientData clientData = event.getClientData(); +// // FIXME: split into tokens used to sanction others and tokens taken +// // away by other people. +// instructionsBuilder.append( +// String.format("<h3>Your statistics from the last round have been updated as follows:</h3>" + +// "<ul>" + +// "<li>Tokens collected last round: %d</li>" + +// "<li>Tokens subtracted by other players: %d</li>" + +// "<li>Tokens used to subtract tokens from other players: %d</li>" + +// "<li>Net earned tokens in the last round: %d</li>" + +// "<li>Net income from the last round: $%3.2f</li>" + +// "</ul>", +// clientData.getTokensCollectedLastRound(), +// clientData.getSanctionPenalties(), +// clientData.getSanctionCosts(), +// clientData.getCurrentTokens(), +// getIncome(clientData.getCurrentTokens())) +// ); +// instructionsBuilder.append(String.format("Your <b>total income</b> so far is: $%3.2f<hr>", +// getIncome(clientData.getTotalTokens()))); +// if (event.isLastRound()) { +// instructionsBuilder.append(client.getDataModel().getLastRoundDebriefing()); +// } +// setInstructions(instructionsBuilder.toString()); } diff -r 570cb75dcb0c7feeabcb03b238ddc0155250f92e -r d95ed5c0ebd91cbeae7c1f529a2d1fe3255e7107 src/main/java/edu/asu/commons/foraging/ui/InstructionsView.java --- a/src/main/java/edu/asu/commons/foraging/ui/InstructionsView.java +++ b/src/main/java/edu/asu/commons/foraging/ui/InstructionsView.java @@ -46,27 +46,28 @@ } public void debrief(ClientDataModel dataModel, boolean lastRound) { - RoundConfiguration roundConfiguration = dataModel.getRoundConfiguration(); - instructionsBuilder.delete(0, instructionsBuilder.length()); - instructionsBuilder.append( - String.format("<h3>Your stats in this round:</h3>" + - "<ul>" + - "<li>Tokens collected: %d</li>" + - "<li>Income: $%3.2f</li>" + - "</ul>", - dataModel.getCurrentTokens(), - dataModel.getCurrentIncome()) - ); - if (roundConfiguration.isPracticeRound()) { - instructionsBuilder.append("<h3>Note - since this was a practice round you did not earn any income this round.</h3>"); - } - double showUpPayment = roundConfiguration.getParentConfiguration().getShowUpPayment(); - instructionsBuilder.append(String.format("Your <b>total income</b> so far (including a $%3.2f bonus for showing up) is : $%3.2f<hr>", - showUpPayment, dataModel.getTotalIncome() + showUpPayment)); - if (lastRound) { - instructionsBuilder.append(dataModel.getLastRoundDebriefing()); - } - setInstructions(instructionsBuilder.toString()); + throw new UnsupportedOperationException("Deprecated"); +// RoundConfiguration roundConfiguration = dataModel.getRoundConfiguration(); +// instructionsBuilder.delete(0, instructionsBuilder.length()); +// instructionsBuilder.append( +// String.format("<h3>Your stats in this round:</h3>" + +// "<ul>" + +// "<li>Tokens collected: %d</li>" + +// "<li>Income: $%3.2f</li>" + +// "</ul>", +// dataModel.getCurrentTokens(), +// dataModel.getCurrentIncome()) +// ); +// if (roundConfiguration.isPracticeRound()) { +// instructionsBuilder.append("<h3>Note - since this was a practice round you did not earn any income this round.</h3>"); +// } +// double showUpPayment = roundConfiguration.getParentConfiguration().getShowUpPayment(); +// instructionsBuilder.append(String.format("Your <b>total income</b> so far (including a $%3.2f bonus for showing up) is : $%3.2f<hr>", +// showUpPayment, dataModel.getTotalIncome() + showUpPayment)); +// if (lastRound) { +// instructionsBuilder.append(dataModel.getLastRoundDebriefing()); +// } +// setInstructions(instructionsBuilder.toString()); } /** Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |