Skip to content

Commit 70e2c29

Browse files
author
ISWB Prasetya
committed
fixing bug: changing PrimitiveGoal status was not reflected on the status of the underlying goal
1 parent 1e24b60 commit 70e2c29

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/main/java/nl/uu/cs/aplib/mainConcepts/GoalStructure.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ PrimitiveGoal getDeepestFirstPrimGoal_andAllocateBudget() {
276276
}
277277

278278

279-
private void makeInProgressAgain() {
279+
void makeInProgressAgain() {
280280
status.resetToInProgress();
281281
for (GoalStructure G : subgoals) G.makeInProgressAgain();
282282
}
@@ -382,6 +382,28 @@ public PrimitiveGoal(Goal g) {
382382
goal = g ;
383383
}
384384

385+
386+
// need to override these three methods to set the goal status... because we maintain it
387+
// using two fields!! ANTI PATERN :( Should fix this...
388+
389+
@Override
390+
void setStatusToFail(String reason) {
391+
goal.status.setToFail(reason);
392+
super.setStatusToFail(reason);
393+
}
394+
395+
@Override
396+
void setStatusToSuccess(String info) {
397+
goal.status.setToSuccess(info);
398+
super.setStatusToSuccess(info);
399+
}
400+
401+
@Override
402+
void makeInProgressAgain() {
403+
goal.status.resetToInProgress();
404+
super.makeInProgressAgain();
405+
}
406+
385407
}
386-
408+
387409
}

0 commit comments

Comments
 (0)