# CollData Class Reference

CollData. More...

`#include <colldata.h>`

Inheritance diagram for CollData:

## Public Member Functions
UCollator * | getCollator () const
| Get the `UCollator` object used to create this object.
const StringList * | getStringList (int32_t ce) const
| Get a list of all the strings which generate a list of CEs starting with a given CE.
const CEList * | getCEList (const UnicodeString *string) const
| Get a list of the CEs generated by a partcular stirng.
void | freeCEList (const CEList *list)
| Release a `CEList` returned by `getCEList`.
int32_t | minLengthInChars (const CEList *ces, int32_t offset) const
| Return the length of the shortest string that will generate the given list of CEs.
int32_t | minLengthInChars (const CEList *ces, int32_t offset, int32_t *history) const
| Return the length of the shortest string that will generate the given list of CEs.
virtual UClassID | getDynamicClassID () const
| UObject glue.
## Static Public Member Functions
static CollData * | open (UCollator *collator, UErrorCode &status)
| Construct a `CollData` object.
static void | close (CollData *collData)
| Release a `CollData` object.
static UClassID | getStaticClassID ()
| UObject glue.
static void | freeCollDataCache ()
| `CollData` objects are expensive to compute, and so may be cached.
static void | flushCollDataCache ()
| `CollData` objects are expensive to compute, and so may be cached.
## Friends
class | CollDataCache
class | CollDataCacheEntry

## Detailed Description

CollData.

This class holds the Collator-specific data needed to compute the length of the shortest string that can generate a partcular list of CEs.

`CollData` objects are quite expensive to compute. Because of this, they are cached. When you call `CollData::open` it returns a reference counted cached object. When you call `CollData::close` the reference count on the object is decremented but the object is not deleted.

If you do not need to reuse any unreferenced objects in the cache, you can call `CollData::flushCollDataCache`. If you no longer need any `CollData` objects, you can call `CollData::freeCollDataCache`

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

Definition at line 279 of file colldata.h.

## Member Function Documentation

static void CollData::close | ( | CollData * | collData | ) | `[static]`

Release a `CollData` object.

Parameters:

  | collData | - the object

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

static void CollData::flushCollDataCache | ( |  | ) | `[static]`

`CollData` objects are expensive to compute, and so may be cached.

This routine will remove any unused `CollData` objects from the cache.

Internal:
  Do not use. This API is for internal use only. 4.0.1 technology preview

void CollData::freeCEList | ( | const CEList * | list | ) |

Release a `CEList` returned by `getCEList`.

Parameters:

  | list | - the `CEList` to free.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

static void CollData::freeCollDataCache | ( |  | ) | `[static]`

`CollData` objects are expensive to compute, and so may be cached.

This routine will free the cached objects and delete the cache.

WARNING: Don't call this until you are have called `close` for each `CollData` object that you have used. also, DO NOT call this if another thread may be calling `flushCollDataCache` at the same time.

Internal:
  Do not use. This API is for internal use only. 4.0.1 technology preview

const CEList* CollData::getCEList | ( | const UnicodeString * | string | ) | const

Get a list of the CEs generated by a partcular stirng.

Parameters:

  | string | - the string

Returns:
  a `CEList` object containt the CEs. You must call `freeCEList` when you are finished using the `CEList`/

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview.

UCollator* CollData::getCollator | ( |  | ) | const

Get the `UCollator` object used to create this object.

The object returned may not be the exact object that was used to create this object, but it will have the same behavior.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

virtual UClassID CollData::getDynamicClassID | ( |  | ) | const`[virtual]`

UObject glue.

..

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

Implements UObject.

static UClassID CollData::getStaticClassID | ( |  | ) | `[static]`

UObject glue.

..

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

const StringList* CollData::getStringList | ( | int32_t | ce | ) | const

Get a list of all the strings which generate a list of CEs starting with a given CE.

Parameters:

  | ce | - the CE

return a `StringList` object containing all the stirngs, or `NULL` if there are no such strings.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview.

int32_t CollData::minLengthInChars | ( | const CEList * | ces,
|  | int32_t | offset,
|  | int32_t * | history |
| ) |  |  | const

Return the length of the shortest string that will generate the given list of CEs.

Note: the algorithm used to do this computation is recursive. To limit the amount of recursion, a "history" list is used to record the best answer starting at a particular offset in the list of CEs. If the same offset is visited again during the recursion, the answer in the history list is used.

Parameters:

  | ces | - the CEs
  | offset | - the offset of the first CE in the list to use.
  | history | - the history list. Must be at least as long as the number of cEs in the `CEList`

Returns:
  the length of the shortest string.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

int32_t CollData::minLengthInChars | ( | const CEList * | ces,
|  | int32_t | offset |
| ) |  |  | const

Return the length of the shortest string that will generate the given list of CEs.

Parameters:

  | ces | - the CEs
  | offset | - the offset of the first CE in the list to use.

Returns:
  the length of the shortest string.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

static CollData* CollData::open | ( | UCollator * | collator,
|  | UErrorCode & | status |
| ) |  |  | `[static]`

Construct a `CollData` object.

Parameters:

  | collator | - the collator
  | status | - will be set if any errors occur.

Returns:
  the `CollData` object. You must call `close` when you are done using the object.

Note: if on return, status is set to an error code, the only safe thing to do with this object is to call `CollData::close`.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

The documentation for this class was generated from the following file:

- colldata.h

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines