Search in sources :

Example 1 with InternalFailureOccurrenceDescription

use of org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription in project Palladio-Editors-Sirius by PalladioSimulator.

the class EditInternalFailureOccurrenceDescriptionProbability method setProbability.

@Override
protected void setProbability(EObject eObject, double probability) {
    InternalFailureOccurrenceDescription element = (InternalFailureOccurrenceDescription) eObject;
    element.setFailureProbability(probability);
}
Also used : InternalFailureOccurrenceDescription(org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription)

Example 2 with InternalFailureOccurrenceDescription

use of org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetFailureType method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    InternalFailureOccurrenceDescription element = (InternalFailureOccurrenceDescription) parameters.get("instance");
    EObjectQuery query = new EObjectQuery(element);
    Collection<Resource> resources = query.getSession().getSemanticResources();
    boolean found = false;
    Resource resource = null;
    for (Resource r : resources) {
        if (r.getURI().equals(URI.createURI("pathmap://PCM_MODELS/FailureTypes.repository"))) {
            found = true;
            resource = r;
            break;
        }
    }
    if (found) {
        Repository rep = (Repository) resource.getContents().iterator().next();
        for (EObject o : rep.eContents()) {
            FailureType failureType = (FailureType) o;
            if (failureType.getEntityName().equals("SoftwareInducedFailure")) {
                element.setSoftwareInducedFailureType__InternalFailureOccurrenceDescription(((SoftwareInducedFailureType) failureType));
                break;
            }
        }
    }
}
Also used : EObjectQuery(org.eclipse.sirius.business.api.query.EObjectQuery) Repository(org.palladiosimulator.pcm.repository.Repository) SoftwareInducedFailureType(org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType) FailureType(org.palladiosimulator.pcm.reliability.FailureType) EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) InternalFailureOccurrenceDescription(org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription) SoftwareInducedFailureType(org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType)

Aggregations

InternalFailureOccurrenceDescription (org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription)2 EObject (org.eclipse.emf.ecore.EObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 EObjectQuery (org.eclipse.sirius.business.api.query.EObjectQuery)1 FailureType (org.palladiosimulator.pcm.reliability.FailureType)1 SoftwareInducedFailureType (org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType)1 Repository (org.palladiosimulator.pcm.repository.Repository)1