KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > rolap > StarColumnPredicate


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/rolap/StarColumnPredicate.java#1 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2007-2007 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.rolap;
11
12 import java.util.Collection JavaDoc;
13
14 /**
15  * Refinement of {@link StarPredicate} which constrains precisely one column.
16  *
17  * <p>The convenience methods
18  *
19  * @author jhyde
20  * @version $Id: //open/mondrian/src/main/mondrian/rolap/StarColumnPredicate.java#1 $
21  * @since Jan 15, 2007
22  */

23 public interface StarColumnPredicate extends StarPredicate {
24     /**
25      * Adds the values in this constraint to a collection.
26      */

27     public abstract void values(Collection JavaDoc collection);
28
29     /**
30      * Returns whether this constraint would return <code>true</code> for a
31      * given value.
32      */

33     public abstract boolean evaluate(Object JavaDoc value);
34
35     /**
36      * Returns the column constrained by this predicate.
37      *
38      * @return Column constrained by this predicate.
39      */

40     RolapStar.Column getConstrainedColumn();
41
42     /**
43      * Applies this predicate to a predicate from the axis of
44      * a segment, and tests for overlap. The result might be that there
45      * is no overlap, full overlap (so the constraint can be removed),
46      * or partial overlap (so the constraint will need to be replaced with
47      * a stronger constraint, say 'x > 10' is replaced with 'x > 20').
48      *
49      * @param predicate
50      */

51     Overlap intersect(StarColumnPredicate predicate);
52
53     /**
54      * Returns whether this predicate might intersect another predicate.
55      * That is, whether there might be a value which holds true for both
56      * constraints.
57      *
58      * @param other Other constraint
59      * @return Whether constraints intersect
60      */

61     boolean mightIntersect(StarPredicate other);
62
63     // override with stricter return type
64
StarColumnPredicate minus(StarPredicate predicate);
65
66     public static class Overlap {
67         public final boolean matched;
68         public final StarColumnPredicate remaining;
69         public final float selectivity;
70
71         public Overlap(
72             boolean matched,
73             StarColumnPredicate remaining,
74             float selectivity)
75         {
76             this.matched = matched;
77             this.remaining = remaining;
78             this.selectivity = selectivity;
79         }
80     }
81 }
82
83 // End StarColumnPredicate.java
84
Popular Tags