Ejemplo n.º 1
0
 public virtual IEnumerable <string> GetRelations(
     StorageObjectID source,
     StorageObjectID sink
     ) =>
 arrows_to_sink_inverse
 [source]
 .Lookup(sink);
Ejemplo 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
                    );
        }
Ejemplo 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);
        }
Ejemplo 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
                    );
        }
Ejemplo 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
                    );
        }
Ejemplo n.º 6
0
        protected override void Archive(StorageObjectID id)
        {
            SerializeNode(id);
            SerializeArrows(id);

            base.Archive(id);
        }
Ejemplo 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);
        }
Ejemplo n.º 8
0
        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
                    );
        }
Ejemplo 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);
        }
Ejemplo n.º 10
0
 public virtual string GetRelation(
     StorageObjectID source,
     StorageObjectID sink
     ) =>
 arrows_to_sink_inverse
 [source]
 .Lookup(sink)
 .Single();
Ejemplo n.º 11
0
 public T Load(
     StorageObjectID storageobjectID,
     EditorFile file
     ) =>
 loader(
     storageobjectID,
     file,
     this
     );
Ejemplo n.º 12
0
 public void Init(
     StorageObjectID storageobjectID,
     EditorFile file
     ) =>
 initer(
     storageobjectID,
     file,
     this
     );
Ejemplo n.º 13
0
        protected override void RemoveArrow(
            StorageObjectID source,
            StorageObjectID sink
            )
        {
            //SerializeArrows(source);

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

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

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

            base.AddArrow(source, sink, key);
        }
Ejemplo n.º 20
0
 public BoundObject(
     StorageObjectID storageobjectID,
     EditorFile file,
     IFactory <T> factory = null
     )
 {
     this.storageobjectID = storageobjectID;
     this.file            = file;
     this.factory         = factory;
 }
Ejemplo 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));
        }
Ejemplo n.º 22
0
            internal StorageObject(
                MemoryStorageGraph graph,
                StorageObjectID id
                )
            {
                this.graph = graph;
                this.id    = id;

                filedata          = new MemoryFile();
                filedata.Written += Filedata_Written;
            }
Ejemplo n.º 23
0
 public Screen(
     StorageObjectID storageobjectID,
     EditorFile file,
     IFactory <IScreen> factory = null
     ) :
     base(
         storageobjectID,
         file,
         factory
         )
 {
 }
Ejemplo 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));
                }
            }
        }
Ejemplo n.º 25
0
 public IOMessage(
     StorageObjectID subject,
     IOEvent verb
     )
     : this(
         subject,
         verb,
         default(string),
         default(string),
         default(StorageObjectID)
         )
 {
 }
Ejemplo 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()
     );
Ejemplo 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);
            }
        }
Ejemplo 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)
     );
Ejemplo n.º 29
0
 public BoundList(
     StorageObjectID storageobjectID,
     EditorFile file,
     BoundList <T> master
     ) :
     this(
         storageobjectID,
         file,
         master.factoryset,
         master.viewerset,
         master
         )
 {
 }
Ejemplo 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;
 }