]> review.fuel-infra Code Review - packages/trusty/mysql-wsrep-5.6.git/blob
9856be09135cc66bd75a7cd7044cf95ae7eb88c0
[packages/trusty/mysql-wsrep-5.6.git] /
1 /*
2    Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; version 2 of the License.
7
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
16 */
17
18 package com.mysql.clusterj.core.query;
19
20 import com.mysql.clusterj.core.spi.QueryExecutionContext;
21 import com.mysql.clusterj.core.store.IndexScanOperation;
22
23 /** This is an abstract superclass for all of the comparison predicates:
24  * GreaterEqualPredicate, GreaterThanPredicate, LessEqualPredicate, and
25  * LessThanPredicate.
26  */
27 public abstract class ComparativePredicateImpl extends PredicateImpl {
28     /**
29      * My parameter
30      */
31     protected ParameterImpl param;
32     /**
33      * My property
34      */
35     protected PropertyImpl property;
36
37     public ComparativePredicateImpl(QueryDomainTypeImpl<?> dobj) {
38         super(dobj);
39     }
40
41     public ComparativePredicateImpl(QueryDomainTypeImpl<?> dobj,
42             PropertyImpl property, ParameterImpl param) {
43         super(dobj);
44         this.property = property;
45         this.param = param;
46         param.setProperty(property);
47     }
48
49     public void markParameters() {
50         param.mark();
51     }
52
53     public void unmarkParameters() {
54         param.unmark();
55     }
56
57     @Override
58     public void objectSetValuesFor(QueryExecutionContext context,
59             Object row, String indexName) {
60         property.objectSetValuesFor(param.getParameterValue(context), row, indexName);
61     }
62
63     @Override
64     public void operationSetLowerBound(QueryExecutionContext context,
65             IndexScanOperation op, boolean lastColumn) {
66         // delegate to setBounds for most operations
67         operationSetBounds(context, op, lastColumn);
68     }
69
70     @Override
71     public void operationSetUpperBound(QueryExecutionContext context,
72             IndexScanOperation op, boolean lastColumn) {
73         // delegate to setBounds for most operations
74         operationSetBounds(context, op, lastColumn);
75     }
76
77 }