blob: bba5fcf352c27919f70ddab4dbad036249489f60 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.predicate.index.conjunction;
/**
* Conjunction id format:
* bit 31-1: id/hash
* bit 0: 0: negated, 1: not negated
*
* @author bjorncs
*/
public class ConjunctionId {
public static int compare(int c1, int c2) {
return Integer.compare(c1 | 1, c2 | 1);
}
public static boolean equals(int c1, int c2) {
return (c1 | 1) == (c2 | 1);
}
public static boolean isPositive(int c) {
return (c & 1) == 1;
}
public static int nextId(int c) {
return (c | 1) + 1;
}
}
|