com.topcoder.shared.problem
Class ArrayValue

java.lang.Object
  |
  +--com.topcoder.shared.problem.BaseElement
        |
        +--com.topcoder.shared.problem.DataValue
              |
              +--com.topcoder.shared.problem.ArrayValue
All Implemented Interfaces:
java.lang.Cloneable, com.topcoder.shared.netCommon.CustomSerializable, Element, java.io.Serializable

public class ArrayValue
extends DataValue

Implementation of DataValue that holds an array of values.

See Also:
Serialized Form

Constructor Summary
ArrayValue()
          Empty constructor required by custom serialization.
ArrayValue(java.util.ArrayList values)
          Constructs the array from a list of values.
ArrayValue(DataValueReader reader, DataType type)
          Constructs the array from a reader using a specific datatype to parse.
 
Method Summary
 void customReadObject(com.topcoder.shared.netCommon.CSReader reader)
          Custom Serialization
 void customWriteObject(com.topcoder.shared.netCommon.CSWriter writer)
          Custom Serialization
 java.lang.String encode()
          Encode the array into a user readable string.
 java.lang.Object getValue()
          Returns the array (essentially values.toArray()).
 void parse(DataValueReader reader, DataType type)
          Parses the information in the DataValueReader using the a specified DataType to parse each value.
 
Methods inherited from class com.topcoder.shared.problem.DataValue
convertDataValuesToObjects, convertDataValueToObject, convertObjectsToDataValues, convertObjectToDataValue, encodeHTML, getRenderer, parseSequence, parseSequence, parseValue, parseValue, parseValues, parseValuesToObjects, parseValueToObject, setRenderer, toXML
 
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
getRenderer, setRenderer
 

Constructor Detail

ArrayValue

public ArrayValue()
Empty constructor required by custom serialization.


ArrayValue

public ArrayValue(java.util.ArrayList values)
Constructs the array from a list of values.

Parameters:
values - the values to use.

ArrayValue

public ArrayValue(DataValueReader reader,
                  DataType type)
           throws java.io.IOException,
                  DataValueParseException
Constructs the array from a reader using a specific datatype to parse.

Parameters:
reader - the reader of the unparsed data.
type - the datatype used to parse data with.
See Also:
parse(DataValueReader, DataType)
Method Detail

parse

public void parse(DataValueReader reader,
                  DataType type)
           throws java.io.IOException,
                  DataValueParseException
Parses the information in the DataValueReader using the a specified DataType to parse each value.

Specified by:
parse in class DataValue
Parameters:
reader - the reader of the unparsed data.
type - the datatype used to parse data with.
Throws:
DataValueParseException - if a parsing exception occurs.
java.io.IOException - if an exception occurred during reading.
See Also:
DataType, DataValueReader

customWriteObject

public void customWriteObject(com.topcoder.shared.netCommon.CSWriter writer)
                       throws java.io.IOException
Custom Serialization

Parameters:
writer - the writer to write to.
Throws:
java.io.IOException - if an I/O error has occurred in the stream that backs the writer.

customReadObject

public void customReadObject(com.topcoder.shared.netCommon.CSReader reader)
                      throws java.io.IOException,
                             java.io.ObjectStreamException
Custom Serialization

Parameters:
reader - the reader to read from.
Throws:
java.io.ObjectStreamException - if the information that is read is inconsistent (stream corrupted or incompatibility between writers and readers)
java.io.IOException - if an I/O error has occurred in the stream that backs the reader.

encode

public java.lang.String encode()
Encode the array into a user readable string. This will return a string like: "{ value, value, ... }" where each value has been encoded via the value's encode method. Note: "{ }" will be returned on empty arrays

Specified by:
encode in class DataValue
Returns:
a user readable string representation of the array.

getValue

public java.lang.Object getValue()
Returns the array (essentially values.toArray()).

Specified by:
getValue in class DataValue
Returns:
the array.