Line data Source code
1 : // Copyright (C) 2016 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.query.change; 16 : 17 : import com.google.gerrit.index.SchemaFieldDefs.SchemaField; 18 : import com.google.gerrit.index.query.IndexPredicate; 19 : import com.google.gerrit.index.query.Predicate; 20 : 21 : /** Predicate that is mapped to a field in the change index. */ 22 : public class ChangeIndexPredicate extends IndexPredicate<ChangeData> { 23 : /** 24 : * Returns an index predicate that matches no changes in the index. 25 : * 26 : * <p>This predicate should be used in preference to a non-index predicate (such as {@code 27 : * Predicate.not(Predicate.any())}), since it can be matched efficiently against the index. 28 : * 29 : * @return an index predicate matching no changes. 30 : */ 31 : public static Predicate<ChangeData> none() { 32 5 : return ChangeStatusPredicate.NONE; 33 : } 34 : 35 : protected ChangeIndexPredicate(SchemaField<ChangeData, ?> def, String value) { 36 113 : super(def, value); 37 113 : } 38 : 39 : protected ChangeIndexPredicate(SchemaField<ChangeData, ?> def, String name, String value) { 40 68 : super(def, name, value); 41 68 : } 42 : }