Top Description Fields Constructors Methods
com.ibm.icu.util

public final Class CompactByteArray

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Annotations
@Deprecated
Imports
com.ibm.icu.impl.Utility

Deprecated

This API is ICU internal only.

class CompactATypeArray : use only on primitive data types Provides a compact way to store information that is indexed by Unicode values, such as character properties, types, keyboard values, etc.This is very useful when you have a block of Unicode data that contains significant values while the rest of the Unicode data is unused in the application or when you have a lot of redundance, such as where all 21,000 Han ideographs have the same value. However, lookup is much faster than a hash table. A compact array of any primitive data type serves two purposes: A compact array is composed of a index array and value array. The index array contains the indices of Unicode characters to the value array.
Author
Helena Shih
ICU Status
Internal ICU component.
See Also
CompactCharArray

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
pack-priv byte
private int[]
private static final int
private static final int
private char[]
private boolean
public static final int
UNICODECOUNT

The total number of Unicode characters.

private byte[]

Constructor Summary

AccessConstructor and Description
public
CompactByteArray()

Deprecated This API is ICU internal only.
Default constructor for CompactByteArray, the default value of the compact array is 0.
public
CompactByteArray(byte
the default value of the compact array.
defaultValue
)

Deprecated This API is ICU internal only.
Constructor for CompactByteArray.
public
CompactByteArray(char[]
the indices of the compact array.
indexArray
,
byte[]
the values of the compact array.
newValues
)

Deprecated This API is ICU internal only.
Constructor for CompactByteArray.
public
CompactByteArray(String
the RLE-encoded indices of the compact array.
indexArray
,
String
the RLE-encoded values of the compact array.
valueArray
)

Deprecated This API is ICU internal only.
Constructor for CompactByteArray.

Method Summary

Modifier and TypeMethod and Description
pack-priv static final boolean
arrayRegionMatches(byte[] source, int sourceStart, byte[] target, int targetStart, int
the length to compare. The start indices and start+len must be valid.
len
)

Convenience utility to compare two arrays of doubles.

private final boolean
blockTouched(int i)

Query whether a specified block was "touched", i.e. had a value set.

public Object
clone()

Overrides java.lang.Object.clone.

Deprecated This API is ICU internal only.
Overrides Cloneable
public void
compact()

Deprecated This API is ICU internal only.
Compact the array.
public void
compact(boolean exhaustive)

Deprecated This API is ICU internal only.
Compact the array.
public byte

Returns:

the mapped value of the given character
elementAt
(char
the character to get the mapped value with
index
)

Deprecated This API is ICU internal only.
Get the mapped value of a Unicode character.
public boolean

Returns:

true if the current compact array object is the same as the compact array object obj; false otherwise.
equals
(Object
the compact array object to be compared with this.
obj
)

Overrides java.lang.Object.equals.

Deprecated This API is ICU internal only.
Compares the equality of two compact array objects.
private void
expand()

Expanding takes the array back to a 65536 element array.

public char[]
getIndexArray()

Deprecated This API is ICU internal only.
For internal use only.
public byte[]
getValueArray()

Deprecated This API is ICU internal only.
For internal use only.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Deprecated This API is ICU internal only.
Generates the hash code for the compact array object
public void
setElementAt(char
the character to set the mapped value with
index
,
byte
the new mapped value
value
)

Deprecated This API is ICU internal only.
Set a new value for a Unicode character.
public void
setElementAt(char
the starting offset of the range
start
,
char
the ending offset of the range
end
,
byte
the new mapped value
value
)

Deprecated This API is ICU internal only.
Set new values for a range of Unicode character.
private final void
touchBlock(int i, int value)

Remember that a specified block was "touched", i.e. had a value set.

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

BLOCKCOUNTback to summary
private static final int BLOCKCOUNT
BLOCKMASKback to summary
private static final int BLOCKMASK
BLOCKSHIFTback to summary
private static final int BLOCKSHIFT
defaultValueback to summary
pack-priv byte defaultValue
hashesback to summary
private int[] hashes
INDEXCOUNTback to summary
private static final int INDEXCOUNT
INDEXSHIFTback to summary
private static final int INDEXSHIFT
indicesback to summary
private char[] indices
isCompactback to summary
private boolean isCompact
UNICODECOUNTback to summary
public static final int UNICODECOUNT

Deprecated

This API is ICU internal only.

The total number of Unicode characters.

Annotations
@Deprecated
ICU Status
Internal ICU component.
valuesback to summary
private byte[] values

Constructor Detail

CompactByteArrayback to summary
public CompactByteArray()

Deprecated

This API is ICU internal only.

Default constructor for CompactByteArray, the default value of the compact array is 0.

Annotations
@Deprecated
ICU Status
Internal ICU component.
CompactByteArrayback to summary
public CompactByteArray(byte defaultValue)

Deprecated

This API is ICU internal only.

Constructor for CompactByteArray.

Parameters
defaultValue:byte

the default value of the compact array.

Annotations
@Deprecated
ICU Status
Internal ICU component.
CompactByteArrayback to summary
public CompactByteArray(char[] indexArray, byte[] newValues)

Deprecated

This API is ICU internal only.

Constructor for CompactByteArray.

Parameters
indexArray:char[]

the indices of the compact array.

newValues:byte[]

the values of the compact array.

Annotations
@Deprecated
Exceptions
IllegalArgumentException:
If the index is out of range.
ICU Status
Internal ICU component.
CompactByteArrayback to summary
public CompactByteArray(String indexArray, String valueArray)

Deprecated

This API is ICU internal only.

Constructor for CompactByteArray.

Parameters
indexArray:String

the RLE-encoded indices of the compact array.

valueArray:String

the RLE-encoded values of the compact array.

Annotations
@Deprecated
Exceptions
IllegalArgumentException:
if the index or value array is the wrong size.
ICU Status
Internal ICU component.

Method Detail

arrayRegionMatchesback to summary
pack-priv static final boolean arrayRegionMatches(byte[] source, int sourceStart, byte[] target, int targetStart, int len)

Convenience utility to compare two arrays of doubles.

Parameters
len:int

the length to compare. The start indices and start+len must be valid.

blockTouchedback to summary
private final boolean blockTouched(int i)

Query whether a specified block was "touched", i.e. had a value set. Untouched blocks can be skipped when compacting the array

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Deprecated

This API is ICU internal only.

Overrides Cloneable

Returns:Object

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
@Deprecated
ICU Status
Internal ICU component.
compactback to summary
public void compact()

Deprecated

This API is ICU internal only.

Compact the array.

Annotations
@Deprecated
ICU Status
Internal ICU component.
compactback to summary
public void compact(boolean exhaustive)

Deprecated

This API is ICU internal only.

Compact the array.

Annotations
@Deprecated
ICU Status
Internal ICU component.
elementAtback to summary
public byte elementAt(char index)

Deprecated

This API is ICU internal only.

Get the mapped value of a Unicode character.

Parameters
index:char

the character to get the mapped value with

Returns:byte

the mapped value of the given character

Annotations
@Deprecated
ICU Status
Internal ICU component.
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Deprecated

This API is ICU internal only.

Compares the equality of two compact array objects.

Parameters
obj:Object

the compact array object to be compared with this.

Returns:boolean

true if the current compact array object is the same as the compact array object obj; false otherwise.

Annotations
@Override
@Deprecated
ICU Status
Internal ICU component.
expandback to summary
private void expand()

Expanding takes the array back to a 65536 element array.

getIndexArrayback to summary
public char[] getIndexArray()

Deprecated

This API is ICU internal only.

For internal use only. Do not modify the result, the behavior of modified results are undefined.

Annotations
@Deprecated
ICU Status
Internal ICU component.
getValueArrayback to summary
public byte[] getValueArray()

Deprecated

This API is ICU internal only.

For internal use only. Do not modify the result, the behavior of modified results are undefined.

Annotations
@Deprecated
ICU Status
Internal ICU component.
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Deprecated

This API is ICU internal only.

Generates the hash code for the compact array object

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object.

Annotations
@Override
@Deprecated
ICU Status
Internal ICU component.
setElementAtback to summary
public void setElementAt(char index, byte value)

Deprecated

This API is ICU internal only.

Set a new value for a Unicode character. Set automatically expands the array if it is compacted.

Parameters
index:char

the character to set the mapped value with

value:byte

the new mapped value

Annotations
@Deprecated
ICU Status
Internal ICU component.
setElementAtback to summary
public void setElementAt(char start, char end, byte value)

Deprecated

This API is ICU internal only.

Set new values for a range of Unicode character.

Parameters
start:char

the starting offset of the range

end:char

the ending offset of the range

value:byte

the new mapped value

Annotations
@Deprecated
ICU Status
Internal ICU component.
touchBlockback to summary
private final void touchBlock(int i, int value)

Remember that a specified block was "touched", i.e. had a value set. Untouched blocks can be skipped when compacting the array