Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop parallelism #9

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 107 additions & 33 deletions src/arcade/potts/sim/Potts.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import sim.engine.SimState;

Check failure on line 9 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L9 <com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck>

Extra separation in import group before 'sim.engine.SimState'
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:9:1: error: Extra separation in import group before 'sim.engine.SimState' (com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck)
import sim.engine.Steppable;
import ec.util.MersenneTwisterFast;
import arcade.core.env.grid.Grid;
Expand Down Expand Up @@ -67,7 +71,10 @@
*
* @param series the simulation series
*/

private final ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());

Check failure on line 75 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L75 <LineLength>

Line is longer than 100 characters (found 118).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:75:0: error: Line is longer than 100 characters (found 118). (LineLength)

public Potts(PottsSeries series) {

Check failure on line 77 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L77 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:77:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
// Creates potts arrays.
ids = new int[series.height][series.length][series.width];
regions = new int[series.height][series.length][series.width];
Expand Down Expand Up @@ -139,46 +146,81 @@
*/
@Override
public void step(SimState simstate) {
MersenneTwisterFast random = simstate.random;
double r;
final MersenneTwisterFast random = simstate.random;
final SynchronizedState state = new SynchronizedState(simstate, regions, ids);
final int numberOfChunks = Runtime.getRuntime().availableProcessors();
final int stepsPerJob = (int) Math.floor((float) steps / (float) numberOfChunks); // round down, any remainder steps will go in the final job

Check failure on line 152 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L152 <LineLength>

Line is longer than 100 characters (found 149).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:152:0: error: Line is longer than 100 characters (found 149). (LineLength)

Check failure on line 152 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L152 <LineLengthTest>

Line is longer than 120 characters (found 149).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:152:0: error: Line is longer than 120 characters (found 149). (LineLengthTest)
int x;
double r;
int y;
int z;

int currentJob = 0;
int stepOfJob = 0;
final List<List<SimParams>> locationChunksMap = buildLocationChunksMap(numberOfChunks);
for (int step = 0; step < steps; step++) {
if(currentJob +1 != locationChunksMap.size() // on the final job, fill it with the remainder

Check failure on line 161 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L161 <LineLength>

Line is longer than 100 characters (found 104).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:161:0: error: Line is longer than 100 characters (found 104). (LineLength)

Check failure on line 161 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L161 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:161:13: error: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check failure on line 161 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L161 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:161:13: error: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)

Check failure on line 161 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L161 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

'+' is not followed by whitespace.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:161:27: error: '+' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
&& stepOfJob == stepsPerJob // otherwise, stop when it is 'full'
) {
currentJob ++;

Check failure on line 164 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L164 <com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck>

'++' is preceded with whitespace.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:164:28: error: '++' is preceded with whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck)
stepOfJob = 0;
}
// Get random coordinate for candidate.
x = random.nextInt(length) + 1;
y = random.nextInt(width) + 1;
z = (random.nextInt(height) + 1) * (isSingle ? 0 : 1);
r = random.nextDouble();

// Check if cell has regions.
boolean hasRegionsCell = (ids[z][x][y] != 0 && getCell(ids[z][x][y]).hasRegions());

// Get unique targets.
HashSet<Integer> uniqueIDTargets = getUniqueIDs(x, y, z);
HashSet<Integer> uniqueRegionTargets = getUniqueRegions(x, y, z);

// Check if there are valid unique targets.
boolean hasIDTargets = uniqueIDTargets.size() > 0;
boolean hasRegionTargets = uniqueRegionTargets.size() > 0;
boolean check = simstate.random.nextDouble() < 0.5;

// Select unique ID or unique region (if they exist). If there is
// a unique ID and unique region target, then randomly select. If
// there are neither, then skip.
if (hasIDTargets && (!hasRegionsCell || !hasRegionTargets || check)) {
int i = simstate.random.nextInt(uniqueIDTargets.size());
int targetID = (int) uniqueIDTargets.toArray()[i];
flip(ids[z][x][y], targetID, x, y, z, r);
} else if (hasRegionsCell && hasRegionTargets) {
int i = simstate.random.nextInt(uniqueRegionTargets.size());
int targetRegion = (int) uniqueRegionTargets.toArray()[i];
flip(ids[z][x][y], regions[z][x][y], targetRegion, x, y, z, r);
}
SimParams simParams = new SimParams(r, x, y, z);
locationChunksMap.get(currentJob).add(simParams);
stepOfJob ++;

Check failure on line 174 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L174 <com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck>

'++' is preceded with whitespace.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:174:23: error: '++' is preceded with whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck)
}

for (List<SimParams> locations : locationChunksMap)

Check failure on line 177 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L177 <com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck>

'for' construct must use '{}'s.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:177:9: error: 'for' construct must use '{}'s. (com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck)
executor.submit(() -> locations.forEach(
locationParams -> updateLatticeLocation(state, locationParams.getR(), locationParams.getX(), locationParams.getY(), locationParams.getZ())

Check failure on line 179 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L179 <LineLength>

Line is longer than 100 characters (found 158).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:179:0: error: Line is longer than 100 characters (found 158). (LineLength)

Check failure on line 179 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L179 <LineLengthTest>

Line is longer than 120 characters (found 158).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:179:0: error: Line is longer than 120 characters (found 158). (LineLengthTest)
));
}


private List<List<SimParams>> buildLocationChunksMap(int numberOfJobs) {

Check failure on line 183 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L183 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:183:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
final List<List<SimParams>> jobsMap = new ArrayList<>();
// build the map
for (int job = 0; job < numberOfJobs; job++){

Check failure on line 186 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L186 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

'{' is not preceded with whitespace.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:186:53: error: '{' is not preceded with whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
jobsMap.add(new ArrayList<>());
}
return jobsMap;
}

private void updateLatticeLocation(SynchronizedState state, double r, int x, int y, int z) { //TODO is concurrent access to this entire block a problem (even if individual reads/updates to state are atomic)?

Check failure on line 192 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L192 <LineLength>

Line is longer than 100 characters (found 212).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:192:0: error: Line is longer than 100 characters (found 212). (LineLength)

Check failure on line 192 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L192 <LineLengthTest>

Line is longer than 120 characters (found 212).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:192:0: error: Line is longer than 120 characters (found 212). (LineLengthTest)

Check failure on line 192 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L192 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:192:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
// Check if cell has regions.
//TODO atomically get state
int id = state.getId(z, y, x);
int region = state.getRegion(z, y, x);

//TODO I think getCell will nee to by synchronized
boolean hasRegionsCell = (id != 0 && getCell(id).hasRegions());

// Get unique targets.
HashSet<Integer> uniqueIDTargets = getUniqueIDs(x, y, z); //TODO check if synchronization is needed

Check failure on line 202 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L202 <LineLength>

Line is longer than 100 characters (found 107).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:202:0: error: Line is longer than 100 characters (found 107). (LineLength)
HashSet<Integer> uniqueRegionTargets = getUniqueRegions(x, y, z);

// Check if there are valid unique targets.
boolean hasIDTargets = uniqueIDTargets.size() > 0;
boolean hasRegionTargets = uniqueRegionTargets.size() > 0;
boolean check = state.nextDouble() < 0.5;

// Select unique ID or unique region (if they exist). If there is
// a unique ID and unique region target, then randomly select. If
// there are neither, then skip.
if (hasIDTargets && (!hasRegionsCell || !hasRegionTargets || check)) {
int i = state.nextInt(uniqueIDTargets.size());
int targetID = (int) uniqueIDTargets.toArray()[i];
flip(id, targetID, x, y, z, r);
} else if (hasRegionsCell && hasRegionTargets) {
int i = state.nextInt(uniqueRegionTargets.size());
int targetRegion = (int) uniqueRegionTargets.toArray()[i];
flip(id, region, targetRegion, x, y, z, r);
}
}

/**
* Flips connected voxel from source to target id based on Boltzmann
* probability.
Expand Down Expand Up @@ -243,11 +285,12 @@
* @param z the z coordinate
* @param r a random number
*/
// TODO all access to state in this needs to by syncronized. Should i use volatile to ensure updates are seen?

Check failure on line 288 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L288 <LineLength>

Line is longer than 100 characters (found 115).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:288:0: error: Line is longer than 100 characters (found 115). (LineLength)
void change(int sourceID, int targetID, int x, int y, int z, double r) {
// Calculate energy change.
double dH = 0;
for (Hamiltonian h : hamiltonian) {
dH += h.getDelta(sourceID, targetID, x, y, z);
dH += h.getDelta(sourceID, targetID, x, y, z); //TODO concurrency safe?
}

// Calculate probability.
Expand All @@ -259,7 +302,7 @@
}

if (r < p) {
ids[z][x][y] = targetID;
ids[z][x][y] = targetID; //TODO NM, it gets updated right here. These must be atomic.
if (hasRegions) {
regions[z][x][y] = (targetID == 0
? Region.UNDEFINED.ordinal()
Expand Down Expand Up @@ -323,11 +366,12 @@
* @param z the z coordinate
* @param r a random number
*/
// TODO review syncronization
void change(int id, int sourceRegion, int targetRegion, int x, int y, int z, double r) {
// Calculate energy change.
double dH = 0;
for (Hamiltonian h : hamiltonian) {
dH += h.getDelta(id, sourceRegion, targetRegion, x, y, z);
dH += h.getDelta(id, sourceRegion, targetRegion, x, y, z); //TODO concurrency safe?
}

// Calculate probability.
Expand All @@ -339,7 +383,7 @@
}

if (r < p) {
regions[z][x][y] = targetRegion;
regions[z][x][y] = targetRegion; //TODO is region the only state that gets updated? Maybe i dont need to worry about ids?

Check failure on line 386 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L386 <LineLength>

Line is longer than 100 characters (found 136).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:386:0: error: Line is longer than 100 characters (found 136). (LineLength)

Check failure on line 386 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L386 <LineLengthTest>

Line is longer than 120 characters (found 136).
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:386:0: error: Line is longer than 120 characters (found 136). (LineLengthTest)
PottsCell c = getCell(id);
((PottsLocation) c.getLocation()).remove(Region.values()[sourceRegion], x, y, z);
((PottsLocation) c.getLocation()).add(Region.values()[targetRegion], x, y, z);
Expand Down Expand Up @@ -411,4 +455,34 @@
* @return the list of unique regions
*/
abstract HashSet<Integer> getUniqueRegions(int x, int y, int z);

private class SimParams {

Check failure on line 459 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L459 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:459:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
double r;

Check failure on line 460 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L460 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:460:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)
int x;

Check failure on line 461 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L461 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:461:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 461 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L461 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:461:9: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
int y;

Check failure on line 462 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L462 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:462:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 462 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L462 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:462:9: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
int z;

Check failure on line 463 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L463 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:463:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 463 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L463 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:463:9: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)

public SimParams(double r, int x, int y, int z) {

Check failure on line 465 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L465 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:465:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check failure on line 465 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L465 <com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck>

Redundant 'public' modifier.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:465:9: error: Redundant 'public' modifier. (com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck)
this.r = r;
this.x = x;
this.y = y;
this.z = z;
}

public double getR() {

Check failure on line 472 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L472 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:472:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return r;
}

public int getX() {

Check failure on line 476 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L476 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:476:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return x;
}

public int getY() {

Check failure on line 480 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L480 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:480:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return y;
}

public int getZ() {

Check failure on line 484 in src/arcade/potts/sim/Potts.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/Potts.java#L484 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/Potts.java:484:9: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return z;
}
}
}
32 changes: 32 additions & 0 deletions src/arcade/potts/sim/SynchronizedState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package arcade.potts.sim;

import sim.engine.SimState;

class SynchronizedState {

Check failure on line 5 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L5 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:5:1: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

private SimState simState;

Check failure on line 7 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L7 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:7:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)
private int[][][] regions;

Check failure on line 8 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L8 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:8:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 8 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L8 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:8:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
private int[][][] ids;

Check failure on line 9 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L9 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:9:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 9 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L9 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:9:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)

public SynchronizedState(SimState simState, int[][][] regions, int[][][] ids) {

Check failure on line 11 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L11 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:11:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check failure on line 11 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L11 <com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck>

Redundant 'public' modifier.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:11:5: error: Redundant 'public' modifier. (com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck)
this.simState = simState;
this.regions = regions;
this.ids = ids;
}

public synchronized double nextDouble() {

Check failure on line 17 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L17 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:17:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return simState.random.nextDouble();
}

public synchronized int nextInt(int upperBound) {

Check failure on line 21 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L21 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:21:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return simState.random.nextInt(upperBound);
}

public synchronized int getRegion(int x, int y, int z) {

Check failure on line 25 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L25 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:25:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return regions[x][y][z];
}

public synchronized int getId(int z, int y, int x) {

Check failure on line 29 in src/arcade/potts/sim/SynchronizedState.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/potts/sim/SynchronizedState.java#L29 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/potts/sim/SynchronizedState.java:29:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return ids[z][y][x];
}
}
Loading