Skip to content

Commit

Permalink
code style: getters/setters before meaty methods + don't call PhaseSc…
Browse files Browse the repository at this point in the history
…ope instance phase to avoid confusing with Phase
  • Loading branch information
ge0ffrey committed Jul 20, 2015
1 parent 378ab85 commit ca3ea59
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
Expand Up @@ -8,7 +8,11 @@

public class PhaseTestListener extends AbstractPhaseTestListener {

private List<AbstractPhaseScope> phaseList = new ArrayList<AbstractPhaseScope>();
private List<AbstractPhaseScope> phaseScopeList = new ArrayList<AbstractPhaseScope>();

public List<AbstractPhaseScope> getPhaseScopeList() {
return phaseScopeList;
}

@Override
public void phaseStarted(AbstractPhaseScope phaseScope) {
Expand All @@ -27,10 +31,7 @@ public void stepEnded(AbstractStepScope stepScope) {

@Override
public void phaseEnded(AbstractPhaseScope phaseScope) {
phaseList.add(phaseScope);
phaseScopeList.add(phaseScope);
}

public List<AbstractPhaseScope> getPhaseList() {
return phaseList;
}
}
Expand Up @@ -30,7 +30,7 @@ public void noPhaseConfiguration() {
solver.addPhaseLifecycleListener(listener);
Solution planningProblem = new CloudBalancingDao().readSolution(new File("data/cloudbalancing/unsolved/3computers-9processes.xml"));
solver.solve(planningProblem);
assertEquals(2, listener.getPhaseList().size());
assertEquals(2, listener.getPhaseScopeList().size());
}

@Test
Expand Down
Expand Up @@ -35,8 +35,8 @@ public class NQueensLocalSearchTrackingTest extends NQueensTrackingTest {
private final List<NQueensStepTracking> expectedCoordinates;

public NQueensLocalSearchTrackingTest(AcceptorConfig acceptorConfig,
LocalSearchForagerConfig localSearchForagerConfig,
List<NQueensStepTracking> expectedCoordinates) {
LocalSearchForagerConfig localSearchForagerConfig,
List<NQueensStepTracking> expectedCoordinates) {
this.expectedCoordinates = expectedCoordinates;
this.localSearchForagerConfig = localSearchForagerConfig;
this.acceptorConfig = acceptorConfig;
Expand Down Expand Up @@ -110,5 +110,4 @@ public static Collection<Object[]> parameters() {
return params;
}


}
Expand Up @@ -10,4 +10,5 @@ public static NQueens initialize(NQueens solution) {
}
return solution;
}

}
Expand Up @@ -34,6 +34,10 @@ public NQueensStepTracker(NQueens lastTrackedPlanningProblem) {
this.lastTrackedPlanningProblem = lastTrackedPlanningProblem;
}

public List<NQueensStepTracking> getTrackingList() {
return trackingList;
}

@Override
public void stepEnded(AbstractStepScope stepScope) {
NQueens queens = (NQueens) stepScope.getWorkingSolution();
Expand All @@ -49,8 +53,4 @@ public void stepEnded(AbstractStepScope stepScope) {
lastTrackedPlanningProblem = (NQueens) stepScope.createOrGetClonedSolution();
}

public List<NQueensStepTracking> getTrackingList() {
return trackingList;
}

}
Expand Up @@ -13,4 +13,5 @@ protected void assertTrackingList(List<NQueensStepTracking> expected, List<NQuee
assertEquals(expected.get(i).getRowIndex(), recorded.get(i).getRowIndex());
}
}

}

0 comments on commit ca3ea59

Please sign in to comment.