From 56cedb7e8556f31af5c6a44a3db2abc88b9367f4 Mon Sep 17 00:00:00 2001 From: KingSimon <19822231+KingOfSquares@users.noreply.github.com> Date: Fri, 15 Apr 2022 00:15:48 +0200 Subject: [PATCH 1/2] Add GoalQuery to PGM api Signed-off-by: KingSimon <19822231+KingOfSquares@users.noreply.github.com> --- .../java/tc/oc/pgm/api/filter/query/GoalQuery.java | 8 ++++++++ .../main/java/tc/oc/pgm/filters/query/GoalQuery.java | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java diff --git a/core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java b/core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java new file mode 100644 index 0000000000..a46f8dc1ff --- /dev/null +++ b/core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java @@ -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 extends MatchQuery { + Goal getGoal(); +} diff --git a/core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java b/core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java index 6f25243fb9..60cd7bb705 100644 --- a/core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java +++ b/core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java @@ -1,20 +1,22 @@ 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 extends MatchQuery implements tc.oc.pgm.api.filter.query.GoalQuery { + private final Goal goal; - public GoalQuery(Goal goal) { + public GoalQuery(Goal goal) { super(null, goal.getMatch()); this.goal = goal; } - public Goal getGoal() { - return goal; + @Override + public Goal getGoal() { + return this.goal; } } From 998f0806a01a281dd5dd96cff9710e2f3393d58e Mon Sep 17 00:00:00 2001 From: KingSimon <19822231+KingOfSquares@users.noreply.github.com> Date: Sat, 16 Apr 2022 15:19:00 +0200 Subject: [PATCH 2/2] Use generics instead of wildcards Signed-off-by: KingSimon <19822231+KingOfSquares@users.noreply.github.com> --- .../main/java/tc/oc/pgm/api/filter/query/GoalQuery.java | 4 ++-- .../src/main/java/tc/oc/pgm/filters/query/GoalQuery.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java b/core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java index a46f8dc1ff..5611d9a225 100644 --- a/core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java +++ b/core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java @@ -3,6 +3,6 @@ import tc.oc.pgm.goals.Goal; import tc.oc.pgm.goals.GoalDefinition; -public interface GoalQuery extends MatchQuery { - Goal getGoal(); +public interface GoalQuery extends MatchQuery { + Goal getGoal(); } diff --git a/core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java b/core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java index 60cd7bb705..8ee5501656 100644 --- a/core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java +++ b/core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java @@ -7,16 +7,17 @@ * 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 implements tc.oc.pgm.api.filter.query.GoalQuery { - private final Goal goal; +public class GoalQuery extends MatchQuery + implements tc.oc.pgm.api.filter.query.GoalQuery { + private final Goal goal; - public GoalQuery(Goal goal) { + public GoalQuery(Goal goal) { super(null, goal.getMatch()); this.goal = goal; } @Override - public Goal getGoal() { + public Goal getGoal() { return this.goal; } }