コード例 #1
0
 public MutableModel GetReference(ModelId mid)
 {
     if (mid == null || !this.Green.References.ContainsKey(mid))
     {
         return(null);
     }
     return(this.GetExistingReference(mid));
 }
コード例 #2
0
 public MutableModel GetModel(ModelId mid)
 {
     if (mid == null || !this.Green.Models.ContainsKey(mid))
     {
         return(null);
     }
     return(this.GetExistingModel(mid));
 }
コード例 #3
0
 internal ImmutableModel(GreenModel green, MutableModel mutableModel)
 {
     this.id           = green.Id;
     this.group        = null;
     this.green        = green;
     this.readOnly     = false;
     this.objects      = new ConditionalWeakTable <ObjectId, ImmutableObject>();
     this.mutableModel = new WeakReference <MutableModel>(mutableModel);
 }
コード例 #4
0
 internal ImmutableModel(ModelId id, ImmutableModelGroup group, GreenModel green, bool readOnly, MutableModel mutableModel)
 {
     this.id           = id;
     this.group        = group;
     this.green        = green;
     this.readOnly     = readOnly;
     this.objects      = null;
     this.mutableModel = new WeakReference <MutableModel>(mutableModel);
 }
コード例 #5
0
ファイル: MutableModel.cs プロジェクト: Anjireddy4246/meta-cs
 internal MutableModel(GreenModel green, ImmutableModel immutableModel)
 {
     this.id             = green.Id;
     this.group          = null;
     this.green          = green;
     this.updater        = new ThreadLocal <GreenModelUpdater>();
     this.readOnly       = false;
     this.objects        = new ConditionalWeakTable <ObjectId, MutableObject>();
     this.immutableModel = new WeakReference <ImmutableModel>(immutableModel);
 }
コード例 #6
0
ファイル: MutableModel.cs プロジェクト: Anjireddy4246/meta-cs
 internal MutableModel(ModelId id, MutableModelGroup group, bool readOnly, ImmutableModel immutableModel)
 {
     this.id             = id;
     this.group          = group;
     this.green          = null;
     this.updater        = null;
     this.readOnly       = readOnly;
     this.objects        = null;
     this.immutableModel = new WeakReference <ImmutableModel>(immutableModel);
 }
コード例 #7
0
        private ImmutableModel GetImmutableReference(ModelId mid)
        {
            ImmutableModelGroup result;

            if (this.immutableModelGroup.TryGetTarget(out result) && result != null && result.Green == this.Green)
            {
                return(result.GetReference(mid));
            }
            return(null);
        }
コード例 #8
0
        private MutableModel GetMutableModel(ModelId mid)
        {
            MutableModelGroup result;

            if (this.mutableModelGroup.TryGetTarget(out result) && result != null && result.Green == this.Green)
            {
                return(result.GetModel(mid));
            }
            return(null);
        }
コード例 #9
0
        public MutableModel CreateModel(string name = null, ModelVersion version = default)
        {
            ModelId      mid   = new ModelId();
            MutableModel model = new MutableModel(mid, this, false, null);

            this.models.Add(mid, model);
            GreenModel greenModel;
            GreenModelUpdateContext ctx = null;

            try
            {
                do
                {
                    ctx        = this.BeginUpdate();
                    greenModel = ctx.Updater.CreateModel(mid, name, version);
                } while (!this.EndUpdate(ctx));
            }
            finally
            {
                this.FinalizeUpdate(ctx);
            }
            return(model);
        }
コード例 #10
0
 internal MutableObject GetExistingModelObject(ModelId mid, ObjectId oid)
 {
     return(this.objects.GetValue(oid, key => key.CreateMutable(this.GetExistingModel(mid), false)));
 }
コード例 #11
0
 private MutableModel GetExistingModel(ModelId mid)
 {
     return(this.models.GetValue(mid, key => new MutableModel(key, this, false, null)));
 }
コード例 #12
0
 private MutableModel GetExistingReference(ModelId mid)
 {
     return(this.models.GetValue(mid, key => new MutableModel(key, this, true, null)));
 }
コード例 #13
0
 private ImmutableModel GetExistingModel(ModelId mid)
 {
     return(this.models.GetValue(mid, key => new ImmutableModel(key, this, this.Green.Models.GetValueOrDefault(key), false, this.GetMutableReference(key))));
 }
コード例 #14
0
 internal ImmutableObjectBase GetExistingModelObject(ModelId mid, ObjectId sid)
 {
     return(this.objects.GetValue(sid, key => key.CreateImmutable(this.GetExistingModel(mid))));
 }