/******************************************************************************* | |
* Copyright (c) 2004-2011 Abel Hegedus and Daniel Varro | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v1.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v10.html | |
* | |
* Contributors: | |
* Abel Hegedus - initial API and implementation | |
*******************************************************************************/ | |
package org.eclipse.viatra2.core.tracebased; | |
import org.eclipse.viatra2.core.notification.ICoreNotificationObject; | |
import org.eclipse.viatra2.core.simple.SimpleNotificationManager; | |
/** | |
* @author Abel Hegedus | |
* | |
*/ | |
public class TraceNotificationManager extends SimpleNotificationManager { | |
private TraceNotificationRegister nRegister; | |
private boolean traceRegisterEnabled = true; | |
@Override | |
protected void sendNotification(ICoreNotificationObject notification) { | |
//super.sendNotification(notification); | |
switch (notification.getActionTypeEnum()) { | |
case ACTION_ATOMIC_STEP_READY: | |
if (no_atom_depth > 0) | |
return; | |
else{ | |
break; | |
} | |
case ACTION_MORE_ATOMICS_TO_ONE_ATOM_START: | |
case ACTION_MORE_ATOMICS_TO_ONE_ATOM_END: | |
return; | |
} | |
if (isNotificationEnabled()) { | |
notifyListeners(notification); | |
} | |
if(nRegister != null && traceRegisterEnabled){ | |
nRegister.registerNotification(notification); | |
} | |
} | |
/** | |
* @param nRegister the TraceNotificationRegister to set | |
*/ | |
protected void setRegister(TraceNotificationRegister nRegister) { | |
this.nRegister = nRegister; | |
} | |
/** | |
* @param enabled the enabled to set | |
*/ | |
public void setEnabled(boolean enabled) { | |
this.traceRegisterEnabled = enabled; | |
} | |
} |