public class NodeUtils extends Object
Constructor and Description |
---|
NodeUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
compare(org.apache.lucene.util.IntsRef n1,
org.apache.lucene.util.IntsRef n2)
Compares the first node with the second node for order.
|
static int |
compareAncestor(int[] n1,
int n1Len,
int[] n2,
int n2Len) |
static int |
compareAncestor(org.apache.lucene.util.IntsRef n1,
org.apache.lucene.util.IntsRef n2)
Compares the first node with the second node for order.
|
static int[] |
growAndCopy(int[] array,
int minSize)
Increase the size of the array and copy the content of the original array
into the new one.
|
static boolean |
isConstraintSatisfied(org.apache.lucene.util.IntsRef node,
int level)
Check if a node path is satisfying the level constraint.
|
static boolean |
isConstraintSatisfied(org.apache.lucene.util.IntsRef node,
int level,
int[] constraint)
Check if a node path is satisfying the interval constraints.
|
static boolean |
isConstraintSatisfied(org.apache.lucene.util.IntsRef node,
int level,
int[] levelIndex,
int[][] constraints)
Check if a node path is satisfying the interval constraints.
|
public static final int compare(org.apache.lucene.util.IntsRef n1, org.apache.lucene.util.IntsRef n2)
public static final int compareAncestor(org.apache.lucene.util.IntsRef n1, org.apache.lucene.util.IntsRef n2)
public static final int compareAncestor(int[] n1, int n1Len, int[] n2, int n2Len)
public static final int[] growAndCopy(int[] array, int minSize)
public static final boolean isConstraintSatisfied(org.apache.lucene.util.IntsRef node, int level, int[] levelIndex, int[][] constraints)
The level
parameter allows to force the node to be on a
certain level.
The levelIndex
array contains the level associated with
the interval constraints in constraints
.
Example:
Given the lower bound constraint [1], upper bound constraint [10] at
level 1, then the node paths [1,4], [5,10,9] or [10,5] satisfy
the constraints. However, the node path [0,3] or [11,0,9] does not satisfy
the constraints.
public static final boolean isConstraintSatisfied(org.apache.lucene.util.IntsRef node, int level, int[] constraint)
The levelIndex
array contains the level associated with
the interval constraints in constraints
.
Example:
Given the lower bound constraint [1], upper bound constraint [10] at
level 1, then the node paths [1,4], [5,10,9] or [10,5] satisfy
the constraints. However, the node path [0,3] or [11,0,9] does not satisfy
the constraints.
public static final boolean isConstraintSatisfied(org.apache.lucene.util.IntsRef node, int level)
The level
parameter allows to force the node to be on a
certain level.
Given that the root of the tree (level 0) is the document id, the node
level constraint ranges from 1 to Integer.MAX_VALUE
. A node
level constraint of 0 will always return false.
The sentinel value to ignore the node level constraint is -1.
Example:
Given the level constraint 2, the node paths [0,1], [3,10] or [2,5] satisfy
the constraints. However, the node path [2,3,4] does not satisfy the
constraints.
Copyright © 2014. All rights reserved.