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

Add GoalQuery to PGM api #987

Merged
merged 2 commits into from
May 13, 2022
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package tc.oc.pgm.api.filter.query;

import tc.oc.pgm.goals.Goal;
import tc.oc.pgm.goals.GoalDefinition;

public interface GoalQuery<T extends GoalDefinition> extends MatchQuery {
Goal<T> getGoal();
}
13 changes: 8 additions & 5 deletions core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package tc.oc.pgm.filters.query;

import tc.oc.pgm.goals.Goal;
import tc.oc.pgm.goals.GoalDefinition;

/**
* Currently, the only thing this class does is derive the Match from a Goal. In the future, we may
* have filters that respond specifically to goal queries, but currently we do not.
*/
public class GoalQuery extends MatchQuery {
private final Goal<?> goal;
public class GoalQuery<T extends GoalDefinition> extends MatchQuery
implements tc.oc.pgm.api.filter.query.GoalQuery<T> {
private final Goal<T> goal;

public GoalQuery(Goal<?> goal) {
public GoalQuery(Goal<T> goal) {
super(null, goal.getMatch());
this.goal = goal;
}

public Goal<?> getGoal() {
return goal;
@Override
public Goal<T> getGoal() {
return this.goal;
}
}