Ejemplo n.º 1
0
 void IncrGAnalysisListener.OnMatch(GAnlysInput _nextInput, AfterMatchListener _listener, AlternativeIncrGAnalyzer _alternative)
 {
     didMatch    = true;
     nextInput   = _nextInput;
     listener    = _listener;
     alternative = _alternative;
 }
Ejemplo n.º 2
0
        void IncrGAnalysisListener.OnMatch(GAnlysInput nextInput, AfterMatchListener afterListener, AlternativeIncrGAnalyzer alternative)
        {
            List <IndexedAfterMatchListener> updatedMatches = new List <IndexedAfterMatchListener>(previoudMatches);

            updatedMatches.Add(new IndexedAfterMatchListener(nextIndex - 1, afterListener));
            if (nextIndex < analyzers.Count)
            {
                var recordingListener = new RecordingIncrGAnalysListener {
                    baseListener = new ChainListenerOld {
                        analyzers = analyzers, nextIndex = nextIndex + 1, rootListener = rootListener, previoudMatches = updatedMatches, afterListenerFactory = afterListenerFactory
                    }
                };
                analyzers[nextIndex].Analyze(nextInput, recordingListener);
                if (!recordingListener.didMatch && alternative != null)
                {
                    updatedMatches.RemoveAt(updatedMatches.Count - 1);
                    AlternativeIncrGAnalyzer currentAlternative = alternative;
                    var altListener = new ChainListenerOld {
                        analyzers = analyzers, nextIndex = nextIndex, rootListener = rootListener, previoudMatches = updatedMatches, afterListenerFactory = afterListenerFactory
                    };
                    alternative.AnalyzeAgain(altListener);
                }
            }
            else
            {
                //rootListener.OnMatch(nextInput, new ClusterAfterListener { afterListeners = updatedMatches });
                rootListener.OnMatch(nextInput, afterListenerFactory(updatedMatches), alternative);
            }
        }
Ejemplo n.º 3
0
 void IncrGAnalysisListener.OnMatch(GAnlysInput nextInput, AfterMatchListener listener, AlternativeIncrGAnalyzer alternative)
 {
     didHit = true;
     if (alternative != null)
     {
         clientListner.OnMatch(nextInput, listener,
                               new UnitAltAnlys {
             parent = parent, nextIndex = nextAnalyzerIndex, subAltAnalyzer = alternative, originalInput = originalInput
         }
                               );
     }
     else
     {
         if (nextAnalyzerIndex < parent.candidates.Count)
         {
             clientListner.OnMatch(nextInput, listener, new UnitAltAnlys {
                 parent = parent, nextIndex = nextAnalyzerIndex, originalInput = originalInput
             });
         }
         else
         {
             clientListner.OnMatch(nextInput, listener);
         }
     }
 }
Ejemplo n.º 4
0
 public override AfterMatchListener ChangeAfterListener(AfterMatchListener sourceAfterListener)
 {
     //return ignore;
     return(new IgnoreAfterMatchListener {
         original = sourceAfterListener
     });
 }
Ejemplo n.º 5
0
 void IncrGAnalysisListener.OnMatch(GAnlysInput _nextInput, AfterMatchListener listener, AlternativeIncrGAnalyzer alternative)
 {
     if (alternative != null)
     {
         baseListener.OnMatch(_nextInput, parent.ChangeAfterListener(listener), new ResultAltIncrGAnalyzer {
             baseAltAnalyzer = alternative, parent = parent
         });
     }
     else
     {
         baseListener.OnMatch(_nextInput, parent.ChangeAfterListener(listener));
     }
 }
Ejemplo n.º 6
0
 void IncrGAnalysisListener.OnMatch(GAnlysInput nextInput, AfterMatchListener afterListener, AlternativeIncrGAnalyzer alternative)
 {
     results.Add(new IndexAndResult {
         index  = index,
         result = new EasyIncrGAnalysListener {
             alternative = alternative, didMatch = true, listener = afterListener, nextInput = nextInput
         }
     });
     //last analyzer
     if (index == analyzers.Count - 1)
     {
         didFinalMatch = true;
         finalListener.OnMatch(nextInput, afterListenerFactory(new List <IndexAndResult>(results)), new PrvtAltAnlys {
             results = new List <IndexAndResult>(results), afterListenerFactory = afterListenerFactory, analyzers = analyzers
         });
     }
     //go to next analyzer
     else
     {
         var nextLis = new ChainListener {
             afterListenerFactory = afterListenerFactory, analyzers = analyzers, finalListener = finalListener, index = index + 1, results = results
         };
         analyzers[index + 1].Analyze(nextInput, nextLis);
         didFinalMatch = nextLis.didFinalMatch;
         if (!nextLis.didFinalMatch)
         {
             bool hasAlternative = false;
             foreach (var result in results)
             {
                 if (result.result.alternative != null)
                 {
                     hasAlternative = true;
                     break;
                 }
             }
             if (hasAlternative)
             {
                 AlternativeIncrGAnalyzer alt = new PrvtAltAnlys {
                     afterListenerFactory = afterListenerFactory, analyzers = analyzers, results = new List <IndexAndResult>(results)
                 };
                 alt.AnalyzeAgain(finalListener);
             }
         }
     }
 }
Ejemplo n.º 7
0
 public IndexedAfterMatchListener(int _index, AfterMatchListener _afterListener)
 {
     index         = _index;
     afterListener = _afterListener;
 }
Ejemplo n.º 8
0
 void IncrGAnalysisListener.OnMatch(GAnlysInput result, AfterMatchListener listener, AlternativeIncrGAnalyzer alternative)
 {
     didMatch = true;
     baseListener.OnMatch(result, listener, alternative);
 }
Ejemplo n.º 9
0
 public override AfterMatchListener ChangeAfterListener(AfterMatchListener sourceAfterListener)
 {
     return(new ClusteringAfterMatchListener {
         baseAMatchLis = sourceAfterListener
     });
 }
Ejemplo n.º 10
0
 public override AfterMatchListener ChangeAfterListener(AfterMatchListener sourceAfterListener)
 {
     return(new AddMetaAMatchListener {
         baseListener = sourceAfterListener, parent = this
     });
 }
Ejemplo n.º 11
0
 public abstract AfterMatchListener ChangeAfterListener(AfterMatchListener sourceAfterListener);