org.sadun.util
Class LineSet.ContainsStringFilter

java.lang.Object
  extended byorg.sadun.util.LineSet.BaseFilter
      extended byorg.sadun.util.LineSet.ContainsStringFilter
All Implemented Interfaces:
LineSet.Filter
Enclosing class:
LineSet

public static final class LineSet.ContainsStringFilter
extends LineSet.BaseFilter
implements LineSet.Filter

A Filter which matches lines containing one or more substring.

Author:
cris

Constructor Summary
LineSet.ContainsStringFilter(java.lang.String toCheck)
          Create a filter checking for one given string being contained; when a matches occurs, the check continues.
LineSet.ContainsStringFilter(java.lang.String[] toCheck)
          Create a filter checking for one or more of the given strings being contained; when a matches occurs, the check continues.
LineSet.ContainsStringFilter(java.lang.String[] toCheck, boolean acceptIfYes, boolean toCut)
          Create a filter checking for one or more of the given strings being contained
LineSet.ContainsStringFilter(java.lang.String toCheck, boolean acceptIfYes, boolean toCut)
          Create a filter checking for one given string being contained.
 
Method Summary
 int getLastMatchIndex()
          Returns the last match index.
 boolean match(java.lang.String line, int index, java.util.Set info)
          Must return true if the given line (at the given position) is to be accepted
 void onMatch(java.util.Set info)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineSet.ContainsStringFilter

public LineSet.ContainsStringFilter(java.lang.String[] toCheck,
                                    boolean acceptIfYes,
                                    boolean toCut)
Create a filter checking for one or more of the given strings being contained. * @param toCheck the strings to be used for matching

Parameters:
toCut - indicates whether further lines should be checked

LineSet.ContainsStringFilter

public LineSet.ContainsStringFilter(java.lang.String[] toCheck)
Create a filter checking for one or more of the given strings being contained; when a matches occurs, the check continues.

Parameters:
toCheck - the strings to be used for matching

LineSet.ContainsStringFilter

public LineSet.ContainsStringFilter(java.lang.String toCheck,
                                    boolean acceptIfYes,
                                    boolean toCut)
Create a filter checking for one given string being contained.

Parameters:
toCheck - the string to be used for matching

LineSet.ContainsStringFilter

public LineSet.ContainsStringFilter(java.lang.String toCheck)
Create a filter checking for one given string being contained; when a matches occurs, the check continues.

Parameters:
toCheck - the string to be used for matching
Method Detail

match

public boolean match(java.lang.String line,
                     int index,
                     java.util.Set info)
Description copied from interface: LineSet.Filter
Must return true if the given line (at the given position) is to be accepted. * @param line the line to be checked * @param index the position of the line, from the top of the list

Specified by:
match in interface LineSet.Filter
Returns:
boolean true if the given line (at the given position) is to be accepted.
See Also:
LineSet.Filter.match(java.lang.String, int, java.util.Set)

getLastMatchIndex

public int getLastMatchIndex()
Returns the last match index.

Returns:
int the last match index, or -1

onMatch

public void onMatch(java.util.Set info)
Specified by:
onMatch in interface LineSet.Filter
Overrides:
onMatch in class LineSet.BaseFilter
See Also:
LineSet.Filter.onMatch(java.util.Set)