@@ -0,0 +1,1465 @@
+/*%0A * Copyright (c) 2012 Mateusz Parzonka, Eric Bodden%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A *%0A * Contributors:%0A * Mateusz Parzonka - initial API and implementation%0A */%0Apackage prm4j.logic;%0A%0Aimport prm4j.api.MatchHandler;%0Aimport prm4j.indexing.AbstractBaseMonitor;%0Aimport prm4j.indexing.BaseEvent;%0Aimport prm4j.indexing.Event;%0A%0A/**%0A * A base monitor holding a %7B@link MonitorState%7D which is updated when processing %7B@link BaseEvent%7Ds.%0A *%0A */%0Apublic class StatefulMonitor extends AbstractBaseMonitor %7B%0A%0A    private MonitorState state;%0A%0A    public StatefulMonitor(MonitorState state) %7B%0A%09this.state = state;%0A    %7D%0A%0A    @Override%0A    public boolean processEvent(Event event) %7B%0A%09state = state.getSuccessor(event.getBaseEvent());%0A%09MatchHandler matchHandler = state.getMatchHandler();%0A%09if (matchHandler != null) %7B%0A%09    matchHandler.handleMatch(getBindings());%0A%09    // when a state is a final state, it is still possible we will reach another final state (or loop on a%0A%09    // final state), so we don't return false here%0A%09%7D%0A%09return true;%0A    %7D%0A%0A    @Override%0A    public StatefulMonitor copy() %7B%0A%09return new StatefulMonitor(state);%0A    %7D%0A%0A    @Override%0A    public boolean isFinalStateReachable() %7B%0A%09// TODO co-enable set calculation or similar%0A%09return true;%0A    %7D%0A%0A%7D

Add StatefulMonitor working with Events