@@ -0,0 +1,2521 @@
+/*%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.indexing.realtime;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport prm4j.api.BaseEvent;%0Aimport prm4j.api.Event;%0Aimport prm4j.indexing.BaseMonitor;%0A%0A/**%0A * %7B@link BaseMonitor%7D which is aware of all bindings of the trace it processed, and of all monitors which got updated%0A * and created.%0A */%0Apublic class AwareBaseMonitor extends BaseMonitor %7B%0A%0A    private final List%3CBaseEvent%3E baseEventTrace;%0A    private final List%3CAwareBaseMonitor%3E updatedMonitors;%0A    private final List%3CAwareBaseMonitor%3E createdMonitors;%0A%0A    public AwareBaseMonitor() %7B%0A%09super();%0A%09baseEventTrace = new ArrayList%3CBaseEvent%3E();%0A%09updatedMonitors = new ArrayList%3CAwareBaseMonitor%3E();%0A%09createdMonitors = new ArrayList%3CAwareBaseMonitor%3E();%0A%09createdMonitors.add(this);%0A    %7D%0A%0A    public AwareBaseMonitor(List%3CBaseEvent%3E baseEventTrace, List%3CAwareBaseMonitor%3E updatedMonitors,%0A%09    List%3CAwareBaseMonitor%3E createdMonitors) %7B%0A%09super();%0A%09this.baseEventTrace = baseEventTrace;%0A%09this.updatedMonitors = updatedMonitors;%0A%09this.createdMonitors = createdMonitors;%0A%09this.createdMonitors.add(this);%0A    %7D%0A%0A    @Override%0A    public boolean processEvent(Event event) %7B%0A%09updatedMonitors.add(this);%0A%09return baseEventTrace.add(event.getBaseEvent());%0A    %7D%0A%0A    @Override%0A    public boolean isAcceptingStateReachable() %7B%0A%09return true;%0A    %7D%0A%0A    @Override%0A    public BaseMonitor copy() %7B%0A%09AwareBaseMonitor copy = new AwareBaseMonitor(new ArrayList%3CBaseEvent%3E(baseEventTrace), updatedMonitors,%0A%09%09createdMonitors);%0A%09return copy;%0A    %7D%0A%0A    /**%0A     * Returns the trace of base events for this monitor.%0A     *%0A     * @return trace%0A     */%0A    public List%3CBaseEvent%3E getBaseEventTrace() %7B%0A%09return baseEventTrace;%0A    %7D%0A%0A    /**%0A     * Returns the list of monitors, for which 'processEvent' was called.%0A     *%0A     * @return updated monitors%0A     */%0A    public List%3CAwareBaseMonitor%3E getUpdatedMonitors() %7B%0A%09return updatedMonitors;%0A    %7D%0A%0A    /**%0A     * Returns the list of monitors, which where created to monitor a specific instance.%0A     *%0A     * @return created monitors%0A     */%0A    public List%3CAwareBaseMonitor%3E getCreatedMonitors() %7B%0A%09return createdMonitors;%0A    %7D%0A%0A%7D%0A

Add AwareBaseMonitor