All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class xa.xa_ChoiceList

java.lang.Object
   |
   +----xa.xa_ChoiceList

public class xa_ChoiceList
extends Object

A container for a list of String values which define the values allowed for whatever use it is being put to. The list is held internally in two forms: a Hashtable (to allow validation by key), and as a Vector (to allow retrieval of the values in the order they were supplied).

xa_ChoiceList is intended to be restricted in its use to definitions of lists of allowed value strings. Each allowed value (choice) string has an integer associated with it, which may be a constant used programmatically. No checking is performed on these integer values (so they do not have to be unique) - but it is inadvisable to use -1, since -1 is used to indicate an error when failing to find a choice.


Variable Index

 o ChoiceHashtable
Hashtable used to retrieve an allowed value, given the value.
 o ChoiceListName
Allows this choice list to be identified.
 o ChoiceValueHashtable
Hashtable of allowed values, to allow retrieval of a choice name given its integer choice value.
 o ChoiceVector
Array of allowed values, to allow retrieval in the order they were added.

Constructor Index

 o xa_ChoiceList(String)
Constructor, giving this choice list a name.

Method Index

 o addChoice(String, int)
Add an allowed value.
 o getChoice(int)
Retrieve the choice whose integer value is InputChoiceIndex.
 o getChoice(String)
Retrieve the choice whose name is InputChoiceName.
 o getChoiceAt(int)
Retrieve the choice whose index is InputChoiceIndex in the ChoiceVector.
 o getName()
Retrieve the name of this choice list.
 o getNumChoices()
Find out how many choices there are.
 o hasChoice(String)
Return true of InputChoiceName is a valid allowed value; false if not.
 o toString()
Return a string representation of the choice list, in the form of a comma- separated list ("A, B, C").

Variables

 o ChoiceListName
 protected String ChoiceListName
Allows this choice list to be identified. By qualifying choice names with the name of the choice list to which they belong, we can derive globally unique names for all choices. Such a global list may be useful for, say, documentation purposes - to allow automatic reference to the relevant section of the XML specification.

 o ChoiceHashtable
 protected Hashtable ChoiceHashtable
Hashtable used to retrieve an allowed value, given the value.

 o ChoiceValueHashtable
 protected Hashtable ChoiceValueHashtable
Hashtable of allowed values, to allow retrieval of a choice name given its integer choice value.

 o ChoiceVector
 protected Vector ChoiceVector
Array of allowed values, to allow retrieval in the order they were added.

Constructors

 o xa_ChoiceList
 public xa_ChoiceList(String InputChoiceListName)
Constructor, giving this choice list a name.

Methods

 o addChoice
 public void addChoice(String InputChoiceName,
                       int InputChoiceValue)
Add an allowed value.

Parameters:
InputChoiceName - The value which is allowed
InputChoiceValue - A number associated with this value
 o hasChoice
 public boolean hasChoice(String InputChoiceName)
Return true of InputChoiceName is a valid allowed value; false if not.

Parameters:
InputChoiceName - The name of the choice to be checked
 o getChoice
 public int getChoice(String InputChoiceName)
Retrieve the choice whose name is InputChoiceName.

Parameters:
InputChoiceName - The name of the choice to be retrieved
 o getChoice
 public String getChoice(int InputChoiceValue)
Retrieve the choice whose integer value is InputChoiceIndex.

Parameters:
InputChoiceValue - The integer value of the choice to be retrieved
 o getChoiceAt
 public String getChoiceAt(int InputChoiceIndex)
Retrieve the choice whose index is InputChoiceIndex in the ChoiceVector.

Parameters:
InputChoiceIndex - The index of the choice to be retrieved
 o getNumChoices
 public int getNumChoices()
Find out how many choices there are.

Returns:
The number of choices in the list
 o getName
 public String getName()
Retrieve the name of this choice list.

Returns:
The name of this choice list
 o toString
 public String toString()
Return a string representation of the choice list, in the form of a comma- separated list ("A, B, C").

Returns:
String represention of the list.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index