public override object Clone()
        {
            AB_ForLoop obj = (AB_ForLoop)base.Clone();

            if (_count != null)
            {
                _count.SetCloneOwner(obj);
                obj._count = (ParameterValue)_count.Clone();
            }
            if (_iconList != null)
            {
                obj._iconList = new List <ComponentIcon>();
                foreach (ComponentIcon c in _iconList)
                {
                    obj._iconList.Add((ComponentIcon)c.Clone());
                }
            }
            return(obj);
        }
        protected override void OnEstablishObjectOwnership(IActionsHolder scope, List <UInt32> usedBranches)
        {
            base.OnEstablishObjectOwnership(scope, usedBranches);

            if (RepeatCount.MathExpression != null)
            {
                MathNodeRoot r = RepeatCount.MathExpression as MathNodeRoot;
                if (r != null)
                {
                    IList <ISourceValuePointer> l = r.GetValueSources();
                    if (l != null)
                    {
                        foreach (ISourceValuePointer sv in l)
                        {
                            sv.SetValueOwner(scope.OwnerMethod);
                        }
                    }
                }
            }
            if (_iconList != null)
            {
                foreach (ComponentIcon ci in _iconList)
                {
                    ci.EstablishObjectOwnership(scope.OwnerMethod);
                }
            }
            List <ComponentIcon> cis = ComponentIconList;

            foreach (ComponentIcon ci in cis)
            {
                ComponentIconActionBranchParameter ab = ci as ComponentIconActionBranchParameter;
                if (ab != null)
                {
                    if (ab.ClassPointer == null)
                    {
                        if (ab.MemberId == this.BranchId)
                        {
                            ab.ClassPointer  = RepeatIndex;
                            ab.DoNotSaveData = true;
                        }
                        else
                        {
                            ActionBranch ab0 = scope.FindActionBranchById(ab.MemberId);
                            if (ab0 == null)
                            {
                                throw new DesignerException("Action branch [{0}] not found", ab.MemberId);
                            }
                            else
                            {
                                AB_ForLoop abf = ab0 as AB_ForLoop;
                                if (abf != null)
                                {
                                    ab.ClassPointer  = abf.RepeatIndex;
                                    ab.DoNotSaveData = true;
                                }
                            }
                        }
                    }
                }
            }
        }