Copyright (C) 2003,2004 dr. Cristiano Sadun

org.sadun.text.ffp
Class AndCondition

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

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

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

Author:
Cristiano Sadun

Constructor Summary
AndCondition(FlatFileParser.Condition[] conditions)
          Create an AndCondition based on an array of conditions
AndCondition(FlatFileParser.Condition c1, FlatFileParser.Condition c2)
          Create an AndCondition 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 fails, the method returns false.
 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

AndCondition

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

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

AndCondition

public AndCondition(FlatFileParser.Condition[] conditions)
Create an AndCondition 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 fails, the method returns false.

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:
true if all 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