public override ExperimentNode Clone() { var clone = new ComponentNode(); clone.CopyFrom(this); return(clone); }
protected override void CopyFrom(ExperimentNode other) { if (other == null) { throw new ArgumentNullException("other"); } base.CopyFrom(other); ComponentNode otherNode = (ComponentNode)other; }
/// <summary> /// Generates the correct node based on metadata contained in serialized vertex data /// </summary> /// <param name="id">The id.</param> /// <param name="nodeData">The node data.</param> /// <returns>Experiment node</returns> private ExperimentNode NodeGenerator(string id, SerializedVertexData nodeData) { if (id == null) { throw new ArgumentNullException("id"); } if (nodeData == null) { throw new ArgumentNullException("nodeData"); } ExperimentNode node; if (nodeData.Metadata is StartNodeMetadata) { node = new ExperimentStartNode(id, nodeData); } else if (nodeData.Metadata is EndNodeMetadata) { node = new ExperimentEndNode(id, nodeData); } else if (nodeData.Metadata is DecisionMetadata) { node = new ExperimentDecisionNode(id, nodeData); } else if (nodeData.Metadata is ScopeMetadata) { node = new ScopeNode(id, (SerializedVertexDataWithSize)nodeData); } else if (nodeData.Metadata is LoopScopeMetadata) { node = new LoopScopeNode(id, (SerializedVertexDataWithSize)nodeData); } else if (nodeData.Metadata is CompositeComponentMetadata) { node = new CompositeComponentNode(id, nodeData); } else if (nodeData.Metadata is ExitDecisionMetadata) { node = new ExitDecisionNode(id, nodeData); } else { ComponentNode componentNode = new ComponentNode(id, nodeData); node = componentNode; } return(node); }
/// <summary> /// Attempts to create the primitive component. Component is created only if definition is a ComponentMetadataDefinition. /// Otherwise method returns false, and null node. /// </summary> /// <param name="experiment">The experiment to which new component is added.</param> /// <param name="metadataDefinition">The metadata definition which component is created based on.</param> /// <param name="data">The data containing position of new vertex</param> /// <param name="newCreatedNode">Output of new created node; null if metadatadefinition was not a ComponentMetadataDefinition</param> /// <returns> /// true if metadatadefinition was a ComponentMetadataDefinition and node has been created, otherwise false /// </returns> private static bool TryCreateComponent(IEditableExperiment experiment, MetadataDefinition metadataDefinition, SerializedVertexData data, out ExperimentNode newCreatedNode) { bool isCreated = false; newCreatedNode = null; ComponentMetadataDefinition componentMetadataDefinition = metadataDefinition as ComponentMetadataDefinition; if (componentMetadataDefinition != null) { data.Metadata = new ComponentMetadata(componentMetadataDefinition, System.IO.Path.GetDirectoryName(experiment.ExperimentInfo.FilePath)); string componentNodeId = Guid.NewGuid().ToString(); newCreatedNode = new ComponentNode(componentNodeId, data); experiment.AddVertex(newCreatedNode); //set the log settings of the new component experiment.SetLogLevelSettings(newCreatedNode); isCreated = true; } return isCreated; }
// END HERZUM SPRINT 1.0 /// <summary> /// Attempts to create the primitive component. Component is created only if definition is a ComponentMetadataDefinition. /// Otherwise method returns false, and null node. /// </summary> /// <param name="experiment">The experiment to which new component is added.</param> /// <param name="metadataDefinition">The metadata definition which component is created based on.</param> /// <param name="data">The data containing position of new vertex</param> /// <param name="newCreatedNode">Output of new created node; null if metadatadefinition was not a ComponentMetadataDefinition</param> /// <returns> /// true if metadatadefinition was a ComponentMetadataDefinition and node has been created, otherwise false /// </returns> private static bool TryCreateComponent(IEditableExperiment experiment, MetadataDefinition metadataDefinition, SerializedVertexData data, out ExperimentNode newCreatedNode) { bool isCreated = false; newCreatedNode = null; ComponentMetadataDefinition componentMetadataDefinition = metadataDefinition as ComponentMetadataDefinition; if (componentMetadataDefinition != null) { data.Metadata = new ComponentMetadata(componentMetadataDefinition, System.IO.Path.GetDirectoryName(experiment.ExperimentInfo.FilePath)); string componentNodeId = Guid.NewGuid().ToString(); newCreatedNode = new ComponentNode(componentNodeId, data); experiment.AddVertex(newCreatedNode); //set the log settings of the new component experiment.SetLogLevelSettings(newCreatedNode); isCreated = true; } return(isCreated); }
/// <summary> /// Generates the correct node based on metadata contained in serialized vertex data /// </summary> /// <param name="id">The id.</param> /// <param name="nodeData">The node data.</param> /// <returns>Experiment node</returns> private ExperimentNode NodeGenerator(string id, SerializedVertexData nodeData) { if (id == null) throw new ArgumentNullException("id"); if (nodeData == null) throw new ArgumentNullException("nodeData"); ExperimentNode node; if (nodeData.Metadata is StartNodeMetadata) { node = new ExperimentStartNode(id, nodeData); } else if (nodeData.Metadata is EndNodeMetadata) { node = new ExperimentEndNode(id, nodeData); } else if (nodeData.Metadata is DecisionMetadata) { node = new ExperimentDecisionNode(id, nodeData); } else if (nodeData.Metadata is ScopeMetadata) { node = new ScopeNode(id, (SerializedVertexDataWithSize)nodeData); } else if (nodeData.Metadata is LoopScopeMetadata) { node = new LoopScopeNode(id, (SerializedVertexDataWithSize)nodeData); } else if (nodeData.Metadata is CompositeComponentMetadata) { node = new CompositeComponentNode(id, nodeData); } else if (nodeData.Metadata is ExitDecisionMetadata) { node = new ExitDecisionNode(id, nodeData); } // HERZUM SPRINT 1.0 else if (nodeData.Metadata is CommentMetadata) { // HERZUM SPRINT 1.2 // node = new CommentNode(id, nodeData); node = new CommentNode(id, (SerializedVertexDataWithSize) nodeData); // END HERZUM SPRINT 1.2 } // END HERZUM SPRINT 1.0 // HERZUM SPRINT 2.0: TLAB-65 CLASS else if (nodeData.Metadata is ChallengeMetadata) { node = new ChallengeNode(id, (SerializedVertexDataWithSize) nodeData); } // END HERZUM SPRINT 2.0: TLAB-65 CLASS else { ComponentNode componentNode = new ComponentNode(id, nodeData); node = componentNode; } return node; }
/// <summary> /// Generates the correct node based on metadata contained in serialized vertex data /// </summary> /// <param name="id">The id.</param> /// <param name="nodeData">The node data.</param> /// <returns>Experiment node</returns> private ExperimentNode NodeGenerator(string id, SerializedVertexData nodeData) { if (id == null) { throw new ArgumentNullException("id"); } if (nodeData == null) { throw new ArgumentNullException("nodeData"); } ExperimentNode node; if (nodeData.Metadata is StartNodeMetadata) { node = new ExperimentStartNode(id, nodeData); } else if (nodeData.Metadata is EndNodeMetadata) { node = new ExperimentEndNode(id, nodeData); } else if (nodeData.Metadata is DecisionMetadata) { node = new ExperimentDecisionNode(id, nodeData); } else if (nodeData.Metadata is ScopeMetadata) { node = new ScopeNode(id, (SerializedVertexDataWithSize)nodeData); } else if (nodeData.Metadata is LoopScopeMetadata) { node = new LoopScopeNode(id, (SerializedVertexDataWithSize)nodeData); } else if (nodeData.Metadata is CompositeComponentMetadata) { node = new CompositeComponentNode(id, nodeData); } else if (nodeData.Metadata is ExitDecisionMetadata) { node = new ExitDecisionNode(id, nodeData); } // HERZUM SPRINT 1.0 else if (nodeData.Metadata is CommentMetadata) { // HERZUM SPRINT 1.2 // node = new CommentNode(id, nodeData); node = new CommentNode(id, (SerializedVertexDataWithSize)nodeData); // END HERZUM SPRINT 1.2 } // END HERZUM SPRINT 1.0 // HERZUM SPRINT 2.0: TLAB-65 CLASS else if (nodeData.Metadata is ChallengeMetadata) { node = new ChallengeNode(id, (SerializedVertexDataWithSize)nodeData); } // END HERZUM SPRINT 2.0: TLAB-65 CLASS else { ComponentNode componentNode = new ComponentNode(id, nodeData); node = componentNode; } return(node); }
public override ExperimentNode Clone() { var clone = new ComponentNode(); clone.CopyFrom(this); return clone; }
/// <summary> /// Generates the correct node based on metadata contained in serialized vertex data /// </summary> /// <param name="id">The id.</param> /// <param name="nodeData">The node data.</param> /// <returns>Experiment node</returns> private ExperimentNode NodeGenerator(string id, SerializedVertexData nodeData) { if (id == null) throw new ArgumentNullException("id"); if (nodeData == null) throw new ArgumentNullException("nodeData"); ExperimentNode node; if (nodeData.Metadata is StartNodeMetadata) { node = new ExperimentStartNode(id, nodeData); } else if (nodeData.Metadata is EndNodeMetadata) { node = new ExperimentEndNode(id, nodeData); } else if (nodeData.Metadata is DecisionMetadata) { node = new ExperimentDecisionNode(id, nodeData); } else if (nodeData.Metadata is ScopeMetadata) { node = new ScopeNode(id, (SerializedVertexDataWithSize)nodeData); } else if (nodeData.Metadata is LoopScopeMetadata) { node = new LoopScopeNode(id, (SerializedVertexDataWithSize)nodeData); } else if (nodeData.Metadata is CompositeComponentMetadata) { node = new CompositeComponentNode(id, nodeData); } else if (nodeData.Metadata is ExitDecisionMetadata) { node = new ExitDecisionNode(id, nodeData); } else { ComponentNode componentNode = new ComponentNode(id, nodeData); node = componentNode; } return node; }