Search in sources :

Example 16 with ScenarioBehaviour

use of org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour in project iobserve-analysis by research-iobserve.

the class OverlappingIterationReference method getModel.

/**
 * Creates a reference model that contains a loop element. The user sessions contain iterated
 * call sequences that share overlapping calls. Thereby, one iterated sequence consists of more
 * calls than the other. Thus, it can be checked whether the approach transforms the iterated
 * call sequence that consists of more calls to a loop (RQ-1.4)
 *
 * @param referenceUsageModelFileName
 *            file name of the reference model to store its result
 * @param repositoryLookupModelProvider
 *            repository model provider
 * @param correspondenceModel
 *            correspondence model
 *
 * @return a reference usage model and corresponding user sessions
 * @throws IOException
 *             on error
 */
public static ReferenceElements getModel(final String referenceUsageModelFileName, final RepositoryLookupModelProvider repositoryLookupModelProvider, final ICorrespondence correspondenceModel) throws IOException {
    // Creates a random number of user sessions and random model element parameters. The user
    // sessions' behavior will be created according to the reference usage model and
    // subsequently the user sessions are used to create a usage model. The created usage model
    // is matched against the reference usage model.
    final int numberOfConcurrentUsers = TestHelper.getRandomInteger(200, 1);
    // One of the iterated sequences is iterated twice and one is iterated three times. The
    // number of iterations is set randomly.
    final int loopCount1 = TestHelper.getRandomInteger(3, 2);
    final int lengthOfSequence1 = 2 * loopCount1;
    final int loopCount2;
    if (loopCount1 == 3) {
        loopCount2 = 2;
    } else {
        loopCount2 = 3;
    }
    final int lengthOfSequence2 = 2 * loopCount2;
    final ReferenceElements referenceElements = new ReferenceElements();
    final EntryCallSequenceModel entryCallSequenceModel = new EntryCallSequenceModel(TestHelper.getUserSessions(numberOfConcurrentUsers));
    // In the following the reference usage model is created
    AbstractUserAction lastAction;
    final UsageModel usageModel = UsageModelFactory.createUsageModel();
    final UsageScenario usageScenario = UsageModelFactory.createUsageScenario("", usageModel);
    final ScenarioBehaviour scenarioBehaviour = usageScenario.getScenarioBehaviour_UsageScenario();
    final Start start = UsageModelFactory.createStart("");
    UsageModelFactory.addUserAction(scenarioBehaviour, start);
    final Stop stop = UsageModelFactory.createStop("");
    UsageModelFactory.addUserAction(scenarioBehaviour, stop);
    // According to the randomly set number of iterations the sequence that is iterated three
    // times is represented by a loop element. The other sequence is represented by a sequence
    final Loop loop = UsageModelFactory.createLoop("", scenarioBehaviour);
    if (lengthOfSequence1 >= lengthOfSequence2) {
        UsageModelFactory.connect(start, loop);
        final PCMRandomVariable pcmLoopIteration = CoreFactory.eINSTANCE.createPCMRandomVariable();
        pcmLoopIteration.setSpecification(String.valueOf(loopCount1));
        // Set number of loops
        loop.setLoopIteration_Loop(pcmLoopIteration);
        final Start loopStart = UsageModelFactory.createStart("");
        UsageModelFactory.addUserAction(loop.getBodyBehaviour_Loop(), loopStart);
        final Stop loopStop = UsageModelFactory.createStop("");
        UsageModelFactory.addUserAction(loop.getBodyBehaviour_Loop(), loopStop);
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 0, loopStart, scenarioBehaviour);
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 2, lastAction, scenarioBehaviour);
        UsageModelFactory.connect(lastAction, loopStop);
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 3, loop, scenarioBehaviour);
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 2, lastAction, scenarioBehaviour);
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 3, lastAction, scenarioBehaviour);
        UsageModelFactory.connect(lastAction, stop);
    } else {
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 0, start, scenarioBehaviour);
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 2, lastAction, scenarioBehaviour);
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 0, lastAction, scenarioBehaviour);
        UsageModelFactory.connect(lastAction, loop);
        final PCMRandomVariable pcmLoopIteration = CoreFactory.eINSTANCE.createPCMRandomVariable();
        pcmLoopIteration.setSpecification(String.valueOf(loopCount2));
        // Set number of loops
        loop.setLoopIteration_Loop(pcmLoopIteration);
        final Start loopStart = UsageModelFactory.createStart("");
        UsageModelFactory.addUserAction(loop.getBodyBehaviour_Loop(), loopStart);
        final Stop loopStop = UsageModelFactory.createStop("");
        UsageModelFactory.addUserAction(loop.getBodyBehaviour_Loop(), loopStop);
        lastAction = loopStart;
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 2, lastAction, scenarioBehaviour);
        lastAction = OverlappingIterationReference.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondenceModel, 3, lastAction, scenarioBehaviour);
        UsageModelFactory.connect(lastAction, loopStop);
        UsageModelFactory.connect(loop, stop);
    }
    OverlappingIterationReference.createMatchingEntryAndExitEvents(entryCallSequenceModel, lengthOfSequence1, lengthOfSequence2, loopCount1, loopCount2);
    // Saves the reference usage model and sets the usage model and the EntryCallSequenceModel
    // as the reference elements. Our approach is now executed with the EntryCallSequenceModel
    // and the resulting usage model can be matched against the reference usage model
    TestHelper.saveModel(usageModel, referenceUsageModelFileName);
    referenceElements.setEntryCallSequenceModel(entryCallSequenceModel);
    referenceElements.setUsageModel(usageModel);
    return referenceElements;
}
Also used : AbstractUserAction(org.palladiosimulator.pcm.usagemodel.AbstractUserAction) Loop(org.palladiosimulator.pcm.usagemodel.Loop) UsageScenario(org.palladiosimulator.pcm.usagemodel.UsageScenario) ScenarioBehaviour(org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour) Start(org.palladiosimulator.pcm.usagemodel.Start) Stop(org.palladiosimulator.pcm.usagemodel.Stop) UsageModel(org.palladiosimulator.pcm.usagemodel.UsageModel) ReferenceElements(org.iobserve.analysis.userbehavior.ReferenceElements) EntryCallSequenceModel(org.iobserve.analysis.data.EntryCallSequenceModel) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 17 with ScenarioBehaviour

use of org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour in project iobserve-analysis by research-iobserve.

the class SimpleBranchReference method getModel.

/**
 * Creates a reference model that contains a branch element. Accordingly, user sessions whose
 * call sequences differ from each other at the position of the branch are created.(RQ-1.2)
 *
 * @param referenceModelFileName
 *            file name of the reference model to store its result
 * @param repositoryLookupModelProvider
 *            repository model provider
 * @param correspondenceModel
 *            correspondence model
 *
 * @return a reference usage model and corresponding user sessions
 * @throws IOException
 *             on error
 */
public static ReferenceElements getModel(final String referenceModelFileName, final RepositoryLookupModelProvider repositoryLookupModelProvider, final ICorrespondence correspondenceModel) throws IOException {
    // Create a random number of user sessions and random model element parameters. The user
    // sessions' behavior will be created according to the reference usage model and
    // subsequently the user sessions are used to create a usage model. The created usage model
    // is matched against the reference usage model. The minimum number of user sessions is set
    // dependently from the random number of branch transitions, because it must be ensured that
    // each branch transition is represented within the user sessions.
    final int numberOfBranchTransitions = TestHelper.getRandomInteger(5, 2);
    final int numberOfConcurrentUsers = TestHelper.getRandomInteger(200, 10 * numberOfBranchTransitions);
    final EntryCallSequenceModel entryCallSequenceModel = new EntryCallSequenceModel(TestHelper.getUserSessions(numberOfConcurrentUsers));
    // In the following the reference usage model is created
    Optional<Correspondent> correspondent;
    final UsageModel usageModel = UsageModelFactory.createUsageModel();
    final UsageScenario usageScenario = UsageModelFactory.createUsageScenario("", usageModel);
    final ScenarioBehaviour scenarioBehaviour = usageScenario.getScenarioBehaviour_UsageScenario();
    final Start start = UsageModelFactory.createAddStartAction("", scenarioBehaviour);
    final Stop stop = UsageModelFactory.createAddStopAction("", scenarioBehaviour);
    AbstractUserAction lastAction = start;
    // Creates the branch element and the branch transitions according to the random number of
    // branch transitions
    final org.palladiosimulator.pcm.usagemodel.Branch branch = UsageModelFactory.createBranch("", scenarioBehaviour);
    UsageModelFactory.connect(start, branch);
    // the alternative call sequences
    for (int i = 0; i < numberOfBranchTransitions; i++) {
        final BranchTransition branchTransition = UsageModelFactory.createBranchTransition(branch);
        final ScenarioBehaviour branchTransitionBehaviour = branchTransition.getBranchedBehaviour_BranchTransition();
        final Start startBranchTransition = UsageModelFactory.createAddStartAction("", branchTransitionBehaviour);
        final Stop stopBranchTransition = UsageModelFactory.createAddStopAction("", branchTransitionBehaviour);
        lastAction = startBranchTransition;
        if (i >= 0 && i < 5) {
            correspondent = correspondenceModel.getCorrespondent(ReferenceUsageModelBuilder.CLASS_SIGNATURE[i], ReferenceUsageModelBuilder.OPERATION_SIGNATURE[i]);
        } else {
            throw new IllegalArgumentException("Illegal value of model element parameter");
        }
        if (correspondent.isPresent()) {
            final EntryLevelSystemCall entryLevelSystemCall = UsageModelFactory.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondent.get());
            UsageModelFactory.addUserAction(branchTransitionBehaviour, entryLevelSystemCall);
            UsageModelFactory.connect(lastAction, entryLevelSystemCall);
            lastAction = entryLevelSystemCall;
        }
        if (i == 0) {
            correspondent = correspondenceModel.getCorrespondent(ReferenceUsageModelBuilder.CLASS_SIGNATURE[1], ReferenceUsageModelBuilder.OPERATION_SIGNATURE[1]);
        } else {
            correspondent = correspondenceModel.getCorrespondent(ReferenceUsageModelBuilder.CLASS_SIGNATURE[0], ReferenceUsageModelBuilder.OPERATION_SIGNATURE[0]);
        }
        if (correspondent.isPresent()) {
            final EntryLevelSystemCall entryLevelSystemCall = UsageModelFactory.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondent.get());
            UsageModelFactory.addUserAction(branchTransitionBehaviour, entryLevelSystemCall);
            UsageModelFactory.connect(lastAction, entryLevelSystemCall);
            lastAction = entryLevelSystemCall;
        }
        UsageModelFactory.connect(lastAction, stopBranchTransition);
    }
    correspondent = correspondenceModel.getCorrespondent(ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2]);
    if (correspondent.isPresent()) {
        final EntryLevelSystemCall entryLevelSystemCall = UsageModelFactory.createEntryLevelSystemCall(repositoryLookupModelProvider, correspondent.get());
        UsageModelFactory.addUserAction(scenarioBehaviour, entryLevelSystemCall);
        UsageModelFactory.connect(branch, entryLevelSystemCall);
        lastAction = entryLevelSystemCall;
    }
    UsageModelFactory.connect(lastAction, stop);
    final List<Integer> branchTransitionCounter = SimpleBranchReference.computeBranchTransitions(entryCallSequenceModel, branch, numberOfBranchTransitions);
    // the randomly created user sessions
    for (int i = 0; i < branch.getBranchTransitions_Branch().size(); i++) {
        branch.getBranchTransitions_Branch().get(i).setBranchProbability((double) branchTransitionCounter.get(i) / numberOfConcurrentUsers);
    }
    return SimpleBranchReference.saveReferenceElements(usageModel, referenceModelFileName, entryCallSequenceModel);
}
Also used : EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) Start(org.palladiosimulator.pcm.usagemodel.Start) Stop(org.palladiosimulator.pcm.usagemodel.Stop) EntryCallSequenceModel(org.iobserve.analysis.data.EntryCallSequenceModel) AbstractUserAction(org.palladiosimulator.pcm.usagemodel.AbstractUserAction) UsageScenario(org.palladiosimulator.pcm.usagemodel.UsageScenario) ScenarioBehaviour(org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour) UsageModel(org.palladiosimulator.pcm.usagemodel.UsageModel) BranchTransition(org.palladiosimulator.pcm.usagemodel.BranchTransition) Correspondent(org.iobserve.model.correspondence.Correspondent) Branch(org.palladiosimulator.pcm.usagemodel.Branch)

Example 18 with ScenarioBehaviour

use of org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour in project iobserve-analysis by research-iobserve.

the class PcmUsageModelBuilder method transformSequenceToScenarioBehavior.

/**
 * Creates a scenario behavior corresponding to the passed sequence. The sequence can be a
 * branch sequence or a loop sequence. It creates a sequence of entry level system calls
 * including loops within the sequence. It sets the successors and predecessors.
 *
 * @param indexOfScenario
 *            states the index of the created scenario within the usage scenario
 * @param sequence
 *            that is transformed to a scenario behavior
 * @param branch
 *            contains the child branches of the branch whose behavior is created
 * @return the created scenario behavior
 */
private // NOCS
ScenarioBehaviour transformSequenceToScenarioBehavior(// NOCS
final int indexOfScenario, final List<ISequenceElement> sequence, final Branch branch) {
    final ScenarioBehaviour scenarioBehaviour = UsageModelFactory.createScenarioBehaviour();
    final Start start = UsageModelFactory.createAddStartAction("", scenarioBehaviour);
    final Stop stop = UsageModelFactory.createAddStopAction("", scenarioBehaviour);
    EntryLevelSystemCall lastESysCall = UsageModelFactory.createEmptyEntryLevelSystemCall();
    boolean isLastElementACall = false;
    Loop lastLoop = UsageModelFactory.createEmptyLoop();
    boolean isLastElementALoop = false;
    org.palladiosimulator.pcm.usagemodel.Branch lastLoopBranch = UsagemodelFactory.eINSTANCE.createBranch();
    boolean isLastElementALoopBranch = false;
    org.palladiosimulator.pcm.usagemodel.Branch lastBranch = UsagemodelFactory.eINSTANCE.createBranch();
    boolean isLastElementABranch = false;
    /**
     * Loops over all elements of the sequence and creates a corresponding scenario behavior by
     * connecting the elements via successor and predecessor connections.
     */
    for (final ISequenceElement branchElement : sequence) {
        // Element is a entryLevelSystemCall
        if (branchElement.getClass().equals(CallElement.class)) {
            EntryLevelSystemCall eSysCall = null;
            // Workaround TODO
            final String operationSignature = branchElement.getOperationSignature().replaceAll("\\(.*\\)", "()");
            final String[] operationSplit = operationSignature.split(" ");
            final Optional<Correspondent> optionCorrespondent = this.correspondenceModel.getCorrespondent(branchElement.getClassSignature(), operationSplit[operationSplit.length - 1]);
            if (optionCorrespondent.isPresent()) {
                final Correspondent correspondent = optionCorrespondent.get();
                if (PcmUsageModelBuilder.LOGGER.isDebugEnabled()) {
                    PcmUsageModelBuilder.LOGGER.debug("Usage: Found Correspondent: {}", correspondent.getPcmEntityName() + " " + correspondent.getPcmOperationName());
                }
                eSysCall = UsageModelFactory.createEntryLevelSystemCall(this.repositoryLookupModel, correspondent);
            }
            if (eSysCall != null) {
                if (isLastElementACall) {
                    UsageModelFactory.connect(lastESysCall, eSysCall);
                } else if (isLastElementALoop) {
                    UsageModelFactory.connect(lastLoop, eSysCall);
                } else if (isLastElementALoopBranch) {
                    UsageModelFactory.connect(lastLoopBranch, eSysCall);
                } else if (isLastElementABranch) {
                    UsageModelFactory.connect(lastBranch, eSysCall);
                } else {
                    UsageModelFactory.connect(start, eSysCall);
                }
                UsageModelFactory.addUserAction(scenarioBehaviour, eSysCall);
                lastESysCall = eSysCall;
                isLastElementACall = true;
                isLastElementALoop = false;
                isLastElementALoopBranch = false;
                isLastElementABranch = false;
            }
        } else if (branchElement.getClass().equals(LoopElement.class)) {
            // Element is a loop
            final Loop loop = this.createLoop(scenarioBehaviour, (LoopElement) branchElement);
            if (isLastElementACall) {
                UsageModelFactory.connect(lastESysCall, loop);
            } else if (isLastElementALoop) {
                UsageModelFactory.connect(lastLoop, loop);
            } else if (isLastElementALoopBranch) {
                UsageModelFactory.connect(lastLoopBranch, loop);
            } else if (isLastElementABranch) {
                UsageModelFactory.connect(lastBranch, loop);
            } else {
                UsageModelFactory.connect(start, loop);
            }
            lastLoop = loop;
            isLastElementALoop = true;
            isLastElementACall = false;
            isLastElementALoopBranch = false;
            isLastElementABranch = false;
        } else if (branchElement.getClass().equals(LoopBranchElement.class)) {
            // Element is a
            // looped Branch
            final org.palladiosimulator.pcm.usagemodel.Branch loopBranch = this.createLoopBranch(scenarioBehaviour, (LoopBranchElement) branchElement);
            if (isLastElementACall) {
                UsageModelFactory.connect(lastESysCall, loopBranch);
            } else if (isLastElementALoop) {
                UsageModelFactory.connect(lastLoop, loopBranch);
            } else if (isLastElementALoopBranch) {
                UsageModelFactory.connect(lastLoopBranch, loopBranch);
            } else if (isLastElementABranch) {
                UsageModelFactory.connect(lastBranch, loopBranch);
            } else {
                UsageModelFactory.connect(start, loopBranch);
            }
            lastLoopBranch = loopBranch;
            isLastElementALoopBranch = true;
            isLastElementACall = false;
            isLastElementALoop = false;
            isLastElementABranch = false;
        } else if (branchElement.getClass().equals(BranchElement.class)) {
            // Element is a
            // Branch
            final org.palladiosimulator.pcm.usagemodel.Branch branchInter = this.createBranch(scenarioBehaviour, (BranchElement) branchElement);
            if (isLastElementACall) {
                UsageModelFactory.connect(lastESysCall, branchInter);
            } else if (isLastElementALoop) {
                UsageModelFactory.connect(lastLoop, branchInter);
            } else if (isLastElementALoopBranch) {
                UsageModelFactory.connect(lastLoopBranch, branchInter);
            } else if (isLastElementABranch) {
                UsageModelFactory.connect(lastBranch, branchInter);
            } else {
                UsageModelFactory.connect(start, branchInter);
            }
            lastBranch = branchInter;
            isLastElementABranch = true;
            isLastElementALoopBranch = false;
            isLastElementACall = false;
            isLastElementALoop = false;
        } else {
            break;
        }
    }
    // checks if the branch got child branches
    if (branch == null) {
        if (isLastElementACall) {
            UsageModelFactory.connect(lastESysCall, stop);
        } else if (isLastElementALoop) {
            UsageModelFactory.connect(lastLoop, stop);
        } else if (isLastElementALoopBranch) {
            UsageModelFactory.connect(lastLoopBranch, stop);
        } else if (isLastElementABranch) {
            UsageModelFactory.connect(lastBranch, stop);
        } else {
            UsageModelFactory.connect(start, stop);
        }
    } else {
        final org.palladiosimulator.pcm.usagemodel.Branch branchUM = this.createChildBranch(scenarioBehaviour, indexOfScenario, branch);
        if (branchUM != null) {
            if (isLastElementACall) {
                UsageModelFactory.connect(lastESysCall, branchUM);
                UsageModelFactory.connect(branchUM, stop);
            } else if (isLastElementALoop) {
                UsageModelFactory.connect(lastLoop, branchUM);
                UsageModelFactory.connect(branchUM, stop);
            } else if (isLastElementALoopBranch) {
                UsageModelFactory.connect(lastLoopBranch, branchUM);
                UsageModelFactory.connect(branchUM, stop);
            } else if (isLastElementABranch) {
                UsageModelFactory.connect(lastBranch, branchUM);
                UsageModelFactory.connect(branchUM, stop);
            } else {
                UsageModelFactory.connect(start, branchUM);
                UsageModelFactory.connect(branchUM, stop);
            }
        } else {
            if (isLastElementACall) {
                UsageModelFactory.connect(lastESysCall, stop);
            } else if (isLastElementALoop) {
                UsageModelFactory.connect(lastLoop, stop);
            } else if (isLastElementALoopBranch) {
                UsageModelFactory.connect(lastLoopBranch, stop);
            } else if (isLastElementABranch) {
                UsageModelFactory.connect(lastBranch, stop);
            } else {
                UsageModelFactory.connect(start, stop);
            }
        }
    }
    return scenarioBehaviour;
}
Also used : Loop(org.palladiosimulator.pcm.usagemodel.Loop) EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) Start(org.palladiosimulator.pcm.usagemodel.Start) Stop(org.palladiosimulator.pcm.usagemodel.Stop) ISequenceElement(org.iobserve.analysis.userbehavior.data.ISequenceElement) LoopElement(org.iobserve.analysis.userbehavior.data.LoopElement) ScenarioBehaviour(org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour) Branch(org.iobserve.analysis.userbehavior.data.Branch) Correspondent(org.iobserve.model.correspondence.Correspondent) BranchElement(org.iobserve.analysis.userbehavior.data.BranchElement) LoopBranchElement(org.iobserve.analysis.userbehavior.data.LoopBranchElement)

Example 19 with ScenarioBehaviour

use of org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour in project iobserve-analysis by research-iobserve.

the class PcmUsageModelBuilder method createLoop.

/**
 * Creates for a loop element a corresponding PCM loop including a corresponding usage scenario.
 *
 * @param scenarioBehaviour
 *            to that the PCM loop is added
 * @param loopElement
 *            that is transformed to a PCM loop
 * @return a PCM loop
 */
private Loop createLoop(final ScenarioBehaviour scenarioBehaviour, final LoopElement loopElement) {
    final Loop loop = UsageModelFactory.createLoop("", scenarioBehaviour);
    final ScenarioBehaviour loopScenarioBehaviour = this.transformSequenceToScenarioBehavior(0, loopElement.getLoopSequence(), null);
    // Set behavior of the loop
    loop.setBodyBehaviour_Loop(loopScenarioBehaviour);
    final PCMRandomVariable pcmLoopIteration = CoreFactory.eINSTANCE.createPCMRandomVariable();
    pcmLoopIteration.setSpecification(String.valueOf(loopElement.getLoopCount()));
    // Set number of loops
    loop.setLoopIteration_Loop(pcmLoopIteration);
    return loop;
}
Also used : Loop(org.palladiosimulator.pcm.usagemodel.Loop) ScenarioBehaviour(org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 20 with ScenarioBehaviour

use of org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour in project iobserve-analysis by research-iobserve.

the class PcmUsageModelBuilder method createBranch.

/**
 * Creates for a branch a corresponding PCM branch including a corresponding usage scenario.
 *
 * @param scenarioBehaviour
 *            to that the PCM branch is added
 * @param branchElement
 *            that is transformed to a PCM branch element
 * @return a PCM branch element
 */
private org.palladiosimulator.pcm.usagemodel.Branch createBranch(final ScenarioBehaviour scenarioBehaviour, final BranchElement branchElement) {
    final org.palladiosimulator.pcm.usagemodel.Branch branchUM = UsageModelFactory.createBranch("", scenarioBehaviour);
    for (final BranchTransitionElement transition : branchElement.getBranchTransitions()) {
        final BranchTransition branchTransition = UsageModelFactory.createBranchTransition(branchUM);
        final ScenarioBehaviour branchScenarioBehaviour = this.transformSequenceToScenarioBehavior(0, transition.getBranchSequence(), null);
        branchTransition.setBranchedBehaviour_BranchTransition(branchScenarioBehaviour);
        branchTransition.setBranch_BranchTransition(branchUM);
        branchTransition.setBranchProbability(transition.getTransitionLikelihood());
    }
    return branchUM;
}
Also used : BranchTransitionElement(org.iobserve.analysis.userbehavior.data.BranchTransitionElement) ScenarioBehaviour(org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour) BranchTransition(org.palladiosimulator.pcm.usagemodel.BranchTransition)

Aggregations

ScenarioBehaviour (org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour)21 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)12 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)10 Start (org.palladiosimulator.pcm.usagemodel.Start)10 Stop (org.palladiosimulator.pcm.usagemodel.Stop)10 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)10 Correspondent (org.iobserve.model.correspondence.Correspondent)9 Loop (org.palladiosimulator.pcm.usagemodel.Loop)9 AbstractUserAction (org.palladiosimulator.pcm.usagemodel.AbstractUserAction)8 BranchTransition (org.palladiosimulator.pcm.usagemodel.BranchTransition)8 EntryCallSequenceModel (org.iobserve.analysis.data.EntryCallSequenceModel)7 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)7 ReferenceElements (org.iobserve.analysis.userbehavior.ReferenceElements)6 EntryCallEvent (org.iobserve.stages.general.data.EntryCallEvent)4 ArrayList (java.util.ArrayList)3 Branch (org.palladiosimulator.pcm.usagemodel.Branch)3 HashMap (java.util.HashMap)2 Branch (org.iobserve.analysis.userbehavior.data.Branch)2 List (java.util.List)1 UserSession (org.iobserve.analysis.session.data.UserSession)1