|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.topcoder.shared.problem.BaseElement
|
+--com.topcoder.shared.problem.DataValue
A DataValue is a particular parameter or test value; the instance can be used to generate a human-readable encoding, an encoding for a particular programming language, or an actual Java object containing the represented value. In addition, this class supports the ability to parse the human-readable encoding into a new instance.
| Constructor Summary | |
DataValue()
|
|
| Method Summary | |
static java.lang.Object[] |
convertDataValuesToObjects(DataValue[] values,
DataType[] types)
Converts the given datavalues to an object given the corresponding datatype (ie a datatype of "int" would be converted to an java.lang.Integer). |
static java.lang.Object |
convertDataValueToObject(DataValue value,
DataType type)
Converts the given datavalue to an object given the datatype (ie a datatype of "int" would be converted to an java.lang.Integer). |
static DataValue[] |
convertObjectsToDataValues(java.lang.Object[] objs,
DataType[] types)
Converts the given objects to a DataValue given the corresponding datatypes (ie a object of "Integer" would be converted to an IntegralValue). |
static DataValue |
convertObjectToDataValue(java.lang.Object obj,
DataType type)
Converts the given object to an DataValue given the corresponding datatype (ie a object of "Integer" would be converted to an IntegralValue). |
abstract java.lang.String |
encode()
Encodes the given data value. |
static java.lang.String |
encodeHTML(java.lang.String text)
Utility function for encoding HTML entities in text. |
ElementRenderer |
getRenderer()
Returns this elements renderer. |
abstract java.lang.Object |
getValue()
Returns the value as an object. |
abstract void |
parse(DataValueReader reader,
DataType type)
Parses a data from a reader given the specific datatype. |
static DataValue[] |
parseSequence(DataValueReader reader,
DataType[] type)
Parses data from a reader using the corresponding DataTypes into it's object representation (ie Integer, String, int[], etc). |
static DataValue[] |
parseSequence(java.lang.String text,
DataType[] type)
Parses the text (which has multiple values embedded) using the corresponding DataType into it's object representation (ie Integer, String, int[], etc). |
static DataValue |
parseValue(DataValueReader reader,
DataType type)
Parses data from a reader given the specific datatype. |
static DataValue |
parseValue(java.lang.String text,
DataType type)
Parses data from the text given the specific datatype. |
static DataValue[] |
parseValues(java.lang.String[] values,
DataType[] types)
Parses values from an array of strings given the corresponding array of types. |
static java.lang.Object[] |
parseValuesToObjects(java.lang.String[] values,
DataType[] types)
Parses the specified array of values using the corresponding DataType into it's object. |
static java.lang.Object |
parseValueToObject(java.lang.String text,
DataType type)
Parses the specified text using the specified DataType into it's object. |
void |
setRenderer(ElementRenderer renderer)
Sets the renderer for this element. |
java.lang.String |
toXML()
Returns the XML representation of the value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.topcoder.shared.problem.Element |
customReadObject, customWriteObject, getRenderer, setRenderer |
| Constructor Detail |
public DataValue()
| Method Detail |
public abstract void parse(DataValueReader reader,
DataType type)
throws java.io.IOException,
DataValueParseException
reader - the reader to read from.type - the datatype used to parse with.
java.io.IOException - if an exception occurred during reading.
DataValueParseException - if a parsing exception occurs.DataValueReader,
DataTypepublic abstract java.lang.String encode()
public abstract java.lang.Object getValue()
public java.lang.String toXML()
toXML in interface Element
public static DataValue parseValue(java.lang.String text,
DataType type)
throws java.io.IOException,
DataValueParseException
text - the text of the raw data values.type - the datatype used to parse with.
java.io.IOException - if an exception occurred during reading.
DataValueParseException - if a parsing exception occurs.DataType
public static DataValue parseValue(DataValueReader reader,
DataType type)
throws java.io.IOException,
DataValueParseException
type - the datatype used to parse with.
java.io.IOException - if an exception occurred during reading.
DataValueParseException - if a parsing exception occurs.DataType,
DataValueReader
public static DataValue[] parseValues(java.lang.String[] values,
DataType[] types)
throws java.io.IOException,
DataValueParseException
values - the values to parse.types - the types corresponding to the values.
java.io.IOException - if an exception occurred during reading.
DataValueParseException - if a parsing exception occurs.DataType
public static java.lang.Object parseValueToObject(java.lang.String text,
DataType type)
throws java.io.IOException,
DataValueParseException
text - the text of the value.type - the datatype used to parse the text.
java.io.IOException - if an exception occurred during reading.
DataValueParseException - if a parsing exception occurs.DataType
public static java.lang.Object[] parseValuesToObjects(java.lang.String[] values,
DataType[] types)
throws java.io.IOException,
DataValueParseException
values - the values.types - the corresponding datatype used to parse the value.
java.io.IOException - if an exception occurred during reading.
DataValueParseException - if a parsing exception occurs.DataType
public static DataValue[] parseSequence(java.lang.String text,
DataType[] type)
throws java.io.IOException,
DataValueParseException
text - the text containing multiple values.
java.io.IOException - if an exception occurred during reading.
DataValueParseException - if a parsing exception occurs.DataType
public static DataValue[] parseSequence(DataValueReader reader,
DataType[] type)
throws java.io.IOException,
DataValueParseException
reader - the reader of the data.
java.io.IOException - if an exception occurred during reading.
DataValueParseException - if a parsing exception occurs.DataType
public static java.lang.Object convertDataValueToObject(DataValue value,
DataType type)
throws DataValueParseException
value - the value of the data.type - the type fo the data.
DataValueParseException - if a parsing exception occurs.DataType,
DataValue
public static java.lang.Object[] convertDataValuesToObjects(DataValue[] values,
DataType[] types)
throws DataValueParseException
values - the values.
DataValueParseException - if a parsing exception occurs.DataType,
DataValue
public static DataValue convertObjectToDataValue(java.lang.Object obj,
DataType type)
throws DataValueParseException
obj - the object to convert.type - the datatype of the object.
DataValueParseException - if a parsing exception occurs.DataType,
DataValue
public static DataValue[] convertObjectsToDataValues(java.lang.Object[] objs,
DataType[] types)
throws DataValueParseException
DataValueParseException - if a parsing exception occurs.DataType,
DataValuepublic void setRenderer(ElementRenderer renderer)
setRenderer in interface Elementrenderer - the element renderer.ElementRendererpublic ElementRenderer getRenderer()
getRenderer in interface ElementElementRendererpublic static java.lang.String encodeHTML(java.lang.String text)
text - the text to encode.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||