*/
public class FileExistenceTrigger implements Trigger {
+ /** Whether a change is triggered. */
+ private boolean triggered;
+
//
// TRIGGER METHODS
//
* {@inheritDoc}
*/
@Override
- public boolean triggers(State previousState, State currentState) {
+ public State mergeStates(State previousState, State currentState) {
Preconditions.checkState(previousState instanceof FileState, "previousState is not a FileState");
Preconditions.checkState(currentState instanceof FileState, "currentState is not a FileState");
- return ((FileState) previousState).exists() != ((FileState) currentState).exists();
+ triggered = ((FileState) previousState).exists() != ((FileState) currentState).exists();
+ return currentState;
}
/**
* {@inheritDoc}
*/
@Override
- public Output output(Reaction reaction) {
- return new DefaultOutput("File appeared/disappeared").addText("text/plain", "File appeared/disappeared").addText("text/html", "<div>File appeared/disappeared</div>");
+ public boolean triggers() {
+ return triggered;
}
}