Similar Code Analysis Report

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

Table of contents

number of lines number of occurrences names of resources
9 2 Rule
12..11 2 GridViewUpdateTriangles, GridViewUpdateSquare
6..5 2 CellDataFactory
5 2 GridModel
16..12 2 Rule
11 2 RuleFish
15..14 2 RuleFish
8 2 RuleFish
7..6 2 CellDataFactory, GridSettingsFactory
3 2 RuleLife, RuleFish
5 2 RuleFire, RuleLife
6..5 2 CellDataFactory
3 2 GridViewUpdateTriangles, GridViewUpdateSquare

List of matches

 

11..12 lines in GridViewUpdateTriangles, GridViewUpdateSquare


GridViewUpdateTriangles
/cellsociety_team24/src/views/grid/GridViewUpdateTriangles.java
GridViewUpdateSquare
/cellsociety_team24/src/views/grid/GridViewUpdateSquare.java
   @Override 
   public void AddCell(int width, int height, Dimension dimensions, Cell currcell, Group root, CellStyleGuide csg) { 
      double cellwidth=(width*0.5)/(dimensions.getWidth()); 
      double cellheight=(height*0.5)/(dimensions.getHeight()); 
      int cellx=currcell.getLocation().getX(); 
      int celly=currcell.getLocation().getY(); 
      Rectangle cellrect = new Rectangle(width*(AppResources.OFFSET)+(cellwidth*cellx),height*(AppResources.OFFSET)+(cellheight*celly),cellwidth,cellheight); 
      ColorCell(currcell,cellrect,csg); 
        root.getChildren().add(cellrect); 
        myShapeCollection.add(cellrect);  
   } 
   @Override 
   public void AddCell(int width, int height,Dimension dimensions,Cell currcell,Group root,CellStyleGuide csg) { 
      double cellwidth=(width*0.5)/(dimensions.getWidth()); 
      double cellheight=(height*0.5)/(dimensions.getHeight()); 
      int cellx=currcell.getLocation().getX(); 
      int celly=currcell.getLocation().getY(); 
      Rectangle cellrect = new Rectangle(width*(AppResources.OFFSET)+(cellwidth*cellx),height*(AppResources.OFFSET)+(cellheight*celly),cellwidth,cellheight); 
      cellMap.put(currcell, cellrect); 
      colorCell(currcell,csg); 
        root.getChildren().add(cellrect); 
        myShapeCollection.add(cellrect);  
   } 
 

14..15 lines in RuleFish (x2)


RuleFish
/cellsociety_team24/src/models/rules/RuleFish.java
RuleFish
/cellsociety_team24/src/models/rules/RuleFish.java
   private Point pickSharkMove(Cell c){ 
      Point[] options = getNeighbors(c.getLocation(), myShape); 
       
      for (int i = 0; i < options.length; i++){ 
         if (options[i] != null && !(getCell(options[i], myGrid).getNextStateID() == 1)) 
            options[i] = null; 
      } 
      ArrayList<Point> nonNullOptions = new ArrayList<Point>(Arrays.asList(options)); 
      nonNullOptions.removeAll(Collections.singleton(null)); 
       
      if (!nonNullOptions.isEmpty()){ 
          Collections.shuffle(nonNullOptions); 
         return nonNullOptions.get(0); 
      } else 
   private Point pickFishMove(Cell c){ 
      Point[] options = getNeighbors(c.getLocation(), myShape); 
       
      for (int i = 0; i < options.length; i++){ 
         if (options[i] != null && occupied(options[i])) 
            options[i] = null; 
      } 
       
      ArrayList<Point> nonNullOptions = new ArrayList<Point>(Arrays.asList(options)); 
      nonNullOptions.removeAll(Collections.singleton(null)); 
       
      if (!nonNullOptions.isEmpty()){ 
          Collections.shuffle(nonNullOptions); 
         return nonNullOptions.get(0); 
      } else 
9/29/16 2:25 PM Powered by CodePro Server