unitloader
Class QBool

java.lang.Object
  |
  +--unitloader.QBool

public class QBool
extends java.lang.Object

Title: the QBool class representing booelan operations.

Description: Class to represent boolean queries. Uses Comp and QBool objects to construct complex queries recursively.

Version:
0.7, February 2003
Author:
Anton Güntsch, Botanic Garden and Botanical Museum Berlin-Dahlem
See Also:
Comp

Field Summary
private  java.lang.Object first
           
private  java.lang.String op
           
private  java.lang.Object second
           
 
Constructor Summary
QBool(java.lang.String op, Comp arg)
          Overloaded constructor for the one and only usefull unary boolean operator (not).
QBool(java.lang.String op, Comp first, Comp second)
          Overloaded constructor for binary boolean operators (or, and, nor, nand).
QBool(java.lang.String op, Comp first, QBool second)
          Overloaded constructor for binary boolean operators (or, and, nor, nand).
QBool(java.lang.String op, QBool arg)
          Overloaded constructor for unary boolean operators (not).
QBool(java.lang.String op, QBool first, Comp second)
          Overloaded constructor for binary boolean operators (or, and, nor, nand).
QBool(java.lang.String op, QBool first, QBool second)
          Overloaded constructor for binary boolean operators (or, and, nor, nand).
QBool(java.lang.String compOp, java.lang.String elem, java.util.List valList)
          Overloaded constructor for nested QBools containing multiple comparisons with the same concept and comparison operator.
 
Method Summary
 java.lang.Object getFirst()
          Returns the first operand of this object.
 java.lang.String getOp()
          Returns the name of the boolean operation represented with this object.
 java.lang.Object getSecond()
          Returns the second operand of this object.
 boolean isQBool(int firstOrSecond)
          Check whether the given child (argument) specified with the parameter of this method is a boolean operation.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

op

private java.lang.String op

first

private java.lang.Object first

second

private java.lang.Object second
Constructor Detail

QBool

public QBool(java.lang.String op,
             QBool first,
             QBool second)
Overloaded constructor for binary boolean operators (or, and, nor, nand).
Parameters:
op - boolean operation as a string (currently "and", "or" "nand", and "nor" implemented).
first - first argument (boolean query).
second - second argument (boolean query).
Throws:
java.lang.IllegalArgumentException - if wrong parameter is passed.

QBool

public QBool(java.lang.String op,
             QBool first,
             Comp second)
Overloaded constructor for binary boolean operators (or, and, nor, nand).
Parameters:
op - boolean operation as a string.
first - first argument (boolean query).
second - second argument (Comp object).
Throws:
java.lang.IllegalArgumentException - if wrong parameter is passed.

QBool

public QBool(java.lang.String op,
             Comp first,
             QBool second)
Overloaded constructor for binary boolean operators (or, and, nor, nand).
Parameters:
op - boolean operation as a string.
first - first argument (Comp object).
second - second argument (boolean query).
Throws:
java.lang.IllegalArgumentException - if wrong parameter is passed.

QBool

public QBool(java.lang.String op,
             Comp first,
             Comp second)
Overloaded constructor for binary boolean operators (or, and, nor, nand).
Parameters:
op - boolean operation as a string.
first - first argument (Comp object).
second - second argument (Comp object).
Throws:
java.lang.IllegalArgumentException - if wrong parameter is passed.

QBool

public QBool(java.lang.String op,
             QBool arg)
Overloaded constructor for unary boolean operators (not).
Parameters:
op - boolean operation as a string (only "not" implemented).
arg - argument (boolean query).
Throws:
java.lang.IllegalArgumentException - if wrong parameter is passed.

QBool

public QBool(java.lang.String op,
             Comp arg)
Overloaded constructor for the one and only usefull unary boolean operator (not).
Parameters:
op - boolean operation as a string (only "not" implemented).
arg - argument (Comp object).
Throws:
java.lang.IllegalArgumentException - if wrong parameter is passed.

QBool

public QBool(java.lang.String compOp,
             java.lang.String elem,
             java.util.List valList)
Overloaded constructor for nested QBools containing multiple comparisons with the same concept and comparison operator.
Parameters:
compOp - comparison operation as a string.
elem - argument as a String.
valList - argument (List object).
Throws:
java.lang.IllegalArgumentException - if wrong parameter is passed.
Method Detail

isQBool

public boolean isQBool(int firstOrSecond)
Check whether the given child (argument) specified with the parameter of this method is a boolean operation.
Parameters:
firstOrSecond - specifies which child is to be checked (1 or 2).
Returns:
true if the given child is of type QBool.
Throws:
java.lang.IllegalArgumentException - if wrong parameter is passed.

getOp

public java.lang.String getOp()
Returns the name of the boolean operation represented with this object.
Returns:
the boolean operation.

getFirst

public java.lang.Object getFirst()
Returns the first operand of this object.
Returns:
the first operand of a boolean query.

getSecond

public java.lang.Object getSecond()
Returns the second operand of this object. Return null if this is a unary operation.
Returns:
the second operand of a boolean query.