本文整理匯總了Java中org.eclipse.gemoc.trace.gemoc.api.ITraceListener類的典型用法代碼示例。如果您正苦於以下問題:Java ITraceListener類的具體用法?Java ITraceListener怎麽用?Java ITraceListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ITraceListener類屬於org.eclipse.gemoc.trace.gemoc.api包,在下文中一共展示了ITraceListener類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: notifyListeners
import org.eclipse.gemoc.trace.gemoc.api.ITraceListener; //導入依賴的package包/類
@Override
public void notifyListeners() {
for (ITraceListener listener : listeners) {
notifyListener(listener);
}
}
示例2: notifyListener
import org.eclipse.gemoc.trace.gemoc.api.ITraceListener; //導入依賴的package包/類
@Override
public void notifyListener(ITraceListener listener) {
final List<ModelChange> changes = traceListener.getChanges(listener);
if (!changes.isEmpty()) {
final List<Step<?>> startedSteps = new ArrayList<>();
final List<Step<?>> endedSteps = new ArrayList<>();
final List<State<?,?>> newStates = new ArrayList<>();
final List<Value<?>> newValues = new ArrayList<>();
final List<Dimension<?>> newDimensions = new ArrayList<>();
changes.forEach(c -> {
if (c instanceof NewObjectModelChange) {
final EObject o = c.getChangedObject();
if (o instanceof Value<?>) {
newValues.add((Value<?>) o);
} else if (o instanceof Step<?>) {
startedSteps.add((Step<?>) o);
} else if (o instanceof State<?,?>) {
final State<?,?> newState = (State<?,?>) o;
newStates.add(newState);
endedSteps.addAll(newState.getEndedSteps());
} else if (o instanceof TracedObject<?>) {
newDimensions.addAll(((TracedObject<?>) o).getDimensions());
}
}
});
if (!newValues.isEmpty()) {
listener.valuesAdded(newValues);
}
if (!newDimensions.isEmpty()) {
listener.dimensionsAdded(newDimensions);
}
if (!newStates.isEmpty()) {
listener.statesAdded(newStates);
}
if (!startedSteps.isEmpty()) {
listener.stepsStarted(startedSteps);
}
if (!endedSteps.isEmpty()) {
listener.stepsEnded(endedSteps);
}
}
}
示例3: addListener
import org.eclipse.gemoc.trace.gemoc.api.ITraceListener; //導入依賴的package包/類
@Override
public void addListener(ITraceListener listener) {
listeners.add(listener);
traceListener.registerObserver(listener);
}
示例4: removeListener
import org.eclipse.gemoc.trace.gemoc.api.ITraceListener; //導入依賴的package包/類
@Override
public void removeListener(ITraceListener listener) {
listeners.remove(listener);
traceListener.removeObserver(listener);
}