From c4f2df9b1f0ac93cdd4a71735cba2bc5f295a6d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 2 Jan 2013 13:39:17 +0100 Subject: [PATCH] Run filters after query to convert the state. --- src/main/java/net/pterodactylus/reactor/engine/Engine.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/pterodactylus/reactor/engine/Engine.java b/src/main/java/net/pterodactylus/reactor/engine/Engine.java index 123781f..41aedb7 100644 --- a/src/main/java/net/pterodactylus/reactor/engine/Engine.java +++ b/src/main/java/net/pterodactylus/reactor/engine/Engine.java @@ -22,6 +22,7 @@ import java.util.Set; import java.util.SortedMap; import java.util.concurrent.TimeUnit; +import net.pterodactylus.reactor.Filter; import net.pterodactylus.reactor.Query; import net.pterodactylus.reactor.Reaction; import net.pterodactylus.reactor.Trigger; @@ -129,6 +130,13 @@ public class Engine extends AbstractExecutionThreadService { }; } logger.debug(String.format("State is %s.", state)); + + /* convert states. */ + for (Filter filter : nextReaction.filters()) { + net.pterodactylus.reactor.State newState = filter.filter(state); + logger.debug(String.format("Old state is %s, new state is %s.", state, newState)); + state = newState; + } reactionExecution.addState(state); /* only run trigger if we have collected two states. */ -- 2.7.4