/// <summary> /// Method adds the constant fixed definitions into given components defintion collection. /// Currently it adds two definitions, decision and loop. /// </summary> /// <param name="componentsDefinitionCollection">The collection of components definition into which fixed definition are going to be added</param> internal static void LoadConstantDefinitionsIntoLibrary(ObservableComponentDefinitionCollection componentsDefinitionCollection) { DecisionMetadataDefinition decisionMetadataDefinition = BuildDecisionDefinition(); componentsDefinitionCollection.Add(decisionMetadataDefinition); LoopMetadataDefinition loopMetadataDefinition = BuildWhileLoopDefinition(); componentsDefinitionCollection.Add(loopMetadataDefinition); DecisionMetadataDefinition gotoDecisionMetadataDefinition = BuildGoToDecisionDefinition(); componentsDefinitionCollection.Add(gotoDecisionMetadataDefinition); // HERZUM SPRINT 0.0 ScopeMetadataDefinition scopeMetadataDefinition = BuildScopeDefinition(); componentsDefinitionCollection.Add(scopeMetadataDefinition); // HERZUM SPRINT 2.0: TLAB-65 CLASS // ScopeMetadataDefinition challengeScopeMetadataDefinition = BuildChallengeDefinition(); // componentsDefinitionCollection.Add(challengeScopeMetadataDefinition); ChallengeMetadataDefinition challengeMetadataDefinition = BuildChallengeDefinition(); componentsDefinitionCollection.Add(challengeMetadataDefinition); // END HERZUM SPRINT 2.0: TLAB-65 CLASS // END HERZUM 0.0 // HERZUM SPRINT 1.0 CommentMetadataDefinition commentMetadataDefinition = BuildCommentDefinition(); componentsDefinitionCollection.Add(commentMetadataDefinition); // END HERZUM SPRINT 1.0 }
private static DecisionMetadataDefinition BuildGoToDecisionDefinition() { DecisionMetadataDefinition decisionMetadataDefinition = new DecisionMetadataDefinition(DecisionMetadataDefinition.GotoDecisionGuid); decisionMetadataDefinition.Label = "Goto Decision"; decisionMetadataDefinition.Tags.SetTag("Control Structures", false); decisionMetadataDefinition.Description = "Goto Decisions provides way of specifying execution paths based on runtime data in the workspace."; return decisionMetadataDefinition; }
/// <summary> /// Builds the decision definition. /// </summary> /// <returns></returns> private static DecisionMetadataDefinition BuildDecisionDefinition() { DecisionMetadataDefinition decisionMetadataDefinition = new DecisionMetadataDefinition(DecisionMetadataDefinition.DecisionGuid); decisionMetadataDefinition.Label = "If Statement Decision (with scopes)"; decisionMetadataDefinition.Tags.SetTag("Control Structures", false); decisionMetadataDefinition.Description = "Decisions provides way of specifying execution paths via corresponding scopes based on runtime data in the workspace."; return decisionMetadataDefinition; }
private static DecisionMetadataDefinition BuildGoToDecisionDefinition() { DecisionMetadataDefinition decisionMetadataDefinition = new DecisionMetadataDefinition(DecisionMetadataDefinition.GotoDecisionGuid); decisionMetadataDefinition.Label = "Goto Decision"; decisionMetadataDefinition.Tags.SetTag("Decision & Loops", false); decisionMetadataDefinition.Description = "Goto Decisions provides way of specifying execution paths based on runtime data in the workspace."; return decisionMetadataDefinition; }
/// <summary> /// Builds the decision definition. /// </summary> /// <returns></returns> private static DecisionMetadataDefinition BuildDecisionDefinition() { DecisionMetadataDefinition decisionMetadataDefinition = new DecisionMetadataDefinition(DecisionMetadataDefinition.DecisionGuid); decisionMetadataDefinition.Label = "If Statement Decision (with scopes)"; decisionMetadataDefinition.Tags.SetTag("Decision & Loops", false); decisionMetadataDefinition.Description = "Decisions provides way of specifying execution paths via corresponding scopes based on runtime data in the workspace."; return decisionMetadataDefinition; }
/// <summary> /// Method adds the constant fixed definitions into given components defintion collection. /// Currently it adds two definitions, decision and loop. /// </summary> /// <param name="componentsDefinitionCollection">The collection of components definition into which fixed definition are going to be added</param> internal static void LoadConstantDefinitionsIntoLibrary(ObservableComponentDefinitionCollection componentsDefinitionCollection) { DecisionMetadataDefinition decisionMetadataDefinition = BuildDecisionDefinition(); componentsDefinitionCollection.Add(decisionMetadataDefinition); LoopMetadataDefinition loopMetadataDefinition = BuildWhileLoopDefinition(); componentsDefinitionCollection.Add(loopMetadataDefinition); DecisionMetadataDefinition gotoDecisionMetadataDefinition = BuildGoToDecisionDefinition(); componentsDefinitionCollection.Add(gotoDecisionMetadataDefinition); }
/// <summary> /// Creates the decision component. /// </summary> /// <param name="experiment">The experiment to which new component is added.</param> /// <param name="decisionMetadataDefinition">The decision metadata definition.</param> /// <param name="data">The data containing position of new vertex</param> /// <returns>Newly added desicion node (note, that in case of decision additional nodes are constructed, two scopes and exit decision node). They are not returned.</returns> private static ExperimentDecisionNode CreateDecisionComponent(IEditableExperiment experiment, DecisionMetadataDefinition decisionMetadataDefinition, SerializedVertexData data) { data.Metadata = new DecisionMetadata(decisionMetadataDefinition.Label); ExperimentDecisionNode decisionNode = new ExperimentDecisionNode(Guid.NewGuid().ToString(), data); experiment.AddVertex(decisionNode); if (decisionMetadataDefinition.ID == DecisionMetadataDefinition.DecisionGuid) { //generate corresponding scopes and exit nodes GenerateScopesAndExit(experiment, data, decisionNode); } //otherwise it is GoTo decision that does not have corresponding scopes, so simply return it return decisionNode; }