Example #1
0
        public override ExperimentNode Clone()
        {
            var clone = new CommentNode();
            clone.CopyFrom(this);

            return clone;
        }
Example #2
0
        public override ExperimentNode Clone()
        {
            var clone = new CommentNode();

            clone.CopyFrom(this);

            return(clone);
        }
Example #3
0
        // HERZUM SPRINT 1.0
        private static bool TryCreateComment(IEditableExperiment experiment, MetadataDefinition metadataDefinition,
                                             SerializedVertexData data, out ExperimentNode newCreatedNode)
        {
            bool isCreated = false;

            newCreatedNode = null;

            CommentMetadataDefinition commentMetadataDefinition = metadataDefinition as CommentMetadataDefinition;

            if (commentMetadataDefinition != null)
            {
                data.Metadata = new CommentMetadata(commentMetadataDefinition.Label);
                string commentNodeId = Guid.NewGuid().ToString();

                // HERZUM SPRINT 1.2 COMMENT
                // newCreatedNode = new CommentNode(commentNodeId, data);
                var data_with_size = new SerializedVertexDataWithSize();
                data_with_size.X            = data.X;
                data_with_size.Y            = data.Y;
                data_with_size.Metadata     = data.Metadata;
                data_with_size.Width        = 160;
                data_with_size.Height       = 160;
                data_with_size.WidgetStatus = "normal";
                newCreatedNode = new CommentNode(commentNodeId, data_with_size);
                // END SPRINT 1.2 COMMENT

                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);
        }
Example #6
0
        // HERZUM SPRINT 1.0
        private static bool TryCreateComment(IEditableExperiment experiment, MetadataDefinition metadataDefinition, 
                                               SerializedVertexData data, out ExperimentNode newCreatedNode)
        {
            bool isCreated = false;
            newCreatedNode = null;

            CommentMetadataDefinition commentMetadataDefinition = metadataDefinition as CommentMetadataDefinition;
            if (commentMetadataDefinition != null)
            {
                data.Metadata = new CommentMetadata(commentMetadataDefinition.Label);
                string commentNodeId = Guid.NewGuid().ToString();

                // HERZUM SPRINT 1.2 COMMENT
                // newCreatedNode = new CommentNode(commentNodeId, data);
                var data_with_size = new SerializedVertexDataWithSize();
                data_with_size.X = data.X;
                data_with_size.Y = data.Y;
                data_with_size.Metadata = data.Metadata;
                data_with_size.Width  = 160;
                data_with_size.Height = 160;
                data_with_size.WidgetStatus = "normal";
                newCreatedNode = new CommentNode(commentNodeId, data_with_size);
                // END SPRINT 1.2 COMMENT

                experiment.AddVertex(newCreatedNode);

                //set the log settings of the new component
                experiment.SetLogLevelSettings(newCreatedNode);

                isCreated = true;
            }

            return isCreated;
        }