Exemple #1
0
        protected TypeLink(FuzzyMetadata first, FuzzyMetadata second)
        {
            First = first;
            AssociateMetadataAndLink(first, this);

            Second = second;
            AssociateMetadataAndLink(second, this);

            Engine.RegisterLink(this);
        }
Exemple #2
0
 public void Sync(FuzzyMetadata sender)
 {
     if (sender != First && sender != Second)
     {
         throw new ArgumentException("I don't care about alien type points");
     }
     else
     {
         Sync(sender, sender == First ? Second : First);
     }
 }
Exemple #3
0
        private void AssociateMetadataAndLink(FuzzyMetadata metadata, TypeLink link)
        {
            link.RegDebuggableParent(metadata);

            var links = new List<TypeLink>(metadata.Links);
            links.Add(link);
            metadata.Links = links.AsReadOnly();

            metadata.SomeMoreStuffInferred += (o, e) => Engine.ScheduleSync(this, (FuzzyMetadata)o);
            metadata.ContradictionReported += (o, e) => ReportContradiction(String.Format(
                "'{0}' reports: '{1}'", o, e.WhatHappened));
        }
        protected override void Sync(FuzzyMetadata sender, FuzzyMetadata recipient)
        {
            if (sender == _first)
            {
                base.Sync(sender, recipient);
            }
            else
            {
                // if the alternative isn't the only one for this binding, 
                // then it has no right to propagate changes to binding typepoints
                //
                // kek... at the very start of TIEN v2 I've classified links to simplex and duplex
                // then I just made links to be innately duplex since there wasn't need in simplex ones
                // however, current case proves the contrary

                if (Polarity != TypeLinkPolarity.Right)
                {
                    base.Sync(sender, recipient);
                }
            }
        }
Exemple #5
0
 protected abstract void Sync(FuzzyMetadata sender, FuzzyMetadata recipient);
        public void Dispose(FuzzyMetadata fuzzy)
        {
            // bug: rewrite this ffs!
#if DEBUG
            foreach (var fuzzyChild in fuzzy.DebuggableChildren.OfType<FuzzyMetadata>())
            {
                Dispose(fuzzyChild);
            }
#else
            cba to rewrite this now, so you'll have to do it when you try to compile
            this craptastic stuff in release mode. I'm sorry tbh, but I have no time
#endif

            foreach (var link in _links.ToArray())
            {
                if (link.First == fuzzy || link.Second == fuzzy)
                {
                    UnregisterLink(link);
                }
            }

            fuzzy.DisposeDebuggableObject();
        }
 public Sync(TypeLink link, FuzzyMetadata sender)
 {
     Link = link;
     Sender = sender;
 }
 public void ScheduleSync(TypeLink link, FuzzyMetadata sender)
 {
     if (_syncsAllowed)
     {
         _queue.Enqueue(new Sync(link, sender));
     }
 }