Package org.eclipse.birt.report.model.api.metadata

# Interface IChoiceSet

public interface IChoiceSet
Represents a set of choices on a predefined or user defined property type or property definition.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`contains(String choiceName)`
Returns true if the choice set has a match for the given name.
`IChoice`
`findChoice(String name)`
Finds a Choice in the `ChoiceSet` for the given choice name.
`IChoice`
`findChoiceByDisplayName(String name)`
Finds a IChoice in the `IChoiceSet` for its display name.
`UserChoice`
`findUserChoiceByDisplayName(org.eclipse.birt.report.model.core.Module module, String name)`
Finds a UserChoice in the `IChoiceSet` for its display name.
`IChoice[]`
`getChoices()`
Returns an array containing the choices, the return choices are in their internal sequence.
`IChoice[]`
`getChoices(Comparator<Object> c)`
Returns an array containing the choices, the return choices are sorted according to the given comparator.
`String`
`getName()`
Returns the name of this ChoiceSet.
`boolean`
`isUserDefined()`
Tests whether this is a user-defined choice set or not.

## Method Details

### contains

boolean contains(String choiceName)
Returns true if the choice set has a match for the given name.

Parameters:
  `choiceName` - the choice name to match
Returns:
  true if the name matches a choice, false otherwise

### isUserDefined

boolean isUserDefined()
Tests whether this is a user-defined choice set or not.

Returns:
  `true` if the choice set is defined by user. Otherwise, `false`.

### getName

String getName()
Returns the name of this ChoiceSet.

Returns:
  the name of the ChoiceSet

### getChoices

IChoice[] getChoices()
Returns an array containing the choices, the return choices are in their internal sequence.

Returns:
  the array of choices

### getChoices

IChoice[] getChoices(Comparator<Object> c)
Returns an array containing the choices, the return choices are sorted according to the given comparator. All elements in the array must be mutually comparable by the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the array).

Parameters:
  `c` - the comparator that will be used to sort the choices. A `null` value indicates that the choices are natural ordered by their name.
Returns:
  the array of choices sorted according to the given comparator.

### findChoice

IChoice findChoice(String name)
Finds a Choice in the `ChoiceSet` for the given choice name.

Parameters:
  `name` - the name of a Choice.
Returns:
  the instance of the Choice that matches or `null` if choice not found.

### findChoiceByDisplayName

IChoice findChoiceByDisplayName(String name)
Finds a IChoice in the `IChoiceSet` for its display name. For a user defined choice, the display name can be `null`.

Parameters:
  `name` - display name of a IChoice.
Returns:
  the instance of the Choice that matches or `null` if choice is not found.

### findUserChoiceByDisplayName

UserChoice findUserChoiceByDisplayName(org.eclipse.birt.report.model.core.Module module, String name)
Finds a UserChoice in the `IChoiceSet` for its display name. For a user defined choice, the display name can be `null`.

Parameters:
  `module` - the module
  `name` - display name of a UserChoice.
Returns:
  the instance of the UserChoice that matches or `null` if choice is not found.