This document contains the results of performing a similar code analysis of projectscellsociety_team23 at 9/29/16 2:24 PM.
Grid /cellsociety_team23/src/cellUtil/Grid.java |
Grid /cellsociety_team23/src/cellUtil/Grid.java |
public void setFullSquareNeighbors(int i, int j, Cell currCell){ currCell.getNeighbors().clear(); // Top Left if(inBounds(i - 1 , j - 1)) currCell.getNeighbors().add(getCell(i - 1, j - 1)); // Top Middle if(inBounds(i , j - 1)) currCell.getNeighbors().add(getCell(i , j - 1 ));
|
public void cardinalNeighbors(int i, int j, Cell currCell){ currCell.getNeighbors().clear(); // Top Middle if(inBounds(i , j - 1)) currCell.getNeighbors().add(getCell(i , j - 1 ));
|
Grid /cellsociety_team23/src/cellUtil/Grid.java |
Grid /cellsociety_team23/src/cellUtil/Grid.java |
if(inBounds(i + 1 , j )) currCell.getNeighbors().add(getCell(i + 1, j )); // Bottom Right if(inBounds(i + 1 , j + 1)) currCell.getNeighbors().add(getCell(i + 1, j + 1)); // Bottom Middle if(inBounds(i , j + 1)) currCell.getNeighbors().add(getCell(i , j + 1));
|
if(inBounds(i + 1 , j )) currCell.getNeighbors().add(getCell(i + 1, j )); // Bottom Middle if(inBounds(i , j + 1)) currCell.getNeighbors().add(getCell(i , j + 1));
|
4 lines in SimulationVisualizer (x2), Grid
SimulationVisualizer /cellsociety_team23/src/simulation/SimulationVisualizer.java |
SimulationVisualizer /cellsociety_team23/src/simulation/SimulationVisualizer.java |
Grid /cellsociety_team23/src/cellUtil/Grid.java |
private void updateGridColor(Color[][] colorGrid){ myGridRoot = new Group(); for (int i = 0; i < myShapeGrid.length; i++) { for (int j = 0; j < myShapeGrid.length; j++) {
|
private void initShapeGrid(int size){ myShapeGrid = new Shape[size][size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) {
|
public void setNeighbors(SimulationType simType){ for (int i = 0; i < mySize; i++) { for (int j = 0; j < mySize; j++) {
|
4..6 lines in WaTorWorldSimulation, AbstractSimulation
WaTorWorldSimulation /cellsociety_team23/src/simulation/types/WaTorWorldSimulation.java |
AbstractSimulation /cellsociety_team23/src/simulation/types/AbstractSimulation.java |
private void initSharkAgeAndEnergy(){ for (int x = 0; x < mySize; x++) for (int y = 0; y < mySize; y++) {
|
public Color[][] showCurrColorGrid() { Color[][] colorGrid = new Color[mySize][mySize]; for (int i = 0; i < mySize; i++) { for (int j = 0; j < mySize; j++) {
|
10 lines in WaTorWorldSimulation, SegregationSimulation
WaTorWorldSimulation /cellsociety_team23/src/simulation/types/WaTorWorldSimulation.java |
SegregationSimulation /cellsociety_team23/src/simulation/types/SegregationSimulation.java |
@Override protected void updateGrid(){ // Updates in sequential order, rather than in parallel for (int i = 0; i < this.mySize; i++) { for (int j = 0; j < mySize; j++) { updateCell( myCurrGrid.getCell(i, j)); } } }
|
@Override protected void updateGrid(){ myNextGrid = new Grid(myCurrGrid.getSize()); for (int i = 0; i < this.mySize; i++) { for (int j = 0; j < mySize; j++) { updateCell( myCurrGrid.getCell(i, j)); } }
|
Grid /cellsociety_team23/src/cellUtil/Grid.java |
Grid /cellsociety_team23/src/cellUtil/Grid.java |
public Grid( Grid that ){ this.mySize = that.mySize; myCellGrid = new Cell[mySize][mySize]; for (int i = 0; i < that.mySize; i++) { for (int j = 0; j < that.mySize; j++) {
|
public Grid(int n){ mySize = n; myCellGrid = new Cell[mySize][mySize]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) {
|
9..10 lines in SegregationSimulation (x2)
SegregationSimulation /cellsociety_team23/src/simulation/types/SegregationSimulation.java |
SegregationSimulation /cellsociety_team23/src/simulation/types/SegregationSimulation.java |
else if (currState.equals(AMP)){ if (percentNeighborsSame(AMP, curr) <= mySatisfactionThreshold) { myUnsatisfiedCitizens.push(curr.getActor()); myEmptyCellPoints.push(curr.getLocation()); } else { myNextGrid.setCell(location.x, location.y, newCell); } }
|
else if (currState.equals(OHM)){ if ( percentNeighborsSame(OHM, curr) <= mySatisfactionThreshold) { myUnsatisfiedCitizens.push(curr.getActor()); myEmptyCellPoints.push(curr.getLocation()); } else { myNextGrid.setCell(location.x, location.y, newCell); } }
|
UX /cellsociety_team23/src/cellsociety_team23/UX.java |
UX /cellsociety_team23/src/cellsociety_team23/UX.java |
private void resetGridRoot() { root.getChildren().remove(gridRoot); gridRoot = simulationControl.returnCurrVisualGrid(); root.getChildren().add(gridRoot); }
|
private void advanceGridRoot() { root.getChildren().remove(gridRoot); gridRoot = simulationControl.returnNextVisualGrid(); root.getChildren().add(gridRoot); }
|
UX /cellsociety_team23/src/cellsociety_team23/UX.java |
UX /cellsociety_team23/src/cellsociety_team23/UX.java |
private void displayInstructions() { instructionsText = new Text(INSTRUCTIONSX, INSTRUCTIONSY, myResources.getString("Instructions")); root.getChildren().add(setTextLayout(instructionsText, INSTRUCTIONS_SIZE)); }
|
private void displaySliderText() { sliderText = new Text(SLIDER_TEXT_X, SLIDER_TEXT_Y, myResources.getString("SliderText")); root.getChildren().add(setTextLayout(sliderText, SLIDER_TEXT_SIZE)); }
|
8..9 lines in WaTorWorldSimulation, SegregationSimulation
SegregationSimulation /cellsociety_team23/src/simulation/types/SegregationSimulation.java |
WaTorWorldSimulation /cellsociety_team23/src/simulation/types/WaTorWorldSimulation.java |
@Override protected void initColorMap() { this.myColorMap = new HashMap<Enum, Color>(); myColorMap.put(EMPTY, Color.WHITE); myColorMap.put(AMP, Color.RED); myColorMap.put(OHM, Color.BLUE); }
|
@Override protected void initColorMap() { this.myColorMap = new HashMap<Enum, Color>(); myColorMap.put(OCEAN, Color.BLUE); myColorMap.put(SHARK, Color.GRAY); myColorMap.put(FISH, Color.GOLD); }
|
Grid /cellsociety_team23/src/cellUtil/Grid.java |
Grid /cellsociety_team23/src/cellUtil/Grid.java |
if(inBounds(i - 1 , j )) currCell.getNeighbors().add(getCell(i - 1, j ));
|
if(inBounds(i - 1 , j )) currCell.getNeighbors().add(getCell(i - 1, j ));
|