public class KeyMap extends AstObject
This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licence for more details.
You should have received a copy of the GNU General Public Licence along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,Fifth Floor, Boston, MA 02110-1301, USA
In Java, you are probably better off using a Map
.
Modifier and Type | Field and Description |
---|---|
static int |
AST__BADTYPE
Type constant represening no known type.
|
static int |
AST__DOUBLETYPE
Type constant representing double type.
|
static int |
AST__INTTYPE
Type constant representing int type.
|
static int |
AST__OBJECTTYPE
Type constant representing AstObject type.
|
static int |
AST__STRINGTYPE
Type constant representing String type.
|
AST__BAD, AST__TUNULL, pointer
Constructor and Description |
---|
KeyMap()
Create a KeyMap.
|
Modifier and Type | Method and Description |
---|---|
AstObject |
mapGet0A(String key)
Retrieve an AstObject.
|
String |
mapGet0C(String key)
Retrieve a string value.
|
Double |
mapGet0D(String key)
Retrieve a double value.
|
Integer |
mapGet0I(String key)
Retrieve an integer value.
|
AstObject[] |
mapGet1A(String key)
Retrieve an array of AstObjects.
|
String[] |
mapGet1C(String key,
int sleng)
Retrieve a string array.
|
double[] |
mapGet1D(String key)
Retrieve a double array.
|
int[] |
mapGet1I(String key)
Retrieve an integer array.
|
boolean |
mapHasKey(String key)
Check if an entry with a given key exists in a KeyMap.
|
String |
mapKey(int index)
Get the key at a given index within the KeyMap.
|
int |
mapLength(String key)
Get the vector length of an entry in a KeyMap.
|
void |
mapPut0A(String key,
AstObject value,
String comment)
Store an AstObject.
|
void |
mapPut0C(String key,
String value,
String comment)
Store a string value.
|
void |
mapPut0D(String key,
double value,
String comment)
Store a double value.
|
void |
mapPut0I(String key,
int value,
String comment)
Store an integer value.
|
void |
mapPut1A(String key,
AstObject[] value,
String comment)
Store an AstObject array.
|
void |
mapPut1C(String key,
String[] value,
String comment)
Store a string array.
|
void |
mapPut1D(String key,
double[] value,
String comment)
Store a double array.
|
void |
mapPut1I(String key,
int[] value,
String comment)
Store an integer array.
|
void |
mapRemove(String key)
Removed a named entry from a KeyMap.
|
int |
mapSize()
Get the number of entries in a KeyMap.
|
int |
mapType(String key)
Get the data type of an entry in a KeyMap.
|
annul, clear, copy, delete, equals, finalize, getAstConstantI, getB, getC, getD, getF, getI, getID, getIdent, getL, getNobject, getObjSize, getRefCount, hashCode, isThreaded, reportVersions, sameObject, set, setB, setC, setD, setF, setI, setID, setIdent, setL, show, test, tune
public static final int AST__INTTYPE
public static final int AST__DOUBLETYPE
public static final int AST__STRINGTYPE
public static final int AST__OBJECTTYPE
public static final int AST__BADTYPE
public KeyMap()
AstException
- if an error occurred in the AST librarypublic void mapRemove(String key)
AstException
- if an error occurred in the AST librarypublic int mapSize()
AstException
- if an error occurred in the AST librarypublic int mapLength(String key)
key
- The character string identifying the KeyMap entry. Trailing
spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.AstException
- if an error occurred in the AST librarypublic boolean mapHasKey(String key)
key
- The character string identifying the KeyMap entry. Trailing spaces are
ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.AstException
- if an error occurred in the AST librarypublic String mapKey(int index)
This function is intended primarily as a means of iterating round all the elements in a KeyMap. For this purpose, the number of entries in the KeyMap should first be found using astMapSize and this function should then be called in a loop, with the index value going from zero to one less than the size of the KeyMap. The index associated with a given entry is determined by the SortBy attribute.
index
- The index into the KeyMap. The first entry has index
zero, and the last has index "size-1", where "size" is the value
returned by the astMapSize function.AstException
- if an error occurred in the AST librarypublic int mapType(String key)
key
- The character string identifying the KeyMap entry. Trailing
spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.AstException
- if an error occurred in the AST librarypublic void mapPut0D(String key, double value, String comment)
key
- A character string to be stored with the value, which can later
be used to identify the value. Trailing spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.value
- value to storecomment
- A pointer to a null-terminated comment string to be stored with the
value. A NULL pointer may be supplied, in which case no comment is
stored.AstException
- if an error occurred in the AST librarypublic void mapPut0I(String key, int value, String comment)
key
- A character string to be stored with the value, which can later
be used to identify the value. Trailing spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.value
- value to storecomment
- A pointer to a null-terminated comment string to be stored with the
value. A NULL pointer may be supplied, in which case no comment is
stored.AstException
- if an error occurred in the AST librarypublic void mapPut0C(String key, String value, String comment)
key
- A character string to be stored with the value, which can later
be used to identify the value. Trailing spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.value
- value to storecomment
- A pointer to a null-terminated comment string to be stored with the
value. A NULL pointer may be supplied, in which case no comment is
stored.AstException
- if an error occurred in the AST librarypublic void mapPut0A(String key, AstObject value, String comment)
key
- A character string to be stored with the value, which can later
be used to identify the value. Trailing spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.value
- value to storecomment
- A pointer to a null-terminated comment string to be stored with the
value. A NULL pointer may be supplied, in which case no comment is
stored.AstException
- if an error occurred in the AST librarypublic Double mapGet0D(String key)
key
- The character string identifying the value to be retrieved. Trailing
spaces are ignored. The supplied string is converted to upper
case before use if the KeyCase attribute is currently set to zero.AstException
- if an error occurred in the AST librarypublic Integer mapGet0I(String key)
key
- The character string identifying the value to be retrieved. Trailing
spaces are ignored. The supplied string is converted to upper
case before use if the KeyCase attribute is currently set to zero.AstException
- if an error occurred in the AST librarypublic String mapGet0C(String key)
key
- The character string identifying the value to be retrieved. Trailing
spaces are ignored. The supplied string is converted to upper
case before use if the KeyCase attribute is currently set to zero.AstException
- if an error occurred in the AST librarypublic AstObject mapGet0A(String key)
key
- The character string identifying the value to be retrieved. Trailing
spaces are ignored. The supplied string is converted to upper
case before use if the KeyCase attribute is currently set to zero.AstException
- if an error occurred in the AST librarypublic void mapPut1D(String key, double[] value, String comment)
key
- A character string to be stored with the values, which can later
be used to identify the values. Trailing spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.value
- array to storecomment
- A pointer to a null-terminated comment string to be stored with the
values. A NULL pointer may be supplied, in which case no comment is
stored.AstException
- if an error occurred in the AST librarypublic void mapPut1I(String key, int[] value, String comment)
key
- A character string to be stored with the values, which can later
be used to identify the values. Trailing spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.value
- array to storecomment
- A pointer to a null-terminated comment string to be stored with the
values. A NULL pointer may be supplied, in which case no comment is
stored.AstException
- if an error occurred in the AST librarypublic void mapPut1C(String key, String[] value, String comment)
key
- A character string to be stored with the values, which can later
be used to identify the values. Trailing spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.value
- array to storecomment
- A pointer to a null-terminated comment string to be stored with the
values. A NULL pointer may be supplied, in which case no comment is
stored.AstException
- if an error occurred in the AST librarypublic void mapPut1A(String key, AstObject[] value, String comment)
key
- A character string to be stored with the values, which can later
be used to identify the values. Trailing spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.value
- array to storecomment
- A pointer to a null-terminated comment string to be stored with the
values. A NULL pointer may be supplied, in which case no comment is
stored.AstException
- if an error occurred in the AST librarypublic double[] mapGet1D(String key)
key
- The character string identifying the value to be retrieved. Trailing
spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.key
as a double array, or nullAstException
- if an error occurred in the AST librarypublic int[] mapGet1I(String key)
key
- The character string identifying the value to be retrieved. Trailing
spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.key
as an integer array, or nullAstException
- if an error occurred in the AST librarypublic String[] mapGet1C(String key, int sleng)
key
- The character string identifying the value to be retrieved. Trailing
spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.sleng
- maximum length of any of the strings in the returned array;
any longer strings will be truncatedkey
as a String array, or nullAstException
- if an error occurred in the AST librarypublic AstObject[] mapGet1A(String key)
key
- The character string identifying the value to be retrieved. Trailing
spaces are ignored.
The supplied string is converted to upper case before use if the
KeyCase attribute is currently set to zero.key
as an AstObject array, or nullAstException
- if an error occurred in the AST libraryCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.