Skip to content
Snippets Groups Projects
Commit 1c1b9446 authored by Goik Martin's avatar Goik Martin
Browse files

Fixing library dependencied and screwed javadocs

parent 57dee006
No related branches found
No related tags found
No related merge requests found
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
</links> </links>
<additionalDependencies> <additionalDependencies>
<additionalDependency> <additionalDependency>
<groupId>org.greenfoot</groupId> <groupId>de.hdm-stuttgart.mi</groupId>
<artifactId>greenfoot-core</artifactId> <artifactId>greenfoot</artifactId>
<version>2.5</version> <version>2.3.0</version>
</additionalDependency> </additionalDependency>
</additionalDependencies> </additionalDependencies>
</configuration> </configuration>
...@@ -64,5 +64,10 @@ ...@@ -64,5 +64,10 @@
<version>4.11</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>de.hdm-stuttgart.mi</groupId>
<artifactId>greenfoot</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
</links> </links>
<additionalDependencies> <additionalDependencies>
<additionalDependency> <additionalDependency>
<groupId>org.greenfoot</groupId> <groupId>de.hdm-stuttgart.mi</groupId>
<artifactId>greenfoot-core</artifactId> <artifactId>greenfoot</artifactId>
<version>2.5</version> <version>2.3.0</version>
</additionalDependency> </additionalDependency>
</additionalDependencies> </additionalDependencies>
...@@ -65,5 +65,12 @@ ...@@ -65,5 +65,12 @@
<version>4.11</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>de.hdm-stuttgart.mi</groupId>
<artifactId>greenfoot</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -36,15 +36,13 @@ ...@@ -36,15 +36,13 @@
<links> <links>
<link>http://www.greenfoot.org/files/javadoc/</link> <link>http://www.greenfoot.org/files/javadoc/</link>
</links> </links>
<!--
<additionalDependencies> <additionalDependencies>
<additionalDependency> <additionalDependency>
<groupId>org.greenfoot</groupId> <groupId>de.hdm-stuttgart.mi</groupId>
<artifactId>greenfoot-core</artifactId> <artifactId>greenfoot</artifactId>
<version>2.5</version> <version>2.3.0</version>
</additionalDependency> </additionalDependency>
</additionalDependencies> </additionalDependencies>
-->
</configuration> </configuration>
</plugin> </plugin>
...@@ -69,8 +67,8 @@ ...@@ -69,8 +67,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.hdm-stuttgart.mi</groupId> <groupId>de.hdm-stuttgart.mi</groupId>
<artifactId>greenfoot</artifactId> <artifactId>greenfoot</artifactId>
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -27,7 +27,6 @@ public class Cell extends Actor { ...@@ -27,7 +27,6 @@ public class Cell extends Actor {
/** /**
* Create the cell body's image and initialize state. * Create the cell body's image and initialize state.
* *
* @param cellSize The cell's size in pixel units,
* @param intialState Indicating {@link CellState#ALIVE} or {@link CellState#DEAD} * @param intialState Indicating {@link CellState#ALIVE} or {@link CellState#DEAD}
*/ */
public Cell(final CellState intialState) { public Cell(final CellState intialState) {
...@@ -67,6 +66,9 @@ public class Cell extends Actor { ...@@ -67,6 +66,9 @@ public class Cell extends Actor {
previousState = currentState; previousState = currentState;
} }
/**
* @return Number of living neighbouring cells
*/
public int getLivingNeighbourCount() { public int getLivingNeighbourCount() {
int sum = 0; int sum = 0;
for (final Cell neighbor: neighbours) { for (final Cell neighbor: neighbours) {
...@@ -75,6 +77,9 @@ public class Cell extends Actor { ...@@ -75,6 +77,9 @@ public class Cell extends Actor {
return sum; return sum;
} }
/**
* Set cell alive
*/
public void setAlive() { public void setAlive() {
setState(CellState.ALIVE); setState(CellState.ALIVE);
} }
......
...@@ -10,17 +10,25 @@ import java.awt.Color; ...@@ -10,17 +10,25 @@ import java.awt.Color;
* *
*/ */
public class LifeWorld extends World { public class LifeWorld extends World {
static private final int static private final int
initialLivingPercentage = 25 initialLivingPercentage = 25
,width = 80 ,width = 80
,height = 50; ,height = 50;
/**
* default cell size
*/
public static final int cellSize = 10; // Minimum of 3 pixel in width here yields a (cellSize-2)x(cellSize-2) pixel visible cell public static final int cellSize = 10; // Minimum of 3 pixel in width here yields a (cellSize-2)x(cellSize-2) pixel visible cell
static public GreenfootImage /**
imageAlive = new GreenfootImage(cellSize, cellSize) * image of living cell
,imageDead = new GreenfootImage(cellSize, cellSize); */
static public GreenfootImage imageAlive = new GreenfootImage(cellSize, cellSize);
/**
* image of dead cell
*/
static public GreenfootImage imageDead = new GreenfootImage(cellSize, cellSize);
// "Class" constructor initializing static fields. You may want to read Ivor Horton's // "Class" constructor initializing static fields. You may want to read Ivor Horton's
// "Using Initialization Blocks" / "Initializing Data Members" subsection. // "Using Initialization Blocks" / "Initializing Data Members" subsection.
...@@ -163,7 +171,7 @@ public class LifeWorld extends World { ...@@ -163,7 +171,7 @@ public class LifeWorld extends World {
} }
/** Randomly return the two states {@link CellState#ALIVE} and {@link CellState#DEAD}. The /** Randomly return the two states {@link CellState#ALIVE} and {@link CellState#DEAD}. The
* corresponding probabilities are {@link #setInitialLivingPercentage(int)} / 100 and * corresponding probabilities are initialLivingPercentage/100 and
* its complement. * its complement.
* *
* @return Either {@link CellState#ALIVE} or {@link CellState#DEAD}. * @return Either {@link CellState#ALIVE} or {@link CellState#DEAD}.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment