Exemplo n.º 1
0
        public GenSubClass GetSubClass(string subClassName)
        {
            if (ClassNameIs(subClassName))
            {
                var subClass = new GenSubClass(GenDataBase, Parent, ClassId, ParentSubClass.Definition);
                subClass.Add(this);
                return(subClass);
            }
            var subClassId = GenDataDef.GetClassId(subClassName);

            return(subClassId == -1 ? null : GetSubClass(subClassId));
        }
Exemplo n.º 2
0
        private GenSubClass GetSubClassByIndex(int subClassId, int idx, GenDataDefClass subClassDef)
        {
            var subClassRef = SubClass[idx] as SubClassReference;

            if (subClassRef != null)
            {
                if (String.IsNullOrEmpty(subClassRef.Reference))
                {
                    return(GenSubClass.Empty);
                }
                var d = GenDataBase.CheckReference(subClassRef.Definition.Reference, subClassRef.Reference);
                foreach (var o in d.Root.SubClass[0])
                {
                    o.RefParent = this;
                }
                return((GenSubClass)d.Root.SubClass[0]);
            }

            var subClass = (GenSubClass)SubClass[idx];

            if (subClass.ClassId == subClassId)
            {
                return(subClass);
            }

            var newSubClass = new GenSubClass(GenDataBase, Parent, subClassId, subClass.Definition);

            foreach (var o in subClass)
            {
                if (subClassDef.IsInheritor(o.ClassId))
                {
                    newSubClass.Add(o);
                }
            }
            return(newSubClass);
        }