Debian Codegraph @

net/sf/saxon/z/IntValuePredicate.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.z;
9
10 import java.util.function.IntPredicate;
11
12 /**
13 * An IntPredicate that matches a single specific integer
14 */
15
16 public class IntValuePredicate implements IntPredicate {
17
18 private int target;
19
20 public IntValuePredicate(int target) {
21 this.target = target;
22 }
23
24 /**
25 * Ask whether a given value matches this predicate
26 *
27 * @param value the value to be tested
28 * @return true if the value matches; false if it does not
29 */
30 public boolean test(int value) {
31 return value == target;
32 }
33
34 /**
35 * Get the value matched by this predicate
36 *
37 * @return the value that this predicate matches
38 */
39
40 public int getTarget() {
41 return target;
42 }
43 }