|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--ucb.io.InputItem
Represents a data item having one of several different types. The type() function returns a tag indicating the kind of data currently contained. The toXXX() functions return the represented value as an object of type XXX, if sensible. The set(...) functions change the the value represented (and its type).
Each InputItem bears an integer tag, retrievable by the type() function, that indicates the type of value it currently contains:
FormatReader| Field Summary | |
static int |
CHAR
|
static int |
DOUBLE
|
static int |
FLOAT
|
static int |
INT
|
static int |
LONG
|
static int |
STRING
|
static int |
UNDEFINED
|
| Constructor Summary | |
InputItem()
A new InputItem with an undefined value (type UNDEFINED). |
|
| Method Summary | |
void |
set(char c)
Set the value of this to given value, and set type() to CHAR. |
void |
set(double d)
Set the value of this to given value, and set type() to DOUBLE. |
void |
set(float f)
Set the value of this to given value, and set type() to FLOAT. |
void |
set(int x)
Set the value of this to given value, and set type() to INT. |
void |
set(long x)
Set the value of this to given value, and set type() to LONG. |
void |
set(java.lang.String s,
int type)
Set the value of this to given value, and set type() to given type, either CHAR or STRING. |
char |
toChar()
The value of this InputItem, if it is of type CHAR. |
double |
toDouble()
The value of this InputItem, if it is of type DOUBLE or FLOAT. |
float |
toFloat()
The value of this InputItem, if it is of type FLOAT. |
int |
toInt()
The value of this InputItem, if it is of type INT or CHAR. |
long |
toLong()
The value of this InputItem, if it is of type LONG, INT, or CHAR. |
java.lang.String |
toString()
The value of this InputItem, if it is of type CHAR or STRING. |
int |
type()
The integer tag (UNDEFINED, INT, LONG, FLOAT, DOUBLE, STRING) representing the current value's type. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int UNDEFINED
public static final int INT
public static final int LONG
public static final int FLOAT
public static final int DOUBLE
public static final int STRING
public static final int CHAR
| Constructor Detail |
public InputItem()
| Method Detail |
public int type()
public double toDouble()
throws java.lang.IllegalArgumentException
public float toFloat()
throws java.lang.IllegalArgumentException
public int toInt()
throws java.lang.IllegalArgumentException
public long toLong()
throws java.lang.IllegalArgumentException
public char toChar()
throws java.lang.IllegalArgumentException
public java.lang.String toString()
toString in class java.lang.Objectpublic void set(double d)
public void set(float f)
public void set(int x)
public void set(long x)
public void set(char c)
public void set(java.lang.String s,
int type)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||