View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * See the AUTHORS.txt file in the distribution for a full listing of 
7    * individual contributors.
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   * 
14   * ModeShape is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.jcr.query.qom;
25  
26  import javax.jcr.query.qom.DynamicOperand;
27  import javax.jcr.query.qom.StaticOperand;
28  import org.modeshape.graph.query.model.Between;
29  
30  /**
31   * Implementation of the 'between' constraint for the Graph API and that is an extension to JCR Query Object Model.
32   */
33  public class JcrBetween extends Between implements JcrConstraint, org.modeshape.jcr.api.query.qom.Between {
34  
35      private static final long serialVersionUID = 1L;
36  
37      /**
38       * Create a constraint that the values of the supplied dynamic operand are between the lower and upper bounds, specifying
39       * whether the boundary values are to be included in the range.
40       * 
41       * @param operand the dynamic operand describing the values that are to be constrained
42       * @param lowerBound the lower bound of the range
43       * @param upperBound the upper bound of the range
44       * @param includeLowerBound true if the lower boundary value is not be included
45       * @param includeUpperBound true if the upper boundary value is not be included
46       * @throws IllegalArgumentException if any of the arguments are null
47       */
48      public JcrBetween( JcrDynamicOperand operand,
49                         JcrStaticOperand lowerBound,
50                         JcrStaticOperand upperBound,
51                         boolean includeLowerBound,
52                         boolean includeUpperBound ) {
53          super(operand, lowerBound, upperBound, includeLowerBound, includeUpperBound);
54      }
55  
56      /**
57       * {@inheritDoc}
58       * 
59       * @see org.modeshape.graph.query.model.Between#operand()
60       */
61      @Override
62      public JcrDynamicOperand operand() {
63          return (JcrDynamicOperand)super.operand();
64      }
65  
66      /**
67       * {@inheritDoc}
68       * 
69       * @see org.modeshape.graph.query.model.Between#lowerBound()
70       */
71      @Override
72      public JcrStaticOperand lowerBound() {
73          return (JcrStaticOperand)super.lowerBound();
74      }
75  
76      /**
77       * {@inheritDoc}
78       * 
79       * @see org.modeshape.graph.query.model.Between#upperBound()
80       */
81      @Override
82      public JcrStaticOperand upperBound() {
83          return (JcrStaticOperand)super.upperBound();
84      }
85  
86      /**
87       * {@inheritDoc}
88       * 
89       * @see org.modeshape.jcr.api.query.qom.Between#getLowerBound()
90       */
91      @Override
92      public StaticOperand getLowerBound() {
93          return lowerBound();
94      }
95  
96      /**
97       * {@inheritDoc}
98       * 
99       * @see org.modeshape.jcr.api.query.qom.Between#getUpperBound()
100      */
101     @Override
102     public StaticOperand getUpperBound() {
103         return upperBound();
104     }
105 
106     /**
107      * {@inheritDoc}
108      * 
109      * @see org.modeshape.jcr.api.query.qom.Between#getOperand()
110      */
111     @Override
112     public DynamicOperand getOperand() {
113         return operand();
114     }
115 }