Similar Code Analysis Report

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

Table of contents

number of lines number of occurrences names of resources
8 2 SpreadingOfFireSimulation, Segregation
18..15 2 WaTorWorldSimulation
15..13 2 MainMenu
6..5 2 WaTorWorldSimulation
9 2 SegregationGrid
6..5 2 SpreadingOfFireSimulation, WaTorWorldSimulation
6 3 SpreadingOfFireSimulation, WaTorWorldSimulation, Segregation
3 4 WaTorWorldSimulation, GameOfLifeSimulation, Segregation
54..52 3 SpreadingOfFireSimulation, WaTorWorldSimulation, Segregation
9 2 SegregationCell, WaTorWorldCell
7..6 2 SpreadingOfFireSimulation, WaTorWorldSimulation
8 4 SpreadingOfFireSimulation, WaTorWorldSimulation, GameOfLifeSimulation, Segregation
11 3 Grid
4 4 SpreadingOfFireGrid, GameOfLifeGrid, SegregationGrid, WaTorWorldGrid
6 2 MainMenu, Grid
3 4 SpreadingOfFireGrid, GameOfLifeGrid, SegregationGrid, WaTorWorldGrid
4 2 SegregationGrid
2..1 7 SpreadingOfFireSimulation, WaTorWorldSimulation, GameOfLifeSimulation, Segregation
2..1 4 SpreadingOfFireSimulation, WaTorWorldSimulation, GameOfLifeSimulation, Segregation

List of matches

 

15..18 lines in WaTorWorldSimulation (x2)


WaTorWorldSimulation
/cellsociety_team04/src/waterworld/WaTorWorldSimulation.java
WaTorWorldSimulation
/cellsociety_team04/src/waterworld/WaTorWorldSimulation.java
    public Location getRandomEmptyNeighbor(int x, int y){ 
        ArrayList<Location> locations = new ArrayList<Location>(); 
        //Cell[][] grid = myGrid.getGrid();         
        if(x != 0 && (myGrid.getCell(x-1,y).getState() == State.EMPTY)){ 
            locations.add(new Location(x-1,y)); 
        } 
        if(x != getGridLength()-1 && (myGrid.getCell(x+1,y).getState() == State.EMPTY)){ 
            locations.add(new Location(x+1,y)); 
        } 
        if(y != getGridLength()-&&(myGrid.getCell(x,y+1).getState() == State.EMPTY)){ 
            locations.add(new Location(x,y+1)); 
        } 
        if(y != 0 && (myGrid.getCell(x,y-1).getState() == State.EMPTY)){ 
            locations.add(new Location(x,y-1)); 
        } 
    public void updateShark(int x, int y){ 
        Location currLocation = new Location(x,y); 
        //Cell[][] grid = myGrid.getGrid(); 
        ArrayList<Location> fish = new ArrayList<Location>(); 
        myGrid.getCell(x, y).decrementBreedTime(); 
        myGrid.getCell(x, y).decrementStarveTime(); 
        if(x != 0 && (myGrid.getCell(x-1, y).getState() == State.FISH)){ 
            fish.add(new Location(x-1, y)); 
        } 
        if(x != getGridLength()-1 && ( myGrid.getCell(x+1, y).getState() == State.FISH)){ 
            fish.add(new Location(x+1, y)); 
        } 
        if(y != getGridLength() - 1 && ( myGrid.getCell(x, y+1).getState() == State.FISH)){ 
            fish.add(new Location(x, y+1)); 
        } 
        if(y != 0 && ( myGrid.getCell(x, y-1).getState() == State.FISH)){ 
            fish.add(new Location(x, y-1)); 
        } 
 

13..15 lines in MainMenu (x2)


MainMenu
/cellsociety_team04/src/controller/MainMenu.java
MainMenu
/cellsociety_team04/src/controller/MainMenu.java
        public BigGameNameText(String Name){ 
            Text titleText = new Text(Name); 
            titleText.setFont(Font.font("Rockwell", FontWeight.BOLD,60)); 
            LinearGradient gradient = new LinearGradient(0d,1d,1d,0d, true,  
                                                         CycleMethod.NO_CYCLE,  
                                                         new Stop[]{ 
                                                                    new Stop(0, Color.WHITE), 
                                                                    new Stop(0.15, Color.TURQUOISE), 
                                                                    new Stop(0.3, Color.LIGHTGREEN), 
                                                                    new Stop(0.45, Color.GREEN), 
                                                                    new Stop(0.6, Color.LIGHTGREEN), 
                                                                    new Stop(0.75, Color.TURQUOISE), 
                                                                    new Stop(0.9, Color.WHITE), 
                                                                    new Stop(1, Color.WHITE) 
            }); 
        public MenuItem(String Name) {    
            LinearGradient gradient = new LinearGradient(0d,1d,1d,0d, true,  
                                                         CycleMethod.NO_CYCLE,  
                                                         new Stop[]{ 
                                                                    new Stop(0, Color.WHITE), 
                                                                    new Stop(0.15, Color.TURQUOISE), 
                                                                    new Stop(0.3, Color.LIGHTGREEN), 
                                                                    new Stop(0.45, Color.GREEN), 
                                                                    new Stop(0.6, Color.LIGHTGREEN), 
                                                                    new Stop(0.75, Color.TURQUOISE), 
                                                                    new Stop(0.9, Color.WHITE), 
                                                                    new Stop(1, Color.WHITE) 
            }); 
 

52..54 lines in SpreadingOfFireSimulation, WaTorWorldSimulation, Segregation


WaTorWorldSimulation
/cellsociety_team04/src/waterworld/WaTorWorldSimulation.java
SpreadingOfFireSimulation
/cellsociety_team04/src/spreadingoffire/SpreadingOfFireSimulation.java
Segregation
/cellsociety_team04/src/segregation/Segregation.java
    public void createGraph(){ 
        //defining the axes 
        final NumberAxis xAxis = new NumberAxis(); 
        xAxis.setTickLabelsVisible(false); 
        xAxis.setTickMarkVisible(false); 
        xAxis.setMinorTickVisible(false); 
        final NumberAxis yAxis = new NumberAxis(); 
        yAxis.setMinorTickVisible(false); 
         
        //creating the chart 
        final LineChart<Number,Number> lineChart =  
                new LineChart<Number,Number>(xAxis,yAxis); 
        fishSeries = new XYChart.Series(); 
        fishSeries.setName("Fish"); 
        sharkSeries = new XYChart.Series(); 
        sharkSeries.setName("Shark"); 
        seaSeries = new XYChart.Series(); 
        seaSeries.setName("Sea"); 
         
         
        //populating the series with data 
        //series.getData().add(new XYChart.Data(1, 23)); 
        lineChart.getData().add(fishSeries); 
        lineChart.getData().add(sharkSeries); 
        lineChart.getData().add(seaSeries); 
         
        lineChart.setLayoutX(25); 
        lineChart.setPrefSize(500, 100); 
        lineChart.setLegendVisible(true); 
        lineChart.setLegendSide(Side.RIGHT); 
        getRootElement().getChildren().add(lineChart); 
         
         
        Rectangle cellCounter = new Rectangle(SIMULATION_WINDOW_WIDTH - (2 * dimensionsOfCellCounterBox)  
              + 2 * marginBoxTop, (dimensionsOfCellCounterBox / 5), dimensionsOfCellCounterBox * 3 / 2, 
              dimensionsOfCellCounterBox); 
        cellCounter.setFill(Color.WHITE); 
        cellCounter.setStyle( 
             "-fx-background-radius: 8,7,6;" +  
             "-fx-background-insets: 0,1,2;" + 
             "-fx-text-fill: black;" + 
             "-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );" 
      ); 
        getRootElement().getChildren().add(cellCounter); 
        numSea.setFill(Color.BLUE); 
        numShark.setFill(Color.GOLD); 
        numFish.setFill(Color.GREEN); 
        updateText(); 
        getRootElement().getChildren().add(numSea); 
        getRootElement().getChildren().add(numShark); 
        getRootElement().getChildren().add(numFish); 
    } 
    public void createGraph(){ 
        //defining the axes 
        final NumberAxis xAxis = new NumberAxis(); 
        xAxis.setTickLabelsVisible(false); 
        xAxis.setTickMarkVisible(false); 
        xAxis.setMinorTickVisible(false); 
        final NumberAxis yAxis = new NumberAxis(); 
        yAxis.setMinorTickVisible(false); 
         
        //creating the chart 
        final LineChart<Number,Number> lineChart =  
                new LineChart<Number,Number>(xAxis,yAxis); 
        fireLine = new XYChart.Series(); 
        fireLine.setName("Fire"); 
        yellowLine = new XYChart.Series(); 
        yellowLine.setName("Dead"); 
        aliveLine = new XYChart.Series(); 
        aliveLine.setName("Alive"); 
         
         
        //populating the series with data 
        //series.getData().add(new XYChart.Data(1, 23)); 
        lineChart.getData().add(fireLine); 
        lineChart.getData().add(yellowLine); 
        lineChart.getData().add(aliveLine); 
         
        lineChart.setLayoutX(25); 
        lineChart.setPrefSize(500, 100); 
        lineChart.setLegendVisible(true); 
        lineChart.setLegendSide(Side.RIGHT); 
        getRootElement().getChildren().add(lineChart); 
         
         
        Rectangle cellCounter = new Rectangle(SIMULATION_WINDOW_WIDTH - (2 * dimensionsOfCellCounterBox)  
              + 2 * marginBoxTop, (dimensionsOfCellCounterBox / 5), dimensionsOfCellCounterBox * 3 / 2, 
              dimensionsOfCellCounterBox); 
        cellCounter.setFill(Color.WHITE); 
        cellCounter.setStyle( 
             "-fx-background-radius: 8,7,6;" +  
             "-fx-background-insets: 0,1,2;" + 
             "-fx-text-fill: black;" + 
             "-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );" 
      ); 
        getRootElement().getChildren().add(cellCounter); 
        numFireText.setFill(Color.RED); 
        numDeadText.setFill(Color.ORANGE); 
        numAliveText.setFill(Color.GREEN); 
        updateText(); 
        getRootElement().getChildren().add(numFireText); 
        getRootElement().getChildren().add(numDeadText); 
        getRootElement().getChildren().add(numAliveText); 
         
         
    } 
    public void createGraph(){ 
        //defining the axes 
        final NumberAxis xAxis = new NumberAxis(); 
        xAxis.setTickLabelsVisible(false); 
        xAxis.setTickMarkVisible(false); 
        xAxis.setMinorTickVisible(false); 
        final NumberAxis yAxis = new NumberAxis(); 
        yAxis.setMinorTickVisible(false); 
         
        //creating the chart 
        final LineChart<Number,Number> lineChart =  
                new LineChart<Number,Number>(xAxis,yAxis); 
        emptyLine = new XYChart.Series(); 
        emptyLine.setName("Empty"); 
        satisfiedLine = new XYChart.Series(); 
        satisfiedLine.setName("Satisfied"); 
        unsatisfiedLine = new XYChart.Series(); 
        unsatisfiedLine.setName("Unsatisfied"); 
              
        //populating the series with data 
        //series.getData().add(new XYChart.Data(1, 23)); 
        lineChart.getData().add(emptyLine); 
        lineChart.getData().add(satisfiedLine); 
        lineChart.getData().add(unsatisfiedLine); 
         
        lineChart.setLayoutX(25); 
        lineChart.setPrefSize(500, 100); 
        lineChart.setLegendVisible(true); 
        lineChart.setLegendSide(Side.RIGHT); 
        getRootElement().getChildren().add(lineChart); 
         
         
        Rectangle cellCounter = new Rectangle(SIMULATION_WINDOW_WIDTH - (2 * dimensionsOfCellCounterBox)  
              + 2 * marginBoxTop, (dimensionsOfCellCounterBox / 5), dimensionsOfCellCounterBox * 3 / 2,  
              dimensionsOfCellCounterBox); 
        cellCounter.setFill(Color.WHITE); 
        cellCounter.setStyle( 
             "-fx-background-radius: 8,7,6;" +  
             "-fx-background-insets: 0,1,2;" + 
             "-fx-text-fill: black;" + 
             "-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );" 
      ); 
        getRootElement().getChildren().add(cellCounter); 
        numEmptyText.setFill(Color.GRAY); 
        numSatisfiedText.setFill(Color.DARKBLUE); 
        numUnsatisfiedText.setFill(Color.LIGHTGREEN); 
        updateText(); 
        getRootElement().getChildren().add(numEmptyText); 
        getRootElement().getChildren().add(numSatisfiedText); 
        getRootElement().getChildren().add(numUnsatisfiedText); 
         
         
    } 
 

8 lines in SpreadingOfFireSimulation, WaTorWorldSimulation, GameOfLifeSimulation, Segregation


SpreadingOfFireSimulation
/cellsociety_team04/src/spreadingoffire/SpreadingOfFireSimulation.java
WaTorWorldSimulation
/cellsociety_team04/src/waterworld/WaTorWorldSimulation.java
GameOfLifeSimulation
/cellsociety_team04/src/gameoflife/GameOfLifeSimulation.java
Segregation
/cellsociety_team04/src/segregation/Segregation.java
    @Override 
    public Scene init (Stage s) { 
        setStage(s); 
        makeNewRootElement(); 
        setMyScene(new Scene(getRootElement(), SIMULATION_WINDOW_WIDTH, SIMULATION_WINDOW_HEIGHT, Color.WHITE));  
        setTopMargin(getTopMargin() + marginBoxTop*4); 
        this.myGrid = new SpreadingOfFireGrid(getGridLength(), getCellSize(), getRootElement(),  
              getLeftMargin(), getTopMargin(),this); 
    @Override 
    public Scene init (Stage s) { 
        setStage(s); 
        makeNewRootElement(); 
        setMyScene(new Scene(getRootElement(), SIMULATION_WINDOW_WIDTH, SIMULATION_WINDOW_HEIGHT, Color.WHITE));   
        setTopMargin(getTopMargin() + marginBoxTop 4); 
        this.myGrid = new WaTorWorldGrid(getGridLength(),getCellSize(),getRootElement(), 
              getLeftMargin(), getTopMargin(),this); 
    @Override 
    public Scene init(Stage s) { 
        setStage(s); 
        makeNewRootElement(); 
        setMyScene(new Scene(getRootElement(), SIMULATION_WINDOW_WIDTH, SIMULATION_WINDOW_HEIGHT, Color.WHITE));   
        setTopMargin(getTopMargin() + marginBoxTop 4); 
        this.myGrid = new GameOfLifeGrid(getGridLength(), getCellSize(), getRootElement(), 
              getLeftMargin(), getTopMargin(), this); 
    @Override 
    public Scene init(Stage s) { 
        setStage(s); 
        makeNewRootElement(); 
        setMyScene(new Scene(getRootElement(), SIMULATION_WINDOW_WIDTH, SIMULATION_WINDOW_HEIGHT, Color.WHITE));   
        setTopMargin(getTopMargin() + marginBoxTop*4); 
        this.myGrid = new SegregationGrid(getGridLength(), getCellSize(), getRootElement(),  
              getLeftMargin(), getTopMargin(), this); 
 

11 lines in Grid (x3)


Grid
/cellsociety_team04/src/base/Grid.java
Grid
/cellsociety_team04/src/base/Grid.java
Grid
/cellsociety_team04/src/base/Grid.java
        }); 
        stepSim.setTranslateX(20); 
        stepSim.setTranslateY(250); 
        rootElement.getChildren().add(stepSim); 
 
        // PAUSE SIMULATION BUTTON BELOW 
        Button pauseSim = new Button("Pause"); 
        pauseSim.setStyle(buttonFill); 
        pauseSim.setOnAction(new EventHandler<ActionEvent>() { 
            @Override 
            public void handle(ActionEvent event) { 
        }); 
        pauseSim.setTranslateX(20); 
        pauseSim.setTranslateY(300); 
        rootElement.getChildren().add(pauseSim); 
 
        // RESUME SIMULATION BUTTON BELOW 
        Button resumeSim = new Button("Resume"); 
        resumeSim.setStyle(buttonFill); 
        resumeSim.setOnAction(new EventHandler<ActionEvent>() { 
            @Override 
            public void handle(ActionEvent event) { 
        }); 
        startSim.setTranslateX(20); 
        startSim.setTranslateY(200); 
        rootElement.getChildren().add(startSim); 
 
        // STEP SIMULATION BUTTON BELOW 
        Button stepSim = new Button("Step"); 
        stepSim.setStyle(buttonFill); 
        stepSim.setOnAction(new EventHandler<ActionEvent>() { 
            @Override 
            public void handle(ActionEvent event) { 
 

3 lines in SpreadingOfFireGrid, GameOfLifeGrid, SegregationGrid, WaTorWorldGrid


SegregationGrid
/cellsociety_team04/src/segregation/SegregationGrid.java
SpreadingOfFireGrid
/cellsociety_team04/src/spreadingoffire/SpreadingOfFireGrid.java
GameOfLifeGrid
/cellsociety_team04/src/gameoflife/GameOfLifeGrid.java
WaTorWorldGrid
/cellsociety_team04/src/waterworld/WaTorWorldGrid.java
    public SegregationGrid(int rowLength, int sizeOfCell, Pane rootElement, 
                           int initialX, int initialY, Segregation sim) { 
        super(rowLength, sizeOfCell, rootElement, initialX, initialY); 
    public SpreadingOfFireGrid(int rowLength, int sizeOfCell, Pane rootElement,int initialX,  
          int initialY, SpreadingOfFireSimulation sim) { 
           super(rowLength, sizeOfCell, rootElement, initialX, initialY); 
    public GameOfLifeGrid(int rowLength, int sizeOfCell, Pane rootElement,  
                          int initialX, int initialY, GameOfLifeSimulation sim) { 
        super(rowLength, sizeOfCell, rootElement, initialX, initialY); 
    public WaTorWorldGrid(int rowLength, int sizeOfCell, Pane rootElement, 
                          int initialX, int initialY, WaTorWorldSimulation sim) { 
        super(rowLength, sizeOfCell, rootElement, initialX, initialY); 
9/29/16 2:16 PM Powered by CodePro Server