Search in sources :

Example 1 with HDDProcessingResourceSpecification

use of org.palladiosimulator.pcm.resourceenvironment.HDDProcessingResourceSpecification in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddHDDProcessingResourceSpecification method execute.

@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
    final Object parameter = parameters.get(NEW_HDD_PROCESSING_RESOURCE_SPECIFICATION);
    if (parameter == null || !(parameter instanceof HDDProcessingResourceSpecification)) {
        return;
    }
    final HDDProcessingResourceSpecification hddProcessingResourceSpecification = (HDDProcessingResourceSpecification) parameter;
    // 1. dialog
    final ProcessingResourceType prt = getResourceType(hddProcessingResourceSpecification);
    if (prt != null) {
        hddProcessingResourceSpecification.setActiveResourceType_ActiveResourceSpecification(prt);
    } else {
        return;
    }
    // set processing rate always to 1
    final PCMRandomVariable processingRate = CoreFactory.eINSTANCE.createPCMRandomVariable();
    processingRate.setSpecification("1");
    hddProcessingResourceSpecification.setProcessingRate_ProcessingResourceSpecification(processingRate);
    // 2. dialog
    final PCMRandomVariable readProcessingRate = getReadProcessingRate();
    if (readProcessingRate != null) {
        hddProcessingResourceSpecification.setReadProcessingRate(readProcessingRate);
    } else {
        return;
    }
    // 3. dialog
    final PCMRandomVariable writeProcessingRate = getWriteProcessingRate();
    if (writeProcessingRate != null) {
        hddProcessingResourceSpecification.setWriteProcessingRate(writeProcessingRate);
    } else {
        return;
    }
    // 4. dialog
    final SchedulingPolicy sp = getSchedulingPolicy(hddProcessingResourceSpecification);
    if (sp != null) {
        hddProcessingResourceSpecification.setSchedulingPolicy(sp);
    } else {
        return;
    }
}
Also used : HDDProcessingResourceSpecification(org.palladiosimulator.pcm.resourceenvironment.HDDProcessingResourceSpecification) EObject(org.eclipse.emf.ecore.EObject) ProcessingResourceType(org.palladiosimulator.pcm.resourcetype.ProcessingResourceType) SchedulingPolicy(org.palladiosimulator.pcm.resourcetype.SchedulingPolicy) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)1 HDDProcessingResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.HDDProcessingResourceSpecification)1 ProcessingResourceType (org.palladiosimulator.pcm.resourcetype.ProcessingResourceType)1 SchedulingPolicy (org.palladiosimulator.pcm.resourcetype.SchedulingPolicy)1