Top Description Inners Fields Constructors Methods
com.ibm.icu.impl.coll

public final Class CollationWeights

extends Object
Class Inheritance
Imports
java.util.Arrays

Allocates n collation element weights between two exclusive limits. Used only internally by the collation tailoring builder.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private int[]
private int
private int[]
private int
private int
private CollationWeights.WeightRange[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if it is possible to fit n elements between the limits
allocWeights
(long
A collation element weight; the ranges will be filled to cover weights greater than this one.
lowerLimit
,
long
A collation element weight; the ranges will be filled to cover weights less than this one.
upperLimit
,
int
The number of collation element weights w necessary such that lowerLimitn)

Determine heuristically what ranges to use for a given number of weights between (excluding) two limits.

private boolean
allocWeightsInMinLengthRanges(int n, int minLength)

private boolean
allocWeightsInShortRanges(int n, int minLength)

private int

Returns:

number of usable byte values for byte idx
countBytes
(int idx)

private static long
decWeightTrail(long weight, int length)

private static int
getWeightByte(long weight, int idx)

private boolean
getWeightRanges(long lowerLimit, long upperLimit)

Takes two CE weights and calculates the possible ranges of weights between the two limits, excluding them.

private static int
getWeightTrail(long weight, int length)

private long
incWeight(long weight, int length)

private long
incWeightByOffset(long weight, int length, int offset)

private static long
incWeightTrail(long weight, int length)

public void
initForPrimary(boolean compressible)

public void
public void
private void
public static int
lengthOfWeight(long weight)

public long

Returns:

The next weight in the ranges, or 0xffffffff if there is none left.
nextWeight
()

Given a set of ranges calculated by allocWeights(), iterate through the weights.

private static long
setWeightByte(long weight, int idx, int b)

private static long
setWeightTrail(long weight, int length, int trail)

private static long
truncateWeight(long weight, int length)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

maxBytesback to summary
private int[] maxBytes
middleLengthback to summary
private int middleLength
minBytesback to summary
private int[] minBytes
rangeCountback to summary
private int rangeCount
rangeIndexback to summary
private int rangeIndex
rangesback to summary
private CollationWeights.WeightRange[] ranges

Constructor Detail

CollationWeightsback to summary
public CollationWeights()

Method Detail

allocWeightsback to summary
public boolean allocWeights(long lowerLimit, long upperLimit, int n)

Determine heuristically what ranges to use for a given number of weights between (excluding) two limits.

Parameters
lowerLimit:long

A collation element weight; the ranges will be filled to cover weights greater than this one.

upperLimit:long

A collation element weight; the ranges will be filled to cover weights less than this one.

n:int

The number of collation element weights w necessary such that lowerLimit

Returns:boolean

true if it is possible to fit n elements between the limits

allocWeightsInMinLengthRangesback to summary
private boolean allocWeightsInMinLengthRanges(int n, int minLength)
allocWeightsInShortRangesback to summary
private boolean allocWeightsInShortRanges(int n, int minLength)
countBytesback to summary
private int countBytes(int idx)
Returns:int

number of usable byte values for byte idx

decWeightTrailback to summary
private static long decWeightTrail(long weight, int length)
getWeightByteback to summary
private static int getWeightByte(long weight, int idx)
getWeightRangesback to summary
private boolean getWeightRanges(long lowerLimit, long upperLimit)

Takes two CE weights and calculates the possible ranges of weights between the two limits, excluding them. For weights with up to 4 bytes there are up to 2*4-1=7 ranges.

getWeightTrailback to summary
private static int getWeightTrail(long weight, int length)
incWeightback to summary
private long incWeight(long weight, int length)
incWeightByOffsetback to summary
private long incWeightByOffset(long weight, int length, int offset)
incWeightTrailback to summary
private static long incWeightTrail(long weight, int length)
initForPrimaryback to summary
public void initForPrimary(boolean compressible)
initForSecondaryback to summary
public void initForSecondary()
initForTertiaryback to summary
public void initForTertiary()
lengthenRangeback to summary
private void lengthenRange(CollationWeights.WeightRange range)
lengthOfWeightback to summary
public static int lengthOfWeight(long weight)
nextWeightback to summary
public long nextWeight()

Given a set of ranges calculated by allocWeights(), iterate through the weights. The ranges are modified to keep the current iteration state.

Returns:long

The next weight in the ranges, or 0xffffffff if there is none left.

setWeightByteback to summary
private static long setWeightByte(long weight, int idx, int b)
setWeightTrailback to summary
private static long setWeightTrail(long weight, int length, int trail)
truncateWeightback to summary
private static long truncateWeight(long weight, int length)
com.ibm.icu.impl.coll back to summary

private final Class CollationWeights.WeightRange

extends Object
implements Comparable<CollationWeights.WeightRange>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

ICU Status
Internal ICU component.

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv long
pack-priv int
pack-priv long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(CollationWeights.WeightRange
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
pack-priv int count
endback to summary
pack-priv long end
lengthback to summary
pack-priv int length
startback to summary
pack-priv long start

Constructor Detail

WeightRangeback to summary
private WeightRange()

Method Detail

compareToback to summary
public int compareTo(CollationWeights.WeightRange other)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
other:CollationWeights.WeightRange

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override