Similar Code Analysis Report

This document contains the results of performing a similar code analysis of projectscellsociety_team15 at 9/24/15 1:57 PM.

Table of contents

number of lines number of occurrences names of resources
17..13 2 PredatorGridManager
5 2 GridManager, SimulationView
17..13 2 PredatorGridManager, SegregationGridManager
12..8 2 GolGridManager, PredatorGridManager
4..3 2 Predator, Segregation
7..5 2 GolGridManager, PredatorGridManager
3 2 SegregationGridManager, FireGridMananger
8 2 PredatorSharkCell, PredatorFishCell
5..4 2 SegregationGridManager, GridManager
4 2 Fire, GameOfLife
4 2 PredatorGridManager
6..5 2 FireGridMananger
8 2 PredatorGridManager
6 2 GolButtonBar, PredatorButtonBar
10 2 GolButtonBar, PredatorButtonBar
3 2 XMLParser
3 2 PredatorGridManager

List of matches

 

13..17 lines in PredatorGridManager (x2)


PredatorGridManager
/cellsociety_team15/src/cellsociety_team15/PredatorGridManager.java
PredatorGridManager
/cellsociety_team15/src/cellsociety_team15/PredatorGridManager.java
    private ArrayList<SingleGrid> findEmpties (SingleGrid changeGrid, 
                                               ArrayList<ArrayList<SingleGrid>> neighbors) { 
        ArrayList<SingleGrid> empties = new ArrayList<SingleGrid>(); 
        for (int i = 0; i < neighbors.get(0).size(); i++) { 
            for (int j = 0; j < neighbors.size(); j++) { 
                SingleGrid testGrid = neighbors.get(j).get(i); 
                if (pRule.isDirectNeighbor(changeGridtestGrid) && testGrid.getCell() == null) 
                    empties.add(testGrid); 
                } 
            } 
        } 
        return empties
    } 
    private ArrayList<SingleGrid> buildFishGrid (SingleGrid changeGrid, 
                                                 ArrayList<ArrayList<SingleGrid>> neighbors) { 
        ArrayList<SingleGrid> neighborFish = new ArrayList<SingleGrid>(); 
 
        for (int i = 0; i < neighbors.get(0).size(); i++) { 
            for (int j = 0; j < neighbors.size(); j++) { 
                SingleGrid checkGrid = neighbors.get(j).get(i); 
                PredatorCell checkCell = (PredatorCell) checkGrid.getCell(); 
 
                if (pRule.isDirectNeighbor(checkGridchangeGrid) && checkCell != null && 
                    checkCell.getType().equals("fish")) { 
                    neighborFish.add(checkGrid); 
                } 
            } 
        } 
        return neighborFish
    } 
 

13..17 lines in PredatorGridManager, SegregationGridManager


SegregationGridManager
/cellsociety_team15/src/cellsociety_team15/SegregationGridManager.java
PredatorGridManager
/cellsociety_team15/src/cellsociety_team15/PredatorGridManager.java
   @Override 
   /** 
    * Randomly set cells to initialize 
    */ 
   void setCellsInGrid() { 
      // TODO Auto-generated method stub 
      Random rand = new Random(); 
      int max = 10; 
      int min = 1; 
      for(int i = 0; i < getMyGrid().get(0).size(); i++){ 
         for(int j = 0; j < getMyGrid().size(); j++){ 
            //TODO: BAD CODE MUST REFACTOR 
            int r = rand.nextInt(max - min + 1) + min; 
            if (r == 3 || r == 4 || r == 5){ 
               getGridAtPosition(i,j).setCell(new SegregationCell(xThreshold,  
                     ((Segregation)getRule()).getXColor(), "x")); 
            else if(r == 7 /*|| r == 8 || r == 9 || r == 10*/){ 
    @Override 
    void setCellsInGrid () { 
        Random rand = new Random(); 
        int max = 10; 
        int min = 1; 
        for (int i = 0; i < getMyGrid().get(0).size(); i++) { 
            for (int j = 0; j < getMyGrid().size(); j++) { 
                // TODO: BAD CODE MUST REFACTOR 
                int r = rand.nextInt(max - min + 1) + min; 
                if (r == 3 || r == 4 || r == 5) { 
                    getGridAtPosition(i, j).setCell(new PredatorFishCell(fishTillBreedLength)); 
                
                else if (r == 7 /* || r == 8 || r == 9 || r == 10 */) { 
9/24/15 1:57 PM Powered by CodePro Server