com.java4less.ocr.docparser.sections
Class SectionDef

java.lang.Object
  extended by com.java4less.ocr.docparser.sections.SectionDef

public class SectionDef
extends java.lang.Object

Definition of a section in the document


Constructor Summary
SectionDef(java.lang.String name)
          constructor
 
Method Summary
 void addField(FieldDef def)
           
 void addTextMark(TextMarkDef def)
           
 FieldDef getField(int i)
          get field by index
 int getFieldCount()
          number of fields to be read
 ILengthType getLengthType()
           
 TextMarkDef getMark(int i)
          get mark by index
 int getMarkCount()
          number of marks/labels to find
 java.lang.String getName()
          name of the section
 IStartCondition getStartCondition()
          gets the condition used to know when this section starts
 boolean isMandatory()
          is the section mandatory (default is true).
 boolean isRepeatable()
          can the section be repeated?
 void load(org.w3c.dom.Node n)
          load from XML node
 void saveToXml(org.w3c.dom.Document document, org.w3c.dom.Node root)
           
 void saveToXml(org.w3c.dom.Document document, org.w3c.dom.Node root, java.lang.String nodeName)
          save to Xml
 void setLengthType(ILengthType lengthType)
          sets length of the section, if null, the length is variable and it finished when the next section starts
 void setMandatory(boolean f)
          is this section mandatory or optional? if a section is not mandatory, all sections after that now must also be optional
 void setName(java.lang.String name)
          name of the section
 void setRepeatable(boolean repeatable)
          repeatable sections must have fixed length and will be repeated until the next section starts.
 void setStartCondition(IStartCondition startCondition)
          set the condition used to know when this section starts.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SectionDef

public SectionDef(java.lang.String name)
constructor

Parameters:
name -
Method Detail

getStartCondition

public IStartCondition getStartCondition()
gets the condition used to know when this section starts

Returns:

setStartCondition

public void setStartCondition(IStartCondition startCondition)
set the condition used to know when this section starts. If null, the section will start when the previous section ends but only if the previous section has a fixed length

Parameters:
startCondition -

isRepeatable

public boolean isRepeatable()
can the section be repeated?

Returns:

isMandatory

public boolean isMandatory()
is the section mandatory (default is true).

Returns:

setRepeatable

public void setRepeatable(boolean repeatable)
repeatable sections must have fixed length and will be repeated until the next section starts. The section following a repeatable must therefore have a start condition

Parameters:
repeatable -

setMandatory

public void setMandatory(boolean f)
is this section mandatory or optional? if a section is not mandatory, all sections after that now must also be optional

Parameters:
f -

getLengthType

public ILengthType getLengthType()

setLengthType

public void setLengthType(ILengthType lengthType)
sets length of the section, if null, the length is variable and it finished when the next section starts

Parameters:
lengthType -

getName

public java.lang.String getName()
name of the section

Returns:

setName

public void setName(java.lang.String name)
name of the section

Parameters:
name -

getMarkCount

public int getMarkCount()
number of marks/labels to find

Returns:

getFieldCount

public int getFieldCount()
number of fields to be read

Returns:

getMark

public TextMarkDef getMark(int i)
get mark by index

Parameters:
i -
Returns:

getField

public FieldDef getField(int i)
get field by index

Parameters:
i -
Returns:

addTextMark

public void addTextMark(TextMarkDef def)

addField

public void addField(FieldDef def)

saveToXml

public void saveToXml(org.w3c.dom.Document document,
                      org.w3c.dom.Node root)
               throws java.lang.Exception
Throws:
java.lang.Exception

saveToXml

public void saveToXml(org.w3c.dom.Document document,
                      org.w3c.dom.Node root,
                      java.lang.String nodeName)
               throws java.lang.Exception
save to Xml

Parameters:
os -
Throws:
java.lang.Exception

load

public void load(org.w3c.dom.Node n)
load from XML node

Parameters:
n -