Similar Code Analysis Report

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

Table of contents

number of lines number of occurrences names of resources
9..7 2 WatorRule
7..6 3 SchellingRule, WatorRule, FireRule
16..13 2 LifeRule
3 2 Playground, WatorRule
7..5 2 SchellingRule, WatorRule
7..5 2 Rule
6 2 LifeRule, FireRule
4 2 WatorRule, FireRule
11 2 WatorRule
11..10 2 WatorRule
12..11 2 LifeRule, FireRule
11 2 SchellingRule, LifeRule
4 3 Playground
8 2 SchellingRule, WatorRule
13..12 2 WatorRuleXMLFactory, SchellingRuleXMLFactory
7..6 2 LifeRuleXMLFactory, FireRuleXMLFactory
6..5 3 WatorRule
5..4 2 Rule, WatorRule
5..4 2 Rule, WatorRule
4 2 Playground, StartScreen
5..4 2 SchellingRule, FireRule
3 2 SchellingRule, WatorRule
5..4 2 Rule, WatorRule
5..4 2 Rule, WatorRule
3..2 2 WatorRule
7 2 WatorRule
2 2 FireRuleXMLFactory, SchellingRuleXMLFactory
3 2 Playground

List of matches

 

13..16 lines in LifeRule (x2)


LifeRule
/cellsociety_team14/src/layout/rule/LifeRule.java
LifeRule
/cellsociety_team14/src/layout/rule/LifeRule.java
   private void initExploder() { 
      for (int i = 0; i < myRow; i++) { 
         for (int j = 0; j < myColumn; j++) { 
            myGrid[i][j].init(LIVE, myColors[LIVE], NUMNEIGHBOR); 
            if ((i >= myRow / 2 - 2 && i <= myRow / 2 + 2 && j == myColumn / 2 - 2) 
                  || (i >= myRow / 2 - 2 && i <= myRow / 2 + 2 && j == myColumn / 2 + 2) 
                  || (i == myRow / 2 - 2 && j == myColumn / 2|| (i == myRow / 2 + 2 && j == myColumn / 2)) { 
               myGrid[i][j].init(LIVE, myColors[LIVE], NUMNEIGHBOR); 
               myUpdatedGrid[i][j] = LIVE; 
            } else { 
               myGrid[i][j].init(EMPTY, myColors[EMPTY], NUMNEIGHBOR); 
               myUpdatedGrid[i][j] = EMPTY; 
            } 
         } 
      } 
   } 
   private void init10Cell() { 
      for (int i = 0; i < myRow; i++) { 
         for (int j = 0; j < myColumn; j++) { 
            if (== myRow / 2 && < myColumn / 2 6 && j > myColumn / 2 5
               myGrid[i][j].init(LIVE, myColors[LIVE], NUMNEIGHBOR); 
               myUpdatedGrid[i][j] = LIVE; 
            } else { 
               myGrid[i][j].init(EMPTY, myColors[EMPTY], NUMNEIGHBOR); 
               myUpdatedGrid[i][j] = EMPTY; 
            } 
         } 
      } 
   } 
 

10..11 lines in WatorRule (x2)


WatorRule
/cellsociety_team14/src/layout/rule/WatorRule.java
WatorRule
/cellsociety_team14/src/layout/rule/WatorRule.java
            Random random = new Random(); 
            int randomInt = random.nextInt(myFishReproduceRate); 
             
            myGrid[i][j] = new Animal(x, y, cellWidth, cellLength, i, j); 
            myGrid[i][j].init(FISH, myColors[FISH], NUMNEIGHBOR); 
            if (myGrid[i][j] instanceof Animal) { 
               ((Animal) myGrid[i][j]).setReproduce(randomInt); 
            } 
            myUpdatedGrid[i][j].tempState = FISH
            myUpdatedGrid[i][j].tempReproduce = randomInt; 
            Random random = new Random(); 
            int randomInt = random.nextInt(myFishReproduceRate); 
             
            myGrid[i][j] = new Animal(x, y, cellWidth, cellLength, i, j); 
            myGrid[i][j].init(SHARK, myColors[SHARK], NUMNEIGHBOR); 
            if (myGrid[i][j] instanceof Animal) { 
               ((Animal) myGrid[i][j]).setReproduce(randomInt); 
               ((Animal) myGrid[i][j]).setHealth(mySharkDeathRate); 
            } 
            myUpdatedGrid[i][j].tempState = SHARK
            myUpdatedGrid[i][j].tempReproduce = randomInt; 
 

12..13 lines in WatorRuleXMLFactory, SchellingRuleXMLFactory


SchellingRuleXMLFactory
/cellsociety_team14/src/xml/factory/SchellingRuleXMLFactory.java
WatorRuleXMLFactory
/cellsociety_team14/src/xml/factory/WatorRuleXMLFactory.java
    @Override 
    public Rule getRule (Element root) throws XMLFactoryException { 
        myResources = ResourceBundle.getBundle(DEFAULT_RESOURCE_PACKAGE + getRuleProperty()); 
        if (!getTextValue(root, myResources.getString("RuleName")).equals("SchellingRule")) { 
            throw new XMLFactoryException("XML file does not represent the %s", getRuleType()); 
        } 
        Integer length = Integer.parseInt(getTextValue(root, myResources.getString("Length"))); 
        Integer width = Integer.parseInt(getTextValue(root, myResources.getString("Width"))); 
        Integer row = Integer.parseInt(getTextValue(root, myResources.getString("Row"))); 
        Integer column = Integer.parseInt(getTextValue(root, myResources.getString("Column"))); 
        double percentageA = Double.parseDouble(getTextValue(root, myResources.getString("PercentageA"))); 
        double percentageEmpty = Double.parseDouble(getTextValue(root, myResources.getString("PercentageEmpty"))); 
    @Override 
    public Rule getRule (Element root) throws XMLFactoryException { 
        myResources = ResourceBundle.getBundle(DEFAULT_RESOURCE_PACKAGE + getRuleProperty()); 
        if (!getTextValue(root, myResources.getString("RuleName")).equals("WatorRule")) { 
            throw new XMLFactoryException("XML file does not represent the %s", getRuleType()); 
        } 
        Integer length = Integer.parseInt(getTextValue(root, myResources.getString("Length"))); 
        Integer width = Integer.parseInt(getTextValue(root, myResources.getString("Width"))); 
        Integer row = Integer.parseInt(getTextValue(root, myResources.getString("Row"))); 
        Integer column = Integer.parseInt(getTextValue(root, myResources.getString("Column"))); 
         
        double pWater = Double.parseDouble(getTextValue(root, myResources.getString("PercentWater"))); 
        double pFish = Double.parseDouble(getTextValue(root, myResources.getString("PercentFish"))); 
9/29/16 2:21 PM Powered by CodePro Server