ParameterList Class

Package : cam.dataxchg


The ParameterList class provides a means encapsulating a list of parameters. An instance of the class is an array of parameter data items consisting of a parameter value and a parameter name. Methods of the class provide a means of specifying and accessing items of this list.

The values of the parameter items can be accessed either by its string name or by an integer index. The parameter names are accessed by integer index. The parameter data types supported are int, long, float, double, char, boolean, String, and Object.

The indexing of the items in the parameter list runs from 1 to number of items --- following the conventional way that most humans count.

Class Reference

General

Add/Set/Get

boolean, char, int, long, float, double, String, Object

Sample program: ParameterListTest.java

 Chris Anderson © UCLA 1997


Constructors/Initialize

ParameterList()

Creates an empty list with a default list name of "Parameters".

ParameterList(String S)

Creates an empty list with a list name given by S.

void Initialize()

Initializes an existing list to an empty list with a default list name of "Parameters".

void Initialize(String S)

Initializes an existing list to an empty list with a list name given by S.

 

ParameterList Name Access

String getListName()

Returns the name of the ParameterList instance.

void setListName(String S)

Sets the name of the ParematerList instance to S.

 

List Item Access

String getItemType(String S)

For the item with name S, this function returns one of java.lang.Boolean, java.lang.Character, java.lang.String, java.lang.Integer, java.lang.Long, java.lang.Float, java.lang.Double, or Object.

String getItemType(int i)

For the item with index i, this function returns one of java.lang.Boolean, java.lang.Character, java.lang.String, java.lang.Integer, java.lang.Long, java.lang.Float, java.lang.Double, or Object.

int getItemCount()

Returns the number of items in the list.

String getItemName(int i)

Returns the name of the ith item in the list.

Object getItemValue(int i)

Returns the value (as an Object) of the ith item in the list. One must cast the value to the appropriate type before use (or alternately, use the type specific get functions).

String getItemValueAsString(int i)

Returns the value (as a String) of the ith item in the list.

 

 Input/Output (Serialiazation)

void output(OutputStream D)

Outputs to D the ParameterList instance in text (ascii) form.

void outputBinary(OutputStream D)

Outputs to D the ParameterList instance in binary form.

void input(InputStream D)

Reads from D the ParameterList instance that has been written to the stream in text (ascii) form. This is the "inverse" of the output (...).

void inputBinary(InputStream D)

Reads from D the ParameterList instance that has been written to the stream in binary form. This is the "inverse" of the outputBinary(...).

 

 

Add/Set/Get Boolean List Items

void addBoolean(String Name, boolean val)

Adds a boolean value with name Name and value val to the list.

void addBoolean(String Name)

Adds a boolean value with name Name and a default value (= False) to the list.

boolean getBoolean(String Name)

Returns the value of the boolean item with name Name.

void setBoolean(String Name,boolean val)

Sets the boolean item with name Name to the value val.

void setBoolean(int i,boolean val)

Sets the boolean item with index i to the value val.

void setBoolean(int i, String val)

Sets the boolean item with index i to the value represented by the String val.

 

Add/Set/Get Char List Items

void addChar(String Name, char val)

Adds a Char value with name Name and value val to the list.

void addChar(String Name)

Adds a Char value with name Name and a default value (null value) to the list.

char getChar(String Name)

Returns the value of the Char item with name Name.

void setChar(String Name,char val)

Sets the Char item with name Name to the value val.

void setChar(int i,char val)

Sets the Char item with index i to the value val.

void setChar(int i, String val)

Sets the Char item with index i to the value represented by the String val.

 

Add/Set/Get String List Items

void addString(String Name, String val)

Adds a String value with name Name and value val to the list.

void addString(String Name)

Adds a String value with name Name and a default value (null value) to the list.

String getString(String Name)

Returns the value of the String item with name Name.

void setString(String Name, String val)

Sets the String item with name Name to the value val.

void setString(int i, String val)

Sets the String item with index i to the value val.

 

Add/Set/Get Int List Items

void addInt(String Name, int val)

Adds an int value with name Name and value val to the list.

void addInt(String Name)

Adds an int value with name Name and a default value (null value) to the list.

int getInt(String Name)

Returns the value of the int item with name Name.

void setInt(String Name,int val)

Sets the int item with name Name to the value val.

void setInt(int i,int val)

Sets the int item with index i to the value val.

void setInt(int i,String val)

Sets the int item with index i to the value represented by the String val.

 

Add/Set/Get Long List Items

void addLong(String Name, long def)

Adds a long value with name Name and value val to the list.

void addLong(String Name)

Adds a long value with name Name and a default value (null value) to the list.

long getLong(String Name)

Returns the value of the long item with name Name.

void setLong(String Name,long val)

Sets the long item with name Name to the value val.

void setLong(int i,long val)

Sets the long item with index i to the value val.

void setLong(int i,String val)

Sets the long item with index i to the value represented by the String val.

 

Add/Set/Get Float List Items

void addFloat(String Name, float va;)

Adds a float value with name Name and value val to the list.

void addFloat(String Name)

Adds a float value with name Name and a default value (null value) to the list.

float getFloat(String Name)

Returns the value of the float item with name Name.

void setFloat(String Name,float val)

Sets the float item with name Name to the value val.

void setFloat(int i,float val)

Sets the float item with index i to the value val.

void setFloat(int i,String val)

Sets the float item with index i to the value represented by the String val.

 

Add/Set/Get Double List Items

void addDouble(String Name, double def)

Adds a double value with name Name and value val to the list.

void addDouble(String Name)

Adds a double value with name Name and a default value (null value) to the list.

double getDouble(String Name)

Returns the value of the double item with name Name.

void setDouble(String Name,double val)

Sets the double item with name Name to the value val.

void setDouble(int i,double val)

Sets the double item with index i to the value val.

void setDouble(int i,String val)

Sets the double item with index i to the value represented by the String val.

 

 

Add/Set/Get Object List Items

void addObject(String Name, Object val)

Adds an Object value with name Name and value val to the list.

void addObject(String Name)

Adds an Object value with name Name and a default value (null value) to the list.

Object getObject(String Name)

Returns the value of the Object item with name Name.

void setObject(String Name, Object val)

Sets the Object item with name Name to the value val.

void setObject(int i, Object val)

Sets the Object item with index i to the value val.