Esempio n. 1
0
 public virtual IEnumerable <string> GetRelations(
     StorageObjectID source,
     StorageObjectID sink
     ) =>
 arrows_to_sink_inverse
 [source]
 .Lookup(sink);
Esempio n. 2
0
        public PolylineContainer(
            StorageObjectID storageobjectID,
            EditorFile file,
            IFactory <IContainer> factory,

            FactorySet <PolylineData> polylines_factoryset,
            ViewerSet <PolylineData> polylines_viewerset
            ) :
            base(
                storageobjectID,
                file,
                factory,
                ItemName,
                ItemCodename
                )
        {
            var obj =
                file.Storage[storageobjectID];

            polylines =
                new BoundList <PolylineData>(
                    obj.GetOrMake("polylines").ID,
                    file,
                    polylines_factoryset,
                    polylines_viewerset
                    );
        }
Esempio n. 3
0
        protected virtual void RenameArrow(StorageObjectID source, StorageObjectID sink, string newkey)
        {
            var source_arrows_to_sink_inverse =
                arrows_to_sink_inverse[source].Lookup(sink);

            var sink_arrows_to_source_inverse =
                arrows_to_source_inverse[sink].Lookup(source);

            foreach (var oldkey in source_arrows_to_sink_inverse)
            {
                Messages.Add(new IOMessage(source, IOEvent.ChildRekeyed, oldkey, newkey, sink));

                EnumerableExtensions.RenameMerge <string, List <StorageObjectID>, StorageObjectID>(
                    arrows_to_sink[source],
                    oldkey,
                    newkey
                    );

                EnumerableExtensions.RenameMerge <string, List <StorageObjectID>, StorageObjectID>(
                    arrows_to_source[sink],
                    oldkey,
                    newkey
                    );
            }

            source_arrows_to_sink_inverse.Clear();
            source_arrows_to_sink_inverse.Add(newkey);
            sink_arrows_to_source_inverse.Clear();
            sink_arrows_to_source_inverse.Add(newkey);
        }
Esempio n. 4
0
        public ScreenContainer(
            StorageObjectID storageobjectID,
            EditorFile file,
            IFactory <IContainer> factory,
            FactorySet <IScreen> screens_factoryset,
            ViewerSet <IScreen> screens_viewerset
            ) :
            base(
                storageobjectID,
                file,
                factory,
                ItemName,
                ItemCodeName
                )
        {
            var obj =
                file.Storage[storageobjectID];

            screens =
                new BoundList <IScreen>(
                    obj.GetOrMake("screens").ID,
                    file,
                    screens_factoryset,
                    screens_viewerset
                    );
        }
Esempio n. 5
0
        public TrackController(
            StorageObjectID storageobjectID,
            EditorFile file,
            IFactory <ITrackController> factory = null
            ) :
            base(
                storageobjectID,
                file,
                factory
                )
        {
            var obj =
                file.Storage[storageobjectID];

            var container =
                file[TrackControllerContainer.ItemName] as TrackControllerContainer;

            pin =
                new Pin(
                    obj.GetOrMake("pin").ID,
                    file,
                    container.Settings.TimeMarkerUnit
                    );

            tracks =
                new BoundList <ITrack>(
                    obj.GetOrMake("tracks").ID,
                    file,
                    container.Tracks
                    );
        }
Esempio n. 6
0
        protected override void Archive(StorageObjectID id)
        {
            SerializeNode(id);
            SerializeArrows(id);

            base.Archive(id);
        }
Esempio n. 7
0
        public DurationFieldBinder(
            StorageObjectID storageobjectID,
            EditorFile file,
            DurationField <T> field
            ) :
            base(
                storageobjectID,
                file,
                null     //TODO
                )
        {
            this.field = field;

            obj = this.Object();

            field.ItemAdded   += Field_ItemAdded;
            field.ItemMoved   += Field_ItemMoved;
            field.ItemChanged += Field_ItemChanged;
            field.ItemRemoved += Field_ItemRemoved;

            listener_added       = obj.CreateListen(IOEvent.ChildAdded, Storage_ChildAdded);
            listener_rekeyed     = obj.Graph.CreateListen(Storage_ChildRekeyed, storageobjectID, IOEvent.ChildRekeyed);
            listener_contentsset = obj.CreateListen(IOEvent.ChildContentsSet, Storage_ChildContentsSet);
            listener_removed     = obj.CreateListen(IOEvent.ChildRemoved, Storage_ChildRemoved);
        }
        public FunctionContainer(
            StorageObjectID storageobjectID,
            EditorFile file,
            IFactory <IContainer> factory,

            FunctionCodeTools functioncodetools,

            FactorySet <FunctionSource> functionsources_factoryset,
            ViewerSet <FunctionSource> functionsources_viewerset
            ) :
            base(
                storageobjectID,
                file,
                factory,
                ItemName,
                ItemCodeName
                )
        {
            this.functioncodetools = functioncodetools;

            var obj =
                file.Storage[storageobjectID];

            functionsources =
                new BoundList <FunctionSource>(
                    obj.GetOrMake("function-sources").ID,
                    file,
                    functionsources_factoryset,
                    functionsources_viewerset
                    );
        }
Esempio n. 9
0
        public virtual StorageObjectID Create()
        {
            Guid internalID;

            do
            {
                internalID = Guid.NewGuid();
            }while (usedIDs.Contains(internalID));

            usedIDs.Add(internalID);

            var id  = new StorageObjectID(internalID);
            var obj = new StorageObject(this, id);

            storage.Add(id, obj);

            node_refcount.Add(id, 0);
            archivalstates.Add(id, ArchivalState.Unarchived);
            arrows_to_sink.Add(id, new Dictionary <string, List <StorageObjectID> >());
            arrows_to_source.Add(id, new Dictionary <string, List <StorageObjectID> >());
            arrows_to_sink_inverse.Add(id, new Dictionary <StorageObjectID, List <string> >());
            arrows_to_source_inverse.Add(id, new Dictionary <StorageObjectID, List <string> >());

            Messages.Add(new IOMessage(id, IOEvent.ObjectCreated));

            return(id);
        }
Esempio n. 10
0
 public virtual string GetRelation(
     StorageObjectID source,
     StorageObjectID sink
     ) =>
 arrows_to_sink_inverse
 [source]
 .Lookup(sink)
 .Single();
Esempio n. 11
0
 public T Load(
     StorageObjectID storageobjectID,
     EditorFile file
     ) =>
 loader(
     storageobjectID,
     file,
     this
     );
Esempio n. 12
0
 public void Init(
     StorageObjectID storageobjectID,
     EditorFile file
     ) =>
 initer(
     storageobjectID,
     file,
     this
     );
Esempio n. 13
0
        protected override void RemoveArrow(
            StorageObjectID source,
            StorageObjectID sink
            )
        {
            //SerializeArrows(source);

            base.RemoveArrow(source, sink);
        }
Esempio n. 14
0
 public ITrack Load(
     StorageObjectID storageobjectID,
     EditorFile file
     ) =>
 new MusicTrack(
     file,
     file.Storage[storageobjectID],
     (file[TrackControllerContainer.ItemName] as TrackControllerContainer).Settings
     );
Esempio n. 15
0
        protected override void RenameArrow(
            StorageObjectID source,
            StorageObjectID sink,
            string newkey
            )
        {
            //SerializeArrows(source);

            base.RenameArrow(source, sink, newkey);
        }
Esempio n. 16
0
 public PolylineData(
     StorageObjectID storageobjectID,
     EditorFile file
     )
     : this(
         file.Storage[storageobjectID],
         file
         )
 {
 }
Esempio n. 17
0
        private void Storage_ChildRemoved(string key, StorageObjectID child)
        {
            var duration =
                CodeTools.ReadDuration(key);

            if (field.HasItem(duration))
            {
                field.RemoveUnique(duration);
            }
        }
Esempio n. 18
0
 public static DurationFieldBinder <T> Bind <T>(
     this DurationField <T> field,
     StorageObjectID storageobjectID,
     EditorFile file
     ) =>
 new DurationFieldBinder <T>(
     storageobjectID,
     file,
     field
     );
Esempio n. 19
0
        protected override void AddArrow(
            StorageObjectID source,
            StorageObjectID sink,
            string key
            )
        {
            //SerializeArrows(source);

            base.AddArrow(source, sink, key);
        }
Esempio n. 20
0
 public BoundObject(
     StorageObjectID storageobjectID,
     EditorFile file,
     IFactory <T> factory = null
     )
 {
     this.storageobjectID = storageobjectID;
     this.file            = file;
     this.factory         = factory;
 }
Esempio n. 21
0
        protected virtual void AddArrow(StorageObjectID source, StorageObjectID sink, string key)
        {
            node_refcount[sink]++;

            arrows_to_sink[source].Lookup(key).Add(sink);
            arrows_to_source[sink].Lookup(key).Add(source);
            arrows_to_sink_inverse[source].Lookup(sink).Add(key);
            arrows_to_source_inverse[source].Lookup(source).Add(key);

            Messages.Add(new IOMessage(source, IOEvent.ChildAdded, key, sink));
        }
            internal StorageObject(
                MemoryStorageGraph graph,
                StorageObjectID id
                )
            {
                this.graph = graph;
                this.id    = id;

                filedata          = new MemoryFile();
                filedata.Written += Filedata_Written;
            }
Esempio n. 23
0
 public Screen(
     StorageObjectID storageobjectID,
     EditorFile file,
     IFactory <IScreen> factory = null
     ) :
     base(
         storageobjectID,
         file,
         factory
         )
 {
 }
Esempio n. 24
0
        protected virtual void SetContents(StorageObjectID id)
        {
            Messages.Add(new IOMessage(id, IOEvent.ObjectContentsSet));

            foreach (var source_map in arrows_to_source[id])
            {
                foreach (var source in source_map.Value)
                {
                    Messages.Add(new IOMessage(source, IOEvent.ChildContentsSet, source_map.Key, id));
                }
            }
        }
Esempio n. 25
0
 public IOMessage(
     StorageObjectID subject,
     IOEvent verb
     )
     : this(
         subject,
         verb,
         default(string),
         default(string),
         default(StorageObjectID)
         )
 {
 }
Esempio n. 26
0
 public static IOListener CreateListen_Node(
     this IStorageGraph graph,
     StorageObjectID subject,
     IOEvent verb,
     Action responder
     ) =>
 CreateListen_Node(
     graph,
     subject,
     verb,
     (key, @object) =>
     responder()
     );
Esempio n. 27
0
        private void Storage_ChildContentsSet(string key, StorageObjectID child)
        {
            var duration =
                CodeTools.ReadDuration(key);

            var contents =
                Deserializer(File.Storage[child]);

            if (field.HasItem(duration))
            {
                field.UpdateUnique(duration, contents);
            }
        }
Esempio n. 28
0
 public static IOListener CreateListen_Node(
     this IStorageGraph graph,
     StorageObjectID subject,
     IOEvent verb,
     Action <string, StorageObjectID> childresponder
     ) =>
 new IOListener(
     new IOMessage(
         subject,
         verb
         ),
     message =>
     childresponder(message.Relation, message.Object)
     );
Esempio n. 29
0
 public BoundList(
     StorageObjectID storageobjectID,
     EditorFile file,
     BoundList <T> master
     ) :
     this(
         storageobjectID,
         file,
         master.factoryset,
         master.viewerset,
         master
         )
 {
 }
Esempio n. 30
0
 public IOMessage(
     StorageObjectID subject,
     IOEvent verb,
     string relation,
     string newrelation,
     StorageObjectID @object
     )
 {
     Subject     = subject;
     Verb        = verb;
     Relation    = relation;
     NewRelation = newrelation;
     Object      = @object;
 }