public void AddChild(FmlNode l)
 {
     if (l == null)
     {
         return;
     }
     if (ChildList.Count > ChildCount)
     {
         for (int i = 0, imax = ChildList.Count; i < imax; ++i)
         {
             if (ChildList[i] == null)
             {
                 ChildList[i] = l;
                 break;
             }
         }
     }
     else
     {
         ChildList.Add(l);
     }
     l.AddBranch(this);
     ++ChildCount;
     SetDirty();
 }
 public void AddChild(StudyXmlNode child)
 {
     if (ChildList == null)
     {
         ChildList = new List <StudyXmlNode>();
     }
     ChildList.Add(child);
 }
Exemple #3
0
        public FlexNodeReport Add(SectionTemplate row)
        {
            var flexNode = row.blnGrid
                                    ? new FlexNodeReport(this, new FlexTableItem(row))
                                    : new FlexNodeReport(this, new FlexLabelItem(row));

            ChildList.Add(flexNode);
            return(flexNode);
        }
Exemple #4
0
 // arity 必須大於 0
 protected FmlArityOp(BaseValueType t, int arity)
     : base(t, arity)
 {
     // initial _childList
     for (int i = 0, imax = arity; i < imax; ++i)
     {
         ChildList.Add(null);
     }
     ChildCount = arity;
 }
Exemple #5
0
        /// <summary>
        /// Will update the child to reflect it being a child of this element, but will not yet add the child at any position within this element
        /// </summary>
        private void importChild(IStructureDefinitionSummaryProvider provider, ElementNode child, string name, int?position = null)
        {
            child.Name = name ?? child.Name;
            if (child.Name == null)
            {
                throw Error.Argument($"The ElementNode given should have its Name property set or the '{nameof(name)}' parameter should be given.");
            }

            // Remove this child from the current parent (if any), then reassign to me
            if (child.Parent != null)
            {
                Parent.Remove(child);
            }
            child.Parent = this;

            // If we add a child, we better overwrite it's definition with what
            // we think it should be - this way you can safely first create a node representing
            // an independently created root for a resource of datatype, and then add it to the tree.
            var childDefs = getChildDefinitions(provider ?? throw Error.ArgumentNull(nameof(provider)));
            var childDef  = childDefs.Where(cd => cd.ElementName == child.Name).SingleOrDefault();

            child.Definition = childDef ?? child.Definition;    // if we don't know about the definition, stick with the old one (if any)

            if (child.InstanceType == null && child.Definition != null)
            {
                if (child.Definition.IsResource || child.Definition.Type.Length > 1)
                {
                    // [EK20190822] This functionality has been removed since it heavily depends on knowledge about
                    // FHIR types, it would automatically try to derive a *FHIR* type from the given child.Value,
                    // however, this would not work correctly if the model used is something else than FHIR,
                    // so this cannot be expected to work correctly in general, and I have chosen to remove
                    // this.
                    //// We are in a situation where we are on an polymorphic element, but the caller did not specify
                    //// the instance type.  We can try to auto-set it by deriving it from the instance's type, if it is a primitive
                    //if (child.Value != null && IsSupportedValue(child.Value))
                    //    child.InstanceType = TypeSpecifier.ForNativeType(child.Value.GetType()).Name;
                    //else
                    throw Error.Argument("The ElementNode given should have its InstanceType property set, since the element is a choice or resource.");
                }
                else
                {
                    child.InstanceType = child.Definition.Type.Single().GetTypeName();
                }
            }

            if (position == null || position >= ChildList.Count)
            {
                ChildList.Add(child);
            }
            else
            {
                ChildList.Insert(position.Value, child);
            }
        }
Exemple #6
0
        /// <summary>
        /// Will update the child to reflect it being a child of this element, but will not yet add the child at any position within this element
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="child"></param>
        /// <param name="name"></param>
        /// <param name="position"></param>
        private void importChild(IStructureDefinitionSummaryProvider provider, ElementNode child, string name, int?position = null)
        {
            child.Name = name ?? child.Name;
            if (child.Name == null)
            {
                throw Error.Argument($"The ElementNode given should have its Name property set or the '{nameof(name)}' parameter should be given.");
            }

            // Remove this child from the current parent (if any), then reassign to me
            if (child.Parent != null)
            {
                Parent.Remove(child);
            }
            child.Parent = this;

            // If we add a child, we better overwrite it's definition with what
            // we think it should be - this way you can safely first create a node representing
            // an independently created root for a resource of datatype, and then add it to the tree.
            var childDefs = getChildDefinitions(provider ?? throw Error.ArgumentNull(nameof(provider)));
            var childDef  = childDefs.Where(cd => cd.ElementName == child.Name).SingleOrDefault();

            child.Definition = childDef ?? child.Definition;    // if we don't know about the definition, stick with the old one (if any)

            if (child.InstanceType == null && child.Definition != null)
            {
                if (child.Definition.IsResource || child.Definition.Type.Length > 1)
                {
                    // We are in a situation where we are on an polymorphic element, but the caller did not specify
                    // the instance type.  We can try to auto-set it by deriving it from the instance's type, if it is a primitive
                    if (child.Value != null && Primitives.TryGetPrimitiveTypeName(child.Value.GetType(), out string instanceType))
                    {
                        child.InstanceType = instanceType;
                    }
                    else
                    {
                        throw Error.Argument("The ElementNode given should have its InstanceType property set, since the element is a choice or resource.");
                    }
                }
                else
                {
                    child.InstanceType = child.Definition.Type.Single().GetTypeName();
                }
            }

            if (position == null || position >= ChildList.Count)
            {
                ChildList.Add(child);
            }
            else
            {
                ChildList.Insert(position.Value, child);
            }
        }
Exemple #7
0
        public void AddChild(YmapEntityDef c)
        {
            if (ChildList == null)
            {
                ChildList = new List <YmapEntityDef>();
            }
            c.Parent     = this;
            c.ParentGuid = CEntityDef.guid;
            c.ParentName = CEntityDef.archetypeName;

            ChildList.Add(c);
        }
Exemple #8
0
        //TODO сделать добавление для лейблов и линий(?)

        //public void Add(FlexibleFormsDS.LinesRow row)
        //{
        //    FlexLineItem item = new FlexLineItem(row);
        //    mChildList.Add(new FlexNode(this, item));
        //}

        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="row"></param>
        //public void Add(FlexibleFormsDS.LabelsRow row)
        //{
        //    FlexLabelItem item = new FlexLabelItem(row);
        //    mChildList.Add(new FlexNode(this, item));
        //}

        /// <summary>
        ///
        /// </summary>
        /// <param name="ffObject"></param>
        /// <param name="activityParameters"></param>
        /// <param name="index">Индекс для вставки</param>
        /// <param name="model"></param>
        public FlexNode Add(object ffObject, EditableList <ActivityParameter> activityParameters, int index, FFPresenterModel model)
        {
            var flexNode = new FlexNode(this, new FlexItem(ffObject), activityParameters, model);

            if (index == -1)
            {
                ChildList.Add(flexNode);
            }
            else
            {
                ChildList.Insert(0, flexNode);
            }
            return(flexNode);
        }
Exemple #9
0
        /// <summary>
        /// Добавляет лейбл с простым текстовым полем
        /// </summary>
        /// <param name="caption"></param>
        public FlexNodeReport Add(string caption)
        {
            var labelItem = new FlexLabelItem(caption, new Size(50, 50));
            var result    = new FlexNodeReport(this, labelItem);
            //выставляем размеры и положение для контейнера дин. параметров
            //отыщем среди них самый нижний (вложенные не учитываем)
            int top;
            int height;

            GetCorrectSize(ChildList, out top, out height);
            labelItem.Top = top + height;

            ChildList.Add(result);
            return(result);
        }
Exemple #10
0
        public FlexNodeReport Add(ParametersDeletedFromTemplate rowParameter, bool isParameterInSection)
        {
            var rowParameterItem = new FlexLabelItem(rowParameter, isParameterInSection);
            //пересчитываем правильно его координаты
            //отыщем среди них самый нижний (вложенные не учитываем)
            int top;
            int height;

            GetCorrectSize(ChildList, out top, out height);
            rowParameterItem.Top = top + height + 10;
            var result = new FlexNodeReport(this, rowParameterItem);

            ChildList.Add(result);
            return(result);
        }
Exemple #11
0
        public void Add
            (ParametersDeletedFromTemplate rowParameter,
            ActivityParameter activityParametersRow, out Size size)
        {
            var node = Add(rowParameter, false);

            var parametersItem = new FlexLabelItem(rowParameter, activityParametersRow)
            {
                IsParameterValue = true,
                Top = node.DataItem.Top
            };
            var nodeAp = new FlexNodeReport(this, parametersItem);

            ChildList.Add(nodeAp);
            //нод, который отвечает за контрол, выводится с фиксированной высотой
            nodeAp.DataItem.Height = DefaultControlHeight;
            size = new Size(rowParameter.intWidth, rowParameter.intHeight);
        }
Exemple #12
0
        public void Add
            (ParameterTemplate parameterTemplateRow,
            ActivityParameter activityParametersRow)
        {
            Add(parameterTemplateRow, false);

            var parametersItem = new FlexLabelItem(parameterTemplateRow, activityParametersRow)
            {
                IsParameterValue = true
            };
            var nodeAp = new FlexNodeReport(this, parametersItem);

            //нод, который отвечает за контрол, выводится с фиксированной высотой
            nodeAp.DataItem.Height = DefaultControlHeight;
            if (nodeAp.DataItem.Height > parametersItem.Height)
            {
                nodeAp.DataItem.Height = parametersItem.Height;
            }
            ChildList.Add(nodeAp);
        }
 /// <summary>
 /// Add child node, throw exception if failed
 /// </summary>
 public void AddChildNode(ITreeNode <T> node)
 {
     if (node == null)
     {
         throw new ArgumentNullException("node can't be null");
     }
     else if (this == node)
     {
         throw new ArgumentException("can't add node to itself");
     }
     else if (this.GetParents().Contains(node))
     {
         throw new ArgumentException("can't add node to it's child");
     }
     else if (node.Parent != null)
     {
         throw new ArgumentException("node already has a parent");
     }
     ChildList.Add(node);
     node.Parent = this;
 }
Exemple #14
0
            /// <summary>
            /// Add child node, throw exception if failed<br/>
            /// 添加子节点, 失败时抛出例外<br/>
            /// </summary>
            public void AddChildNode(ITreeNode <T> node)
            {
                if (node == null)
                {
#pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
                    throw new ArgumentNullException("node can't be null");
#pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one
                }
                else if (this == node)
                {
                    throw new ArgumentException("can't add node to itself");
                }
                else if (this.GetParents().Contains(node))
                {
                    throw new ArgumentException("can't add node to it's child");
                }
                else if (node.Parent != null)
                {
                    throw new ArgumentException("node already has a parent");
                }
                ChildList.Add(node);
                node.Parent = this;
            }
Exemple #15
0
 public void AddChild(RigidNode child)
 {
     ChildList.Add(child);
     child.DepthLevel = DepthLevel + 1;
 }
Exemple #16
0
        public void Add(Label row)
        {
            var item = new FlexLabelItem(row);

            ChildList.Add(new FlexNodeBase(this, item));
        }
Exemple #17
0
    public static int Test()
    {
        Z z = new Z();
        X x = (X)z;
        Y y = (Y)z;

        Console.WriteLine(z [1]);
        Console.WriteLine(y [2]);
        Console.WriteLine(x [3]);

        if (z [1] != 4)
        {
            return(1);
        }
        if (y [1] != 2)
        {
            return(2);
        }
        if (x [1] != 1)
        {
            return(3);
        }

        double index = 5;

        Console.WriteLine(z [index]);
        Console.WriteLine(y [index]);

        if (z [index] != 4)
        {
            return(4);
        }
        if (y [index] != 3)
        {
            return(5);
        }

        int retval = z.InstanceTest();

        if (retval != 0)
        {
            return(retval);
        }

        B b = new B();

        if (b [4] != 16)
        {
            return(8);
        }
        if (b [3, 5] != 15)
        {
            return(9);
        }

        D d = new D();

        if (d [4] != 16)
        {
            return(10);
        }
        if (d [3, 5] != 15)
        {
            return(11);
        }

        //
        // Now test for bug 35492
        //
        ChildList xd = new ChildList();

        xd.Add(0);
        if (0 != (int)xd [0])
        {
            return(12);
        }

        xd.Test();
        if (1 != (int)xd [0])
        {
            return(13);
        }

        return(0);
    }
 public override void AddChild(DMCompent _compent)
 {
     ChildList.Add(_compent);
 }
Exemple #19
0
 private void AddChild(BaseGameObject baseGameObject)
 {
     ChildList.Add(baseGameObject);
 }
Exemple #20
0
        public void Add(ParameterTemplate parameterTemplateRow, bool isParameterInSection)
        {
            var parameterTemplateItem = new FlexLabelItem(parameterTemplateRow, isParameterInSection);

            ChildList.Add(new FlexNodeReport(this, parameterTemplateItem));
        }
Exemple #21
0
	public static int Test ()
	{
		Z z = new Z ();
		X x = (X) z;
		Y y = (Y) z;

		Console.WriteLine (z [1]);
		Console.WriteLine (y [2]);
		Console.WriteLine (x [3]);

		if (z [1] != 4)
			return 1;
		if (y [1] != 2)
			return 2;
		if (x [1] != 1)
			return 3;

		double index = 5;

		Console.WriteLine (z [index]);
		Console.WriteLine (y [index]);

		if (z [index] != 4)
			return 4;
		if (y [index] != 3)
			return 5;

		int retval = z.InstanceTest ();
		if (retval != 0)
			return retval;

		B b = new B ();
		if (b [4] != 16)
			return 8;
		if (b [3,5] != 15)
			return 9;

		D d = new D ();
		if (d [4] != 16)
			return 10;
		if (d [3,5] != 15)
			return 11;

		//
		// Now test for bug 35492
		//
		ChildList xd = new ChildList ();

		xd.Add (0);
		if (0 != (int)xd [0])
			return 12;
		
		xd.Test ();
		if (1 != (int) xd [0])
			return 13;
		
		return 0;
	}
Exemple #22
0
 public void AddChild(SpriteNode child)
 {
     child.ParentSprite = this;
     child.Index        = ChildList.Count + 1;
     ChildList.Add(child);
 }