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

public final Class CompactCharArray

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
CompactByteArray

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
public static final int
BLOCKSHIFT

Deprecated This API is ICU internal only.
pack-priv char
private int[]
pack-priv static final int
pack-priv static final int
private char[]
private boolean
public static final int
UNICODECOUNT

The total number of Unicode characters.

private char[]

Constructor Summary

AccessConstructor and Description
public
CompactCharArray()

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

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

Deprecated This API is ICU internal only.
Constructor for CompactCharArray.
public
CompactCharArray(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 CompactCharArray.

Method Summary

Modifier and TypeMethod and Description
pack-priv static final boolean
arrayRegionMatches(char[] source, int sourceStart, char[] 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 char

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.

private int
FindOverlappingPosition(int start, char[] tempValues, int tempCount)

public char[]
getIndexArray()

Deprecated This API is ICU internal only.
For internal use only.
public char[]
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
,
char
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
,
char
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
pack-priv static final int BLOCKCOUNT
BLOCKMASKback to summary
pack-priv static final int BLOCKMASK
BLOCKSHIFTback to summary
public static final int BLOCKSHIFT

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
ICU Status
Internal ICU component.
defaultValueback to summary
pack-priv char defaultValue
hashesback to summary
private int[] hashes
INDEXCOUNTback to summary
pack-priv static final int INDEXCOUNT
INDEXSHIFTback to summary
pack-priv 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 char[] values

Constructor Detail

CompactCharArrayback to summary
public CompactCharArray()

Deprecated

This API is ICU internal only.

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

Annotations
@Deprecated
ICU Status
Internal ICU component.
CompactCharArrayback to summary
public CompactCharArray(char defaultValue)

Deprecated

This API is ICU internal only.

Constructor for CompactCharArray.

Parameters
defaultValue:char

the default value of the compact array.

Annotations
@Deprecated
ICU Status
Internal ICU component.
CompactCharArrayback to summary
public CompactCharArray(char[] indexArray, char[] newValues)

Deprecated

This API is ICU internal only.

Constructor for CompactCharArray.

Parameters
indexArray:char[]

the indices of the compact array.

newValues:char[]

the values of the compact array.

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

Deprecated

This API is ICU internal only.

Constructor for CompactCharArray.

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(char[] source, int sourceStart, char[] 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 char 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:char

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.

FindOverlappingPositionback to summary
private int FindOverlappingPosition(int start, char[] tempValues, int tempCount)
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 char[] 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, char 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:char

the new mapped value

Annotations
@Deprecated
ICU Status
Internal ICU component.
setElementAtback to summary
public void setElementAt(char start, char end, char 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:char

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