Example #1
0
 /// <summary>
 /// Connect Edges pointing from current to current context, created from given labels
 /// </summary>
 /// <param name="labels">Labels which edges will be created</param>
 internal void AddSelfEdgesFrom(IEnumerable <ActiveLabel> labels)
 {
     foreach (var label in labels)
     {
         var edge = new ActiveEdge(label, this, this);
         IncommingEdges.Connect(edge);
     }
 }
Example #2
0
 private void SplitActiveEdge()
 {
     ActiveEdge = ActiveEdge.SplitAtIndex(ActiveEdge.StartIndex + DistanceIntoActiveEdge);
     SendMessage(" => ActiveEdge is now: {0}", ActiveEdge);
     TriggerChanged();
     if (LastCreatedNodeInCurrentIteration != null)
     {
         LastCreatedNodeInCurrentIteration.LinkedNode = ActiveEdge.Tail;
         SendMessage(" => Connected {0} to {1}", LastCreatedNodeInCurrentIteration, ActiveEdge.Tail);
         TriggerChanged();
     }
     LastCreatedNodeInCurrentIteration = ActiveEdge.Tail;
 }
Example #3
0
 private bool AreSame(long start, ref TKey key, ref TPayload payload, ref ActiveEdge active)
 {
     return(start == active.Start && this.keyComparer(key, active.Key) && this.payloadComparer(payload, active.Payload));
 }
Example #4
0
        private bool AddNextSuffix()
        {
            var suffix = string.Concat(Word.Substring(CurrentSuffixStartIndex, CurrentSuffixEndIndex - CurrentSuffixStartIndex), "{", Word[CurrentSuffixEndIndex], "}");

            SendMessage("The next suffix of '{0}' to add is '{1}' at indices {2},{3}", Word, suffix, CurrentSuffixStartIndex, CurrentSuffixEndIndex);
            SendMessage(" => ActiveNode:             {0}", ActiveNode);
            SendMessage(" => ActiveEdge:             {0}", ActiveEdge == null ? "none" : ActiveEdge.ToString());
            SendMessage(" => DistanceIntoActiveEdge: {0}", DistanceIntoActiveEdge);
            SendMessage(" => UnresolvedSuffixes:     {0}", UnresolvedSuffixes);
            if (ActiveEdge != null && DistanceIntoActiveEdge >= ActiveEdge.Length)
            {
                throw new Exception("BOUNDARY EXCEEDED");
            }

            if (ActiveEdge != null)
            {
                return(AddCurrentSuffixToActiveEdge());
            }

            if (GetExistingEdgeAndSetAsActive())
            {
                return(false);
            }

            ActiveNode.AddNewEdge();
            TriggerChanged();

            UpdateActivePointAfterAddingNewEdge();
            return(true);
        }
Example #5
0
        internal bool Connect(ActiveEdge edge)
        {
            var incomming = edge.EndContext.IncommingEdges;

            return(incomming.Connect(edge));
        }
Example #6
0
 private bool AreSame(long start, ref TKey key, ref TRight payload, ref ActiveEdge <TRight> active)
 => start == active.Start && this.keyComparerEquals(key, active.Key) && this.rightComparerEquals(payload, active.Payload);