Пример #1
0
        /// <summary>
        /// Clones the curent node.
        /// </summary>
        /// <param name="model">the model in which the clone should be put</param>
        /// <returns>A new <see cref="BinaryNode"/> instance containing the clone</returns>
        public BinaryNode Clone(BinaryModel model)
        {
            var clone = new BinaryNode(model, Id)
            {
                Name      = Name,
                Protected = Protected,
                State     = State
            };

            return(clone);
        }
Пример #2
0
        /// <summary>
        /// Clones the curent edge.
        /// </summary>
        /// <param name="model">the model in which the clone should be put</param>
        /// <returns>A new <see cref="BinaryEdge"/> instance containing the clone</returns>
        public BinaryEdge Clone(BinaryModel model)
        {
            var clone = new BinaryEdge(model, Id, Type)
            {
                Input  = model.Nodes.First(n => n.Id.Equals(Input.Id)),
                Output = model.Nodes.First(n => n.Id.Equals(Output.Id)),
                State  = State
            };

            return(clone);
        }
Пример #3
0
        /// <summary>
        /// Clones the current model
        /// </summary>
        /// <returns>A new <see cref="BinaryModel"/> instance containing the clone</returns>
        public BinaryModel Clone()
        {
            var clonedModel = new BinaryModel();

            foreach (var binaryNode in Nodes)
            {
                clonedModel.Nodes.Add(binaryNode.Clone(clonedModel));
            }
            foreach (var binaryEdge in Edges)
            {
                clonedModel.Edges.Add(binaryEdge.Clone(clonedModel));
            }
            return(clonedModel);
        }
Пример #4
0
 /// <summary>
 /// protected constructor
 /// </summary>
 /// <param name="model">The parent model</param>
 /// <param name="id">The entity Id</param>
 protected BinaryEntity(BinaryModel model, string id)
 {
     Model = model;
     Id    = id;
     State = State.Unset;
 }
Пример #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="model">The parent model</param>
 /// <param name="id">The node id</param>
 public BinaryNode(BinaryModel model, string id) : base(model, id)
 {
 }
Пример #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="model">The parent model</param>
 /// <param name="id">The edge Id</param>
 /// <param name="type">The edge type</param>
 public BinaryEdge(BinaryModel model, string id, EdgeType type) : base(model, id)
 {
     Type = type;
 }