Similar Code Analysis Report

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

Table of contents

number of lines number of occurrences names of resources
21..18 2 WatorCell
5 2 LifeGrid, FireGrid
20 2 WatorGrid, SegGrid
4..3 2 WatorGrid, SquareRenderer
4 2 SegGrid
10 2 WatorCell
4 2 WatorGrid, SegGrid
4 2 LifeGrid, SegGrid
4 2 WatorGrid, FireGrid

List of matches

 

18..21 lines in WatorCell (x2)


WatorCell
/cellsociety_team16/src/cellsociety_team16/Wator/WatorCell.java
WatorCell
/cellsociety_team16/src/cellsociety_team16/Wator/WatorCell.java
         } else if ( 
            nbr.getState().equals(WatorState.EMPTY) 
            && ( 
               nbr.peepNextState() == null 
               || nbr.peepNextState().equals(WatorState.EMPTY) 
            ) 
         ) { 
            emptyNbrs.add(nbr); 
         } 
      } 
      Collections.shuffle(emptyNbrs); 
       
      /* Get the shark residing in the cell */ 
      Shark shark = (Shark) myAnimal; 
       
      /* Breeding logic */ 
      if (shark.isReadyToBreed() && emptyNbrs.size() > 0) { 
         /* Choose the last cell in the shuffled list as the place to breed*/ 
         shark.breed(); 
         WatorCell emptyCellToBreed = (WatorCell) emptyNbrs.get(emptyNbrs.size() - 1); 
         emptyNbrs.remove(emptyNbrs.size() - 1); 
         if ( 
            nbr.getState().equals(WatorState.EMPTY) 
            && ( 
               nbr.peepNextState() == null 
               || nbr.peepNextState().equals(WatorState.EMPTY) 
            ) 
         ) { 
            emptyNbrs.add(nbr); 
         } 
      } 
      Collections.shuffle(emptyNbrs); 
       
      /* Breeding logic */ 
      if (fish.isReadyToBreed() && emptyNbrs.size() > 0) { 
         /* Choose the last cell in the shuffled list as the place to breed*/ 
         fish.breed(); 
         WatorCell emptyCellToBreed = (WatorCell) emptyNbrs.get(emptyNbrs.size() - 1); 
         emptyNbrs.remove(emptyNbrs.size() - 1); 
 

20 lines in WatorGrid, SegGrid


SegGrid
/cellsociety_team16/src/cellsociety_team16/Seg/SegGrid.java
WatorGrid
/cellsociety_team16/src/cellsociety_team16/Wator/WatorGrid.java
   @Override 
   public void reset() { 
      final int percentEmpty = SimConstant.Seg.PERCENT_EMPTY; 
      final int percentA = SimConstant.Seg.PERCENT_A
      assert( 
         0 <= percentEmpty 
         && percentEmpty < 100 
         && 0 <= percentA 
         && percentA <= 100 
      ); 
      List<SegCell> cellList = new ArrayList<>(); 
       
      /* Add empty cells */ 
      int numEmpty = (int) (percentEmpty / 100.0 * NUM_CELL); 
      for (int i = 0; i < numEmpty; i++) { 
         cellList.add(new SegCell(SegState.EMPTY)); 
      } 
       
      /* Add A-type cells */ 
      int numA = (int) (percentA / 100.0 * (NUM_CELL - numEmpty)); 
   @Override 
   public void reset() { 
      final int percentEmpty = SimConstant.Wator.PERCENT_EMPTY; 
      final int percentShark = SimConstant.Wator.PERCENT_SHARK
      assert( 
         0 <= percentEmpty 
         && percentEmpty < 100 
         && 0 <= percentShark 
         && percentShark <= 100 
      ); 
      List<WatorCell> cellList = new ArrayList<>(); 
       
      /* Add empty cells */ 
      int numEmpty = (int) (percentEmpty / 100.0 * NUM_CELL); 
      for (int i = 0; i < numEmpty; i++) { 
         cellList.add(new WatorCell(WatorState.EMPTY, null)); 
      } 
       
      /* Add shark cells */ 
      int numShark = (int) (percentShark / 100.0 * (NUM_CELL - numEmpty)); 
9/29/16 2:21 PM Powered by CodePro Server