Skip to content

Commit

Permalink
refactor: refactor deed event
Browse files Browse the repository at this point in the history
  • Loading branch information
yan-elena committed Aug 30, 2023
1 parent dd166c0 commit cdf0295
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/java/event/actionEvent/DeedEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ abstract class DeedEvent implements Event {
*/
public DeedEvent(PlanBody deed, Intention intention) {
this.deedInfo = new DeedInfo(deed);
this.intentionInfo = intention != null ? Optional.of(new IntentionInfo(intention)) : Optional.empty();
if (intention != null) {
IntentionInfo intentionInfo = new IntentionInfo(intention);
if (intentionInfo.peekFirstIntendedMeans().isPresent() &&
intentionInfo.peekFirstIntendedMeans().get().getPlan().getBody().contains(deedInfo.getTerm())) {
this.intentionInfo = Optional.of(intentionInfo);
} else {
this.intentionInfo = Optional.empty();
}
} else {
this.intentionInfo = Optional.empty();
}
}

public DeedInfo getDeedInfo() {
Expand Down
1 change: 1 addition & 0 deletions src/java/log/LoggerArch.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
public class LoggerArch extends AgArch {

private final EventLogger eventLogger;
private Intention currentIntention;

/**
* Creates a new instance of {@link LoggerArch} and initialized the logger.
Expand Down

0 comments on commit cdf0295

Please sign in to comment.