blob: edd4be2aa46df937b9b11b4f9be9b3970ac10d69 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2017, 2018 Dortmund University of Applied Sciences and Arts and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Dortmund University of Applied Sciences and Arts - initial API and implementation
*******************************************************************************/
package org.eclipse.app4mc.multicore.openmapping.model.specs;
import org.eclipse.app4mc.amalthea.model.Amalthea;
import org.eclipse.app4mc.amalthea.model.ProcessPrototype;
import org.eclipse.app4mc.multicore.sharelibs.modelchecker.ModelSpec;
import org.eclipse.app4mc.multicore.sharelibs.modelchecker.logger.EntrySeverityLevel;
public class ModelSpecProcessPrototypeFirstLastRunnable extends ModelSpec {
/**
* Builder
*
* @return newly build spec
*/
public static ModelSpecProcessPrototypeFirstLastRunnable build() {
final ModelSpecProcessPrototypeFirstLastRunnable spec = new ModelSpecProcessPrototypeFirstLastRunnable();
spec.specType = "Process Prototype has First/Last Runnable";
spec.name = spec.specType;
return spec;
}
/**
* @see org.eclipse.app4mc.multicore.sharelibs.modelchecker.ModelSpec#checkSpec(org.eclipse.app4mc.amalthea.model.Amalthea)
*/
@Override
protected boolean checkSpec(final Amalthea model) {
boolean cond = true;
for (final ProcessPrototype procProto : model.getSwModel().getProcessPrototypes()) {
if (procProto.getFirstRunnable() == null) {
log("Process Prototype " + procProto.getName() + " doesn't have First Runnable set.");
cond &= false;
continue;
}
if (procProto.getLastRunnable() == null) {
log("Process Prototype " + procProto.getName() + " doesn't have Last Runnable set.");
cond &= false;
continue;
}
}
return cond;
}
/**
* Set the logging severity
*
* @param severity
* logging severity
* @return the same spec object
*/
public ModelSpecProcessPrototypeFirstLastRunnable setSeverity(final EntrySeverityLevel severity) {
this.severity = severity;
return this;
}
}