[virtualcommons-svn] SF.net SVN: virtualcommons:[362] irrigation/trunk/src/main/java/edu/asu/ commo
Status: Beta
Brought to you by:
alllee
From: <al...@us...> - 2009-11-13 15:14:51
|
Revision: 362 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=362&view=rev Author: alllee Date: 2009-11-13 15:14:42 +0000 (Fri, 13 Nov 2009) Log Message: ----------- minor code hygiene, removing unused code etc. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java 2009-11-13 06:56:43 UTC (rev 361) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java 2009-11-13 15:14:42 UTC (rev 362) @@ -139,7 +139,7 @@ //get the position information of the ball. and then recheck the condition for height. if((balls[i].getPosition() == 1)||(balls[i].getPosition() == 2) || (balls[i].getPosition()==3) || (balls[i].getPosition() == 4) || (balls[i].getPosition() == 5)){ - if(!((!gate[balls[i].getPosition()-1].isOpenGate())&& balls[i].getY() >= (gate[balls[i].getPosition()-1].getY()+gate[balls[i].getPosition()-1].getHeight()))) + if(!((!gate[balls[i].getPosition()-1].isGateOpen())&& balls[i].getY() >= (gate[balls[i].getPosition()-1].getY()+gate[balls[i].getPosition()-1].getHeight()))) graphics.fillOval(balls[i].x,balls[i].y,balls[i].getBallSize(), balls[i].getBallSize()); } else { @@ -161,7 +161,7 @@ private void updateGUI() { for(int i=1;i<6;i++){ - if(gate[i-1].isOpenGate()){ + if(gate[i-1].isGateOpen()){ if(!(gate[i-1].getHeight() - gateHeight < 0)){ gate[i].setHeight(gate[i-1].getHeight() - gateHeight ); @@ -181,7 +181,7 @@ gate[i].setOpeningsY(gate[i].getOpeningsHeight() - 50); //opening the lid logic - if(gate[i].isOpenGate()){ + if(gate[i].isGateOpen()){ gate[i].setx1(gate[i].getx2()); if(!(gate[i].gety2()- gate[i].getGateWidth() < gate[i].getY())) gate[i].sety1(gate[i].gety2()- gate[i].getGateWidth()); @@ -193,7 +193,7 @@ gate[i].sety1(gate[i].getdefaulty1()); } - if(gate[0].isOpenGate()){ + if(gate[0].isGateOpen()){ gate[0].setx1(gate[0].getx2()); if(!(gate[0].gety2()- gate[0].getGateWidth() < gate[0].getY())) gate[0].sety1(gate[0].gety2()- gate[0].getGateWidth()); @@ -280,7 +280,7 @@ case 1: /*if(gate[0].isOpenGate() && (balls[i].x >= 400 && balls[i].x <= 420) && (balls[i].y >= 80 && balls[i].y <= 100)){ - */ if(gate[0].isOpenGate() && (balls[i].x >= gate[0].getOpeningsX() && balls[i].x <= (gate[0].getOpeningsX()+20)) + */ if(gate[0].isGateOpen() && (balls[i].x >= gate[0].getOpeningsX() && balls[i].x <= (gate[0].getOpeningsX()+20)) && (balls[i].y >= 80 && balls[i].y <= 100)){ balls[i].setPosition(7); //directly pass in the information @@ -309,7 +309,7 @@ break; - case 2: if(gate[1].isOpenGate() && (balls[i].x >= gate[1].getOpeningsX() && balls[i].x <= (gate[1].getOpeningsX()+20)) + case 2: if(gate[1].isGateOpen() && (balls[i].x >= gate[1].getOpeningsX() && balls[i].x <= (gate[1].getOpeningsX()+20)) && (balls[i].y >= 80 && balls[i].y <= 100)){ balls[i].setPosition(8); //directly pass in the information @@ -333,7 +333,7 @@ break; - case 3: if(gate[2].isOpenGate() && (balls[i].x >= gate[2].getOpeningsX() && balls[i].x <= (gate[2].getOpeningsX()+20)) + case 3: if(gate[2].isGateOpen() && (balls[i].x >= gate[2].getOpeningsX() && balls[i].x <= (gate[2].getOpeningsX()+20)) && (balls[i].y >= 80 && balls[i].y <= 100)){ balls[i].setPosition(9); //directly pass in the information @@ -356,7 +356,7 @@ } break; - case 4: if(gate[3].isOpenGate() && (balls[i].x >= gate[3].getOpeningsX() && balls[i].x <= (gate[3].getOpeningsX()+20)) + case 4: if(gate[3].isGateOpen() && (balls[i].x >= gate[3].getOpeningsX() && balls[i].x <= (gate[3].getOpeningsX()+20)) && (balls[i].y >= 80 && balls[i].y <= 100)){ balls[i].setPosition(10); //directly pass in the information @@ -379,7 +379,7 @@ } break; - case 5: if(gate[4].isOpenGate() && (balls[i].x >= gate[4].getOpeningsX() && balls[i].x <= (gate[4].getOpeningsX()+20)) + case 5: if(gate[4].isGateOpen() && (balls[i].x >= gate[4].getOpeningsX() && balls[i].x <= (gate[4].getOpeningsX()+20)) && (balls[i].y >= 80 && balls[i].y <= 100)){ balls[i].setPosition(11); //directly pass in the information 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-11-13 06:56:43 UTC (rev 361) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-11-13 15:14:42 UTC (rev 362) @@ -40,8 +40,6 @@ private Random generator = new Random(); - private final static boolean enableBallAnimation = true; - private int maximumIrrigationCapacity; private ClientDataModel clientDataModel; @@ -124,7 +122,7 @@ for(int i=0;i<BALLCOUNT;i++){ if((balls[i].getPosition() == 1)||(balls[i].getPosition() == 2) || (balls[i].getPosition()==3) || (balls[i].getPosition() == 4) || (balls[i].getPosition() == 5)){ - if(!((!gate[balls[i].getPosition()-1].isOpenGate())&& balls[i].getY() >= (gate[balls[i].getPosition()-1].getY()+gate[balls[i].getPosition()-1].getHeight()))) + if(!((!gate[balls[i].getPosition()-1].isGateOpen())&& balls[i].getY() >= (gate[balls[i].getPosition()-1].getY()+gate[balls[i].getPosition()-1].getHeight()))) graphics.fillOval(balls[i].x,balls[i].y,balls[i].getBallSize(), balls[i].getBallSize()); } else{ @@ -144,7 +142,7 @@ private void updateGUI() { for(int i=1;i<6;i++){ - if(gate[i-1].isOpenGate()){ + if(gate[i-1].isGateOpen()){ if(!(gate[i-1].getHeight() - gateHeight < 0)){ gate[i].setHeight(gate[i-1].getHeight() - gateHeight ); @@ -164,7 +162,7 @@ gate[i].setOpeningsY(gate[i].getOpeningsHeight() - 50); //opening the lid logic - if(gate[i].isOpenGate()){ + if(gate[i].isGateOpen()){ gate[i].setx1(gate[i].getx2()); if(!(gate[i].gety2()- gate[i].getGateWidth() < gate[i].getY())) gate[i].sety1(gate[i].gety2()- gate[i].getGateWidth()); @@ -176,7 +174,7 @@ gate[i].sety1(gate[i].getdefaulty1()); } - if(gate[0].isOpenGate()){ + if(gate[0].isGateOpen()){ gate[0].setx1(gate[0].getx2()); if(!(gate[0].gety2()- gate[0].getGateWidth() < gate[0].getY())) gate[0].sety1(gate[0].gety2()- gate[0].getGateWidth()); @@ -237,7 +235,7 @@ } break; - case 1: if(gate[0].isOpenGate() && (balls[i].x >= gate[0].getOpeningsX() && balls[i].x <= (gate[0].getOpeningsX()+gateBuffer)) + case 1: if(gate[0].isGateOpen() && (balls[i].x >= gate[0].getOpeningsX() && balls[i].x <= (gate[0].getOpeningsX()+gateBuffer)) && (balls[i].y >= serverHeight - gateBuffer && balls[i].y <= serverHeight)){ balls[i].setPosition(7); //directly pass in the information @@ -255,7 +253,7 @@ break; - case 2: if(gate[1].isOpenGate() && (balls[i].x >= gate[1].getOpeningsX() && balls[i].x <= (gate[1].getOpeningsX()+gateBuffer)) + case 2: if(gate[1].isGateOpen() && (balls[i].x >= gate[1].getOpeningsX() && balls[i].x <= (gate[1].getOpeningsX()+gateBuffer)) && (balls[i].y >= serverHeight - gateBuffer && balls[i].y <= serverHeight)){ balls[i].setPosition(8); //directly pass in the information @@ -273,7 +271,7 @@ break; - case 3: if(gate[2].isOpenGate() && (balls[i].x >= gate[2].getOpeningsX() && balls[i].x <= (gate[2].getOpeningsX()+gateBuffer)) + case 3: if(gate[2].isGateOpen() && (balls[i].x >= gate[2].getOpeningsX() && balls[i].x <= (gate[2].getOpeningsX()+gateBuffer)) && (balls[i].y >= serverHeight - gateBuffer && balls[i].y <= serverHeight)){ balls[i].setPosition(9); //directly pass in the information @@ -296,7 +294,7 @@ } break; - case 4: if(gate[3].isOpenGate() && (balls[i].x >= gate[3].getOpeningsX() && balls[i].x <= (gate[3].getOpeningsX()+gateBuffer)) + case 4: if(gate[3].isGateOpen() && (balls[i].x >= gate[3].getOpeningsX() && balls[i].x <= (gate[3].getOpeningsX()+gateBuffer)) && (balls[i].y >= serverHeight - gateBuffer && balls[i].y <= serverHeight)){ balls[i].setPosition(10); //directly pass in the information @@ -313,7 +311,7 @@ } break; - case 5: if(gate[4].isOpenGate() && (balls[i].x >= gate[4].getOpeningsX() && balls[i].x <= (gate[4].getOpeningsX()+gateBuffer)) + case 5: if(gate[4].isGateOpen() && (balls[i].x >= gate[4].getOpeningsX() && balls[i].x <= (gate[4].getOpeningsX()+gateBuffer)) && (balls[i].y >= serverHeight - gateBuffer && balls[i].y <= serverHeight)){ balls[i].setPosition(11); //directly pass in the information Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-11-13 06:56:43 UTC (rev 361) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-11-13 15:14:42 UTC (rev 362) @@ -1,19 +1,16 @@ package edu.asu.commons.irrigation.client; import java.awt.BorderLayout; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.swing.JButton; import javax.swing.JEditorPane; -import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JScrollPane; Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java 2009-11-13 06:56:43 UTC (rev 361) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java 2009-11-13 15:14:42 UTC (rev 362) @@ -6,7 +6,7 @@ */ public class Gate { - private boolean openGate = false; + private boolean gateOpen = false; private int height; @@ -40,13 +40,7 @@ private int y2; - private int priority; - - private double totalContributedBandwidth; - public Gate(double totalContributedBandwidth, int priority){ - this.totalContributedBandwidth = totalContributedBandwidth; - this.priority = priority; setWidth(198); setHeight(totalContributedBandwidth*0.8); setOpeningsWidth(gateWidth); @@ -62,7 +56,6 @@ } public void setOpeningsY(int openingsY) { - // TODO Auto-generated method stub this.openingsy = 100 - openingsY; this.y1 = 100 - openingsY; this.y2 = 100 - openingsY; @@ -70,22 +63,18 @@ } public void setOpeningsWidth(int gateWidth) { - // TODO Auto-generated method stub openingsWidth = gateWidth; } public void setOpeningsHeight(double gateHeight) { - // TODO Auto-generated method stub openingsHeight = (int)(gateHeight)+this.gateHeight; } public void setY(int y) { - // TODO Auto-generated method stub this.y = y; } public void setWidth(int width) { - // TODO Auto-generated method stub this.width = width; } @@ -132,106 +121,84 @@ } public int getHeight() { - // TODO Auto-generated method stub return height; } public int getWidth() { - // TODO Auto-generated method stub return width; } public int getY() { - // TODO Auto-generated method stub + return y; } public int getX() { - // TODO Auto-generated method stub return x; } - public boolean isOpenGate(){ - if(openGate == true) - return true; - else - return false; + public boolean isGateOpen(){ + return gateOpen; } - public void setGateOpen(boolean openGate) { - // TODO Auto-generated method stub - this.openGate = openGate; + public void setGateOpen(boolean gateOpen) { + this.gateOpen = gateOpen; } public int getOpeningsHeight() { - // TODO Auto-generated method stub return openingsHeight; } public int getOpeningsX() { - // TODO Auto-generated method stub return openingsx; } public int getOpeningsY() { - // TODO Auto-generated method stub return openingsy; } public int getOpeningsWidth() { - // TODO Auto-generated method stub return openingsWidth; } public int gety2() { - // TODO Auto-generated method stub return y2; } public int gety1() { - // TODO Auto-generated method stub return y1; } public int getx1() { - // TODO Auto-generated method stub return x1; } public int getx2() { - // TODO Auto-generated method stub return x2; } public void setx1(int x1) { - // TODO Auto-generated method stub this.x1 = x1; } public int getGateWidth() { - // TODO Auto-generated method stub return gateWidth; } public void sety1(int y1) { - // TODO Auto-generated method stub this.y1 = y1; } public int getdefaultx1() { - // TODO Auto-generated method stub return defaultx1; } public int getdefaulty1() { - // TODO Auto-generated method stub return defaulty1; } public void sety2(int y2) { - // TODO Auto-generated method stub this.y2 = y2; } - } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java 2009-11-13 06:56:43 UTC (rev 361) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java 2009-11-13 15:14:42 UTC (rev 362) @@ -29,8 +29,8 @@ private JLabel tokensEarnedLabel; - private JLabel tokensNotInvestedLabel; - private JLabel totalTokensEarnedLabel; +// private JLabel tokensNotInvestedLabel; +// private JLabel totalTokensEarnedLabel; private int priority; @@ -55,21 +55,21 @@ // this.add(getTotalTokensEarnedLabel(),null); } - private JLabel getTotalTokensEarnedLabel() { - if (totalTokensEarnedLabel == null) { - totalTokensEarnedLabel = new JLabel(); - totalTokensEarnedLabel.setBounds(new Rectangle(5,10+32+10+20+10+20+10+20+10+30+30,30,20)); - } - return totalTokensEarnedLabel; - } +// private JLabel getTotalTokensEarnedLabel() { +// if (totalTokensEarnedLabel == null) { +// totalTokensEarnedLabel = new JLabel(); +// totalTokensEarnedLabel.setBounds(new Rectangle(5,10+32+10+20+10+20+10+20+10+30+30,30,20)); +// } +// return totalTokensEarnedLabel; +// } - private JLabel getTokensNotInvestedLabel() { - if (tokensNotInvestedLabel == null) { - tokensNotInvestedLabel = new JLabel(String.valueOf(clientData.getUninvestedTokens())); - tokensNotInvestedLabel.setBounds(new Rectangle(5,10+32+10+20+10+20+10+20+10+30,30,20)); - } - return tokensNotInvestedLabel; - } +// private JLabel getTokensNotInvestedLabel() { +// if (tokensNotInvestedLabel == null) { +// tokensNotInvestedLabel = new JLabel(String.valueOf(clientData.getUninvestedTokens())); +// tokensNotInvestedLabel.setBounds(new Rectangle(5,10+32+10+20+10+20+10+20+10+30,30,20)); +// } +// return tokensNotInvestedLabel; +// } private JLabel getTokensEarnedLabel() { if(tokensEarnedLabel == null){ @@ -106,12 +106,12 @@ public void update(ClientData clientData) { this.clientData = clientData; - availableWaterLabel.setText("" + clientData.getAvailableFlowCapacity()); - waterCollectedLabel.setText("" + clientData.getWaterCollected()); - tokensEarnedLabel.setText("" + clientData.getTokensEarnedFromWaterCollected()); + availableWaterLabel.setText(clientData.getAvailableFlowCapacity() + " cfps"); + waterCollectedLabel.setText(clientData.getWaterCollected() + " cf"); + tokensEarnedLabel.setText(String.valueOf(clientData.getTokensEarnedFromWaterCollected())); if(clientData.isGateOpen() && clientData.getAvailableFlowCapacity() > 0) { - // show that client is actively irrigating + // animation displaying active crop growing? } } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java 2009-11-13 06:56:43 UTC (rev 361) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java 2009-11-13 15:14:42 UTC (rev 362) @@ -1,6 +1,5 @@ package edu.asu.commons.irrigation.client; - import java.awt.Dimension; import java.awt.Rectangle; import java.util.ArrayList; @@ -27,7 +26,7 @@ private JLabel availableWaterLabel; private JLabel waterCollectedLabel; private JLabel tokensEarnedLabel; - private JLabel tokensNotInvestedLabel; +// private JLabel tokensNotInvestedLabel; private JLabel totalTokensEarnedLabel; 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-11-13 06:56:43 UTC (rev 361) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java 2009-11-13 15:14:42 UTC (rev 362) @@ -14,11 +14,11 @@ import javax.swing.SwingUtilities; import edu.asu.commons.irrigation.events.BeginChatRoundRequest; +import edu.asu.commons.irrigation.events.FacilitatorEndRoundEvent; import edu.asu.commons.irrigation.events.ShowGameScreenshotRequest; +import edu.asu.commons.irrigation.events.ShowInstructionsRequest; import edu.asu.commons.irrigation.events.ShowQuizRequest; import edu.asu.commons.irrigation.events.ShowTokenInvestmentScreenRequest; -import edu.asu.commons.irrigation.events.FacilitatorEndRoundEvent; -import edu.asu.commons.irrigation.events.ShowInstructionsRequest; import edu.asu.commons.irrigation.server.ClientData; import edu.asu.commons.irrigation.server.GroupDataModel; import edu.asu.commons.irrigation.server.ServerDataModel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |