1 // -*- Mode: C++ -*-
2 
3 //          BTpredicate.cpp
4 //
5 // Copyright (c) 1996, Regents of the University of California
6 // $Header: /cvsroot/gigabase/gigabase/GiST/BTree/BTpredicate.cpp,v 1.1 2008/04/04 11:02:10 knizhnik Exp $
7 
8 #include "BT.h"
9 
10 int
Consistent(const GiSTentry & entry) const11 BTpredicate::Consistent(const GiSTentry& entry) const
12 {
13   BTentry &btentry = (BTentry &)entry;
14   const BTkey& l = btentry.LowerBound();
15   const BTkey& u = btentry.UpperBound();
16 
17   switch (oper) {
18   case BTEqual:
19     return (value >= l) && (value <= u);
20     break;
21   case BTLessThan:
22     return l < value;
23     break;
24   case BTGreaterThan:
25     return value < u;  // Assume that the keys are integers.
26     break;
27   case BTLessEqual:
28     return value >= l;
29     break;
30   case BTGreaterEqual:
31     return value <= u;
32     break;
33   case BTNotEqual:
34     // Assume that the keys are integers.
35     return !((value == l) && (value == u));
36     // return !((value == l) && (u - l == 1));
37     break;
38   default:
39     assert(0);
40 	return (0);
41     break;
42   }
43 }
44 
45