public override object CloneExp(MathNode parent)
        {
            MathNodeVariable node = (MathNodeVariable)base.CloneExp(parent);

            node.VariableName  = _value;
            node.SubscriptName = _subscript;
            node._id           = ID;
            node.IsLocal       = IsLocal;
            node.IsParam       = IsParam;
            node.IsReturn      = IsReturn;
            node._passin       = _passin;
            if (_subscriptFont != null)
            {
                node._subscriptFont = (Font)_subscriptFont.Clone();
            }
            node.IsSuperscript = IsSuperscript;
            node.Position      = new Point(Position.X, Position.Y);
            if (VariableType == null)
            {
                throw new MathException("VariableType is null when clone it. {0}", _value);
            }
            else
            {
                node.VariableType = (RaisDataType)VariableType.Clone();
            }
            if (ClonePorts)
            {
                if (_outports != null)
                {
                    LinkLineNodeOutPort[] ports = new LinkLineNodeOutPort[_outports.Length];
                    for (int i = 0; i < ports.Length; i++)
                    {
                        _outports[i].ConstructorParameters = new object[] { node };
                        ports[i] = (LinkLineNodeOutPort)_outports[i].Clone();
                    }
                    node.OutPorts = ports;
                }
                if (_inport != null)
                {
                    _inport.ConstructorParameters = new object[] { node };
                    node.InPort = (LinkLineNodeInPort)_inport.Clone();
                }
            }
            return(node);
        }
示例#2
0
        public object Clone()
        {
            ProgramEntity obj = new ProgramEntity(
                (ObjectRef)_owner.Clone());

            if (_inports != null)
            {
                ProgramInPort[] a = new ProgramInPort[_inports.Length];
                for (int i = 0; i < _inports.Length; i++)
                {
                    _inports[i].ConstructorParameters = new object[] { obj };
                    a[i] = (ProgramInPort)_inports[i].Clone();
                }
                obj.Inports = a;
            }
            if (_outports != null)
            {
                ProgramOutPort[] a = new ProgramOutPort[_outports.Length];
                for (int i = 0; i < _outports.Length; i++)
                {
                    _outports[i].ConstructorParameters = new object[] { obj };
                    a[i] = (ProgramOutPort)_outports[i].Clone();
                }
                obj.Outports = a;
            }
            if (_newInport != null)
            {
                _newInport.ConstructorParameters = new object[] { obj };
                obj.NewInport = (LinkLineNodeInPort)_newInport.Clone();
            }
            if (_newOutport != null)
            {
                _newOutport.ConstructorParameters = new object[] { obj };
                obj.NewOutport = (LinkLineNodeOutPort)_newOutport.Clone();
            }
            return(obj);
        }