org.sadun.util
Class LineSet

java.lang.Object
  extended byorg.sadun.util.LineSet
Direct Known Subclasses:
StackTraceLineSet

public class LineSet
extends java.lang.Object

An ordered set of Strings, to which filters can be applied

Author:
cris

Nested Class Summary
static class LineSet.BaseFilter
           
static class LineSet.ConstantFilter
          A constant filter, which always matches or not matches
static class LineSet.ContainsStringFilter
          A Filter which matches lines containing one or more substring.
static interface LineSet.Filter
          A Filter for matching certain lines in the set.
 
Field Summary
static LineSet.Filter NULL_FILTER
           
 
Constructor Summary
LineSet()
          Constructor for LineSet.
LineSet(java.lang.String[] lines)
          Constructor for LineSet.
 
Method Summary
 void add(java.lang.String line)
          Add a line to the set
 int count(LineSet.Filter filter)
          Count the lines matching the filter.
static LineSet create(java.lang.String text)
           
static LineSet create(java.lang.String text, java.lang.String lineSeparator)
           
 java.lang.String[] getLines(LineSet.Filter filter)
           
 java.util.List getLinesList(LineSet.Filter filter)
           
 java.lang.String toString()
           
 java.lang.String toString(LineSet.Filter filter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_FILTER

public static LineSet.Filter NULL_FILTER
Constructor Detail

LineSet

public LineSet()
Constructor for LineSet.


LineSet

public LineSet(java.lang.String[] lines)
Constructor for LineSet.

Method Detail

add

public void add(java.lang.String line)
Add a line to the set. * @param line


count

public int count(LineSet.Filter filter)
Count the lines matching the filter. A NULL_FILTER can be used. * @param filter the filter to match * @return int the number of lines matching the filter


getLinesList

public java.util.List getLinesList(LineSet.Filter filter)

getLines

public java.lang.String[] getLines(LineSet.Filter filter)

toString

public java.lang.String toString(LineSet.Filter filter)

toString

public java.lang.String toString()

create

public static LineSet create(java.lang.String text,
                             java.lang.String lineSeparator)

create

public static LineSet create(java.lang.String text)