isql.predicate
Class DoublePredicate

java.lang.Object
  extended by isql.predicate.DoublePredicate

public class DoublePredicate
extends java.lang.Object

Returns a view that is the result of AND-ing (or OR-ing) all the views (table rows in relation) that return from the input conditions. E.g. WHERE T1.C1 = T2.C2 AND T2.C3 = T3.C4 the two predicates have the table T2 in common. In this case the result contains all the view rows of the first predicate that match the view rows of the second predicate that contain the same T2 table rows.

Author:
SHZ Oct 1, 2007

Nested Class Summary
static class DoublePredicate.AddRowAnyway
          Add always a row.
static class DoublePredicate.AddRowOnlyIfInBoth
          Add row to the result view only if both the views have, for that row, the same index in the merge table
static class DoublePredicate.AddRowOnlyIfInJustInOne
          Add row to the result view only if only one of the views have, for that row, a specific index in the merge table In this case the other table will have dummy values (-1) for the column indices in that row
static interface DoublePredicate.IAddRow
          Add row to the result view only at a certain condition
static class DoublePredicate.MergeRowsAnd
          In case of an AND between two conditions, the views have to be merged so that only the row indices that are in both views are stored in the result view
static class DoublePredicate.MergeRowsOr
          In case of an AND between two conditions, the views have to be merged so that the result view contains the union of the rows indices of the views.
 
Constructor Summary
DoublePredicate(java.util.List<IPredicate> lstPredicate, isql.predicate.IMergeRows mergeRows, ColumnValues values)
           
 
Method Summary
 WhereView apply()
          applies the AND/OR to the predicates.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoublePredicate

public DoublePredicate(java.util.List<IPredicate> lstPredicate,
                       isql.predicate.IMergeRows mergeRows,
                       ColumnValues values)
Method Detail

apply

public WhereView apply()
                throws ISQLException
applies the AND/OR to the predicates. The final result is a "view" that is the result of putting in relation all predicates, two at a time, by a common table that they contain. For example: WHERE T1.C1 = T2.C1 (predicate A) AND T2.C2 = T3.C1 (predicate B) The two predicates contain the same table T2, which is used by the AND to create the view. The idea is to: - predicate A returns a view, containing all the rows of T1 and T2 that match the expression; we call it viewA - predicate B returns viewB. - put the two views in relation, connecting them by the common table T2. Which means connecting the rows of viewA and viewB by the common T2 rows, building in that way the final view.

Throws:
ISQLException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object