예제 #1
0
 private void addToTarget(String s, PatternExpanderTarget target, TreeFlag flag)
 {
     // no, do we have a section after us?
     if (next != null)
     {
         // yes, give the next section this request
         next.expandAllToTarget(s, target, flag);
     }
     else
     {
         // no, tell the target to add this string.
         target.add(s, flag);
     }
 }
예제 #2
0
        private bool removeFromTarget(String s, PatternExpanderTarget target)
        {
            bool r = false;

            // no, do we have a section after us?
            if (next != null)
            {
                // yes, give the next section this request
                r |= next.expandAllToTargetRemove(s, target);
            }
            else
            {
                // no, tell the target to add this string.
                r |= target.remove(s);
            }
            return(r);
        }
예제 #3
0
 public void expandAllToTarget(String prefix, PatternExpanderTarget target,
                               TreeFlag flag)
 {
     // do we have any strings to contribute to the phrase?
     if (strings.Count > 0)
     {
         // yes, iterate through them
         LinkedList <String> .Enumerator s_it = strings.GetEnumerator();
         while (s_it.MoveNext())
         {
             // get the string but prefix it with prefix
             String v = prefix + s_it.Current;
             // add the resultant string to the target
             addToTarget(v, target, flag);
         }
     }
     else
     {
         addToTarget(prefix, target, flag);
     }
 }
예제 #4
0
        public bool expandAllToTargetRemove(String prefix, PatternExpanderTarget target)
        {
            bool r = false;

            // do we have any strings to contribute to the phrase?
            if (strings.Count > 0)
            {
                // yes, iterate through them
                LinkedList <String> .Enumerator s_it = strings.GetEnumerator();
                while (s_it.MoveNext())
                {
                    // get the string but prefix it with prefix
                    String v = prefix + s_it.Current;
                    // add the resultant string to the target
                    r |= removeFromTarget(v, target);
                }
            }
            else
            {
                r |= removeFromTarget(prefix, target);
            }
            return(r);
        }
예제 #5
0
 public PatternExpanderSimpleUrl(PatternExpanderTarget target) : base(target)
 {
 }
예제 #6
0
 public PatternExpanderPhrase(PatternExpanderTarget target) : base(target)
 {
     sections = new PatternExpanderPhraseSection();
 }
예제 #7
0
 public PatternExpanderUrl(PatternExpanderTarget target) : base(target)
 {
     ignorer = new IgnorerWhiteSpace();
     //common_prefix = "[,www.]";
     common_prefix = "";
 }
예제 #8
0
 public void setTarget(PatternExpanderTarget target)
 {
     this.target = target;
 }
예제 #9
0
 public PatternExpander(PatternExpanderTarget target)
 {
     this.target = target;
 }