@@ -0,0 +1,1530 @@
+/*%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.Event;%0A%0A/**%0A * A base monitor holding a %7B@link MonitorState%7D which is updated when processing %7B@link Event%7Ds.%0A *%0A * @param %3CA%3E%0A *            the type of the auxiliary data usable by base monitors%0A */%0Apublic class StatefulMonitor%3CA%3E extends AbstractBaseMonitor%3CA%3E %7B%0A%0A    private MonitorState%3CA%3E state;%0A%0A    public StatefulMonitor(MonitorState%3CA%3E state) %7B%0A%09this.state = state;%0A    %7D%0A%0A    @Override%0A    public boolean processEvent(Event%3CA%3E event) %7B%0A%09this.state = state.getSuccessor(event.getSymbol());%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 the a%0A%09    // final state)%0A%09    return true;%0A%09%7D%0A%09return true;%0A    %7D%0A%0A    @Override%0A    public StatefulMonitor%3CA%3E copy() %7B%0A%09return new StatefulMonitor%3CA%3E(this.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%0A

Add stateful monitor