Similar Code Analysis Report

This document contains the results of performing a similar code analysis of projectscellsociety_team08 at 9/29/16 2:18 PM.

Table of contents

number of lines number of occurrences names of resources
15..13 2 Animation
15..11 2 Segregation, Wator
6..5 2 GameOfLife, Fire
4 2 Segregation, Wator
5 2 Fire, Wator
4 2 Wator, Simulation
3 2 Wator, Simulation
2 2 GameOfLife, Fire

List of matches

 

13..15 lines in Animation (x2)


Animation
/cellsociety_team08/src/gui/Animation.java
Animation
/cellsociety_team08/src/gui/Animation.java
   private void drawNewGrid() { 
      double cellSize = GRID_SIZE / mySimulation.getGridHeight(); 
      for (int i = 0; i < mySimulation.getGridHeight(); i++) { 
         for (int j = 0; j < mySimulation.getGridWidth(); j++) { 
            int numVertices = 4; // since we are only implementing squares right now 
            CellNode node = new CellNode(); 
            Polygon cell = node.getCellNode(myGrid, cellSize, Integer.parseInt(myResources.getString("GridOffset")), 
                  i, j, numVertices); 
            String id = Integer.toString(i) + Integer.toString(j); 
            // set a CSS id so we can get this cell later to remove it from the scene 
            cell.setId(id); 
            myRoot.getChildren().add(cell); 
         } 
      } 
   } 
   private void redrawGrid() { 
      clearGrid(); 
      double cellSize = GRID_SIZE / mySimulation.getGridHeight(); 
      for (int i = 0; i < mySimulation.getGridHeight(); i++) { 
         for (int j = 0; j < mySimulation.getGridWidth(); j++) { 
            int numVertices = 4; 
            CellNode node = new CellNode(); 
            Polygon cell = node.getCellNode(myGrid, cellSize, Integer.parseInt(myResources.getString("GridOffset")), 
                  i, j, numVertices); 
            myRoot.getChildren().add(cell); 
         } 
      } 
   } 
 

11..15 lines in Segregation, Wator


Segregation
/cellsociety_team08/src/simulations/Segregation.java
Wator
/cellsociety_team08/src/simulations/Wator.java
   private void setRandomInitialState(Cell currCell) { 
      Random randomNumGenerator = new Random(); 
      int randNum = randomNumGenerator.nextInt(101); 
      if (randNum < percentAgentOne) { 
         currCell.setCurrState(ONE, stateToColorMap.get(ONE)); 
      } 
      else if (randNum >= percentAgentOne && randNum < percentAgentOne + percentAgentTwo) { 
         currCell.setCurrState(TWO, stateToColorMap.get(TWO)); 
      } 
      else { 
         currCell.setCurrState(EMPTY, stateToColorMap.get(EMPTY)); 
   private void setRandomInitialState(Cell currCell) { 
      Random randomNumGenerator = new Random(); 
      int randNum = randomNumGenerator.nextInt(101); 
      if (randNum < myPercentShark) { 
         currCell.setCurrState(SHARK, stateToColorMap.get(SHARK)); 
         mySharks.put(currCell, new Shark(mySharkBreedTime, mySharkStarveTime)); 
      } 
      else if (randNum >= myPercentShark && randNum < myPercentShark + myPercentFish) { 
         currCell.setCurrState(FISH, stateToColorMap.get(FISH)); 
         myFish.put(currCell, new Fish(myFishBreedTime)); 
      } 
      else { 
         currCell.setCurrState(EMPTY, stateToColorMap.get(EMPTY)); 
      } 
   } 
9/29/16 2:18 PM Powered by CodePro Server