Copyright (C) 2003,2004 dr. Cristiano Sadun

org.sadun.text.ffp
Class OrCondition

java.lang.Object
  extended byorg.sadun.text.ffp.OrCondition
All Implemented Interfaces:
FlatFileParser.Condition

public class OrCondition
extends java.lang.Object
implements FlatFileParser.Condition

A FlatFileParser.Condition that holds if and only if one the conditions it groups hold.

Author:
Cristiano Sadun

Constructor Summary
OrCondition(FlatFileParser.Condition[] conditions)
          Create an OrCondition based on an array of conditions
OrCondition(FlatFileParser.Condition c1, FlatFileParser.Condition c2)
          Create an OrCondition based on two conditions
 
Method Summary
 boolean holds(int logicalLineCount, int physicalLineCount, FlatFileParser.LineReader reader)
          The conditions are evaluated in the same order given at construction and if one holds, the method returns true.
 java.lang.String toString()
          Return a human-readable description of the condition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OrCondition

public OrCondition(FlatFileParser.Condition c1,
                   FlatFileParser.Condition c2)
Create an OrCondition based on two conditions

Parameters:
c1 - the first condition
c2 - the second condition

OrCondition

public OrCondition(FlatFileParser.Condition[] conditions)
Create an OrCondition based on an array of conditions

Parameters:
conditions - the array of conditions.
Method Detail

holds

public boolean holds(int logicalLineCount,
                     int physicalLineCount,
                     FlatFileParser.LineReader reader)
              throws java.io.IOException
The conditions are evaluated in the same order given at construction and if one holds, the method returns true.

Specified by:
holds in interface FlatFileParser.Condition
Parameters:
logicalLineCount - the logical lines read so far
physicalLineCount - the physical lines read so far
reader - an object allowing to read lines on the file
Returns:
false if none of the conditions given at construction hold
Throws:
java.io.IOException - if a I/O problem arises when reading lines
See Also:
FlatFileParser.Condition.holds(int, int, org.sadun.text.ffp.FlatFileParser.LineReader)

toString

public java.lang.String toString()
Description copied from interface: FlatFileParser.Condition
Return a human-readable description of the condition.

Specified by:
toString in interface FlatFileParser.Condition

Copyright (C) 2003,2004 dr. Cristiano Sadun