|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetkit.graph.Attribute
netkit.graph.AttributeCategorical
public abstract class AttributeCategorical
This class handles attributes that are of type CATEGORICAL. CATEGORICAL types can have values from a fixed set of tokens specified by the tokenSet.
Attributes
,
TokenSet
,
SchemaReader
Field Summary | |
---|---|
protected TokenSet |
tokenSet
|
Constructor Summary | |
---|---|
protected |
AttributeCategorical(java.lang.String name,
TokenSet tokenSet)
The constructor must be provided the name of this attribute and the set of valid categorical token values. |
Method Summary | |
---|---|
java.lang.String |
formatForOutput(double value)
Formats the supplied value from this attribute as a String for output. |
java.lang.String |
getToken(int i)
Gets the i'th token from the list of valid tokens for this categorical attribute; the index is a zero-based array lookup. |
java.lang.String[] |
getTokens()
Gets the tokens valid for this categorical attribute. |
int |
getValue(java.lang.String token)
Gets the numerical value for a particular token; the token must be in the set of valid tokens for this attribute. |
int |
size()
Gets the size of the categorical token list. |
Methods inherited from class netkit.graph.Attribute |
---|
getName, getType, parseAndInsert, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final TokenSet tokenSet
Constructor Detail |
---|
protected AttributeCategorical(java.lang.String name, TokenSet tokenSet)
name
- a String representing the name of this attribute.tokenSet
- a TokenSet representing the valid tokens of
this attribute.Method Detail |
---|
public final java.lang.String[] getTokens()
public final java.lang.String getToken(int i)
i
- the index into the token array to lookup
java.lang.ArrayIndexOutOfBoundsException
- if the parameter is
outside the bounds of the array containing the valid tokens.public final int size()
public final int getValue(java.lang.String token)
token
- the String token to lookup in the token set.
java.lang.RuntimeException
- if the token isn't found.public java.lang.String formatForOutput(double value)
Attribute
formatForOutput
in class Attribute
value
- a double to be converted into an output String.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |