View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache.search.expression;
18  
19  /***
20   * Greater than criteria
21   *
22   * @author teck
23   */
24  public class GreaterThan extends ComparableValue {
25  
26      private final Comparable comparableValue;
27  
28      /***
29       * Constructor
30       *
31       * @param attributeName attribute name
32       * @param value
33       */
34      public GreaterThan(String attributeName, Object value) {
35          super(attributeName, value);
36          this.comparableValue = (Comparable) value;
37      }
38  
39      /***
40       * Comparable value.
41       *
42       * @return value
43       */
44      public Comparable getComparableValue() {
45          return comparableValue;
46      }
47  
48  
49      /***
50       * {@inheritDoc}
51       */
52      @Override
53      protected boolean executeComparable(Comparable attributeValue) {
54          return attributeValue.compareTo(comparableValue) > 0;
55  
56      }
57  
58      /***
59       * {@inheritDoc}
60       */
61      @Override
62      protected boolean executeComparableString(Comparable attributeValue) {
63          return luceneStringCompare(attributeValue.toString(), comparableValue.toString()) > 0;
64      }
65  
66  }