Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 239D4189E9 for ; Wed, 20 Apr 2016 07:12:07 +0000 (UTC) Received: (qmail 70838 invoked by uid 500); 20 Apr 2016 07:12:07 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 70797 invoked by uid 500); 20 Apr 2016 07:12:07 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 70788 invoked by uid 99); 20 Apr 2016 07:12:07 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Apr 2016 07:12:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D889CDFE2E; Wed, 20 Apr 2016 07:12:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Wed, 20 Apr 2016 07:12:06 -0000 Message-Id: <654812b3ebd84403b663dfcdb1d3d270@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/26] ignite git commit: IGNITE-2926: WIP. Repository: ignite Updated Branches: refs/heads/ignite-2523-1 [created] 7f993fa22 IGNITE-2926: WIP. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9ea980a5 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9ea980a5 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9ea980a5 Branch: refs/heads/ignite-2523-1 Commit: 9ea980a5e5b1ada745f860c66e66017aa34fe561 Parents: b024235 Author: vozerov-gridgain Authored: Thu Apr 14 12:50:25 2016 +0300 Committer: vozerov-gridgain Committed: Thu Apr 14 12:50:25 2016 +0300 ---------------------------------------------------------------------- .../processors/cache/CacheOperationFilter.java | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/9ea980a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationFilter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationFilter.java new file mode 100644 index 0000000..9a92e1e --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationFilter.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + +import org.jetbrains.annotations.Nullable; + +/** + * Cache operation filter. + */ +public enum CacheOperationFilter { + /** Always pass. */ + ALWAYS, + + /** No value. */ + NO_VAL, + + /** Has value. */ + HAS_VAL, + + /** Equals to value. */ + EQUALS_VAL; + + /** + * Creare predicate from operation filter. + * + * @param val Optional value. + * @return Predicate. + */ + @Nullable public CacheEntryPredicate createPredicate(@Nullable CacheObject val) { + switch (this) { + case ALWAYS: + return null; + + case NO_VAL: + return new CacheEntrySerializablePredicate(new CacheEntryPredicateNoValue()); + + case HAS_VAL: + return new CacheEntrySerializablePredicate(new CacheEntryPredicateHasValue()); + + default: + assert this == EQUALS_VAL; + + return new CacheEntryPredicateContainsValue(val); + } + } +}