示例#1
0
        internal ImmutableModelList <ImmutableObject> MGetMembers(ObjectId oid)
        {
            GreenList result = GreenList.EmptyUnique;

            foreach (var prop in this.MProperties(oid))
            {
                if (prop.CanResolve)
                {
                    if (prop.IsCollection)
                    {
                        var items = this.GetGreenValue(oid, prop) as GreenList;
                        if (items != null)
                        {
                            result = result.AddRange(items);
                        }
                    }
                    else
                    {
                        var item = this.GetGreenValue(oid, prop);
                        result = result.Add(item);
                    }
                }
            }
            return(ImmutableModelList <ImmutableObject> .FromGreenList(result, this, oid));
        }
示例#2
0
        internal ImmutableModelList <ImmutableObject> MGetBases(ObjectId oid)
        {
            GreenList result = this.CollectBases(oid);

            result = result.Remove(oid);
            return(ImmutableModelList <ImmutableObject> .FromGreenList(result, this, oid));
        }
示例#3
0
        internal ImmutableModelList <ImmutableObject> MGetAllBases(ObjectId oid)
        {
            GreenList result = GreenList.EmptyUnique;

            this.CollectAllBases(oid, ref result);
            result = result.Remove(oid);
            return(ImmutableModelList <ImmutableObject> .FromGreenList(result, this, oid));
        }
示例#4
0
        internal ImmutableModelList <ImmutableObject> MChildren(ObjectId oid)
        {
            GreenObject green;

            if (this.green.Objects.TryGetValue(oid, out green))
            {
                return(ImmutableModelList <ImmutableObject> .FromObjectIdList(green.Children, this));
            }
            return(ImmutableModelList <ImmutableObject> .Empty);
        }
        protected ImmutableModelList <T> GetList <T>(ModelProperty property, ref ImmutableModelList <T> value)
        {
            ImmutableModelList <T> result = value;

            if (result == null)
            {
                result = this.model.GetList <T>(this.id, property);
                result = Interlocked.CompareExchange(ref value, result, null) ?? result;
            }
            return(result);
        }
示例#6
0
        internal ImmutableModelList <MutableObject> MChildren(ObjectId oid)
        {
            ImmutableList <ObjectId> children = ImmutableList <ObjectId> .Empty;
            GreenModelUpdateContext  ctx      = null;

            try
            {
                do
                {
                    ctx      = this.BeginUpdate();
                    children = ctx.Updater.GetChildren(this.id, oid);
                } while (!this.EndUpdate(ctx));
            }
            finally
            {
                this.FinalizeUpdate(ctx);
            }
            return(ImmutableModelList <MutableObject> .FromObjectIdList(children, this));
        }
示例#7
0
        internal ImmutableModelList <T> GetList <T>(ObjectId oid, ModelProperty property)
        {
            Debug.Assert(property.IsCollection);
            var greenValue = this.GetGreenValue(oid, property);

            if (greenValue is GreenList)
            {
                return(ImmutableModelList <T> .FromGreenList((GreenList)greenValue, this, oid));
            }
            else
            {
                Slot slot = oid.Descriptor.GetSlot(property);
                if (!slot.IsCollection)
                {
                    return(ImmutableModelList <T> .FromGreenSingleValue(greenValue, this, oid));
                }
            }
            return(ImmutableModelList <T> .FromGreenList(property.IsUnique?GreenList.EmptyUnique : GreenList.EmptyNonUnique, this, oid));
        }