org.writersforge.catalan.process.workers.partition
Class Partition

java.lang.Object
  extended byorg.writersforge.catalan.process.workers.partition.Partition

public class Partition
extends java.lang.Object

Parsing definition for this partition.

Author:
jsheets

Constructor Summary
Partition(java.lang.String type, java.lang.String startPattern, java.lang.String endPattern)
          Creates a new instance of Partition which matches a fragment of text bounded by the start and end patterns.
Partition(java.lang.String type, java.lang.String startPattern, java.lang.String endPattern, org.writersforge.bellows.Datum[] xmlWorkers)
          Creates a new instance of Partition which matches a fragment of text bounded by the start and end patterns.
 
Method Summary
 int calculatePartitionLength(java.lang.String text)
          Finds the length of this partition.
 java.lang.String getEnd()
          Retrieves the ending pattern for this parition.
 java.lang.String getStart()
          Retrieves the starting pattern for this parition.
 java.lang.String getType()
          Retrieves the type name of this parition.
 org.writersforge.bellows.Datum[] getWorkers()
          Retrieves embedded XML workers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Partition

public Partition(java.lang.String type,
                 java.lang.String startPattern,
                 java.lang.String endPattern)
          throws java.lang.IllegalArgumentException
Creates a new instance of Partition which matches a fragment of text bounded by the start and end patterns.

Parameters:
type - partition type name
startPattern - regular expression start of partition text
endPattern - regular expression end of partition text
Throws:
java.lang.IllegalArgumentException - if any parameters are null or empty

Partition

public Partition(java.lang.String type,
                 java.lang.String startPattern,
                 java.lang.String endPattern,
                 org.writersforge.bellows.Datum[] xmlWorkers)
          throws java.lang.IllegalArgumentException
Creates a new instance of Partition which matches a fragment of text bounded by the start and end patterns.

Parameters:
type - partition type name
startPattern - regular expression start of partition text
endPattern - regular expression end of partition text
xmlWorkers - optional XML workers to run
Throws:
java.lang.IllegalArgumentException - if any parameters are null or empty
Method Detail

getType

public final java.lang.String getType()
Retrieves the type name of this parition.

Returns:
partition type

getStart

public final java.lang.String getStart()
Retrieves the starting pattern for this parition.

Returns:
partition type

getEnd

public final java.lang.String getEnd()
Retrieves the ending pattern for this parition.

Returns:
partition type

getWorkers

public final org.writersforge.bellows.Datum[] getWorkers()
Retrieves embedded XML workers.

Returns:
embedded XML workers

calculatePartitionLength

public int calculatePartitionLength(java.lang.String text)
Finds the length of this partition. If the text does not match both the starting and ending expressions, the returned length will be zero.

Parameters:
text - text content to analyze
Returns:
the length of the partition, or zero if not a match