com.topcoder.shared.problem
Class ValidValuesConstraint

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

public class ValidValuesConstraint
extends Constraint

The ValidValuesConstraint is a constraint containing information as to the valid values of a parameter. This class is not currently in use but reserved for future use.

Author:
mitalub
See Also:
Serialized Form

Field Summary
protected  int dimension
          The name of the dimension this constraint refers to.
protected  java.lang.String paramName
          The name of the parameter.
protected  java.util.ArrayList validValues
          An ArrayList where each element is an instance of Value or Range, and the valid elements are those elements in any one of the Ranges or Values.
 
Constructor Summary
ValidValuesConstraint()
          Empty constructor required by custom serialization.
ValidValuesConstraint(java.util.ArrayList validValues, int dimension, java.lang.String paramName)
           
 
Method Summary
 void customReadObject(com.topcoder.shared.netCommon.CSReader reader)
          Custom serialization
 void customWriteObject(com.topcoder.shared.netCommon.CSWriter writer)
          Custom serialization
 int getDimension()
          Returns the dimension this constraint refers to.
 java.lang.String getParamName()
          Returns the parameter name.
 java.util.ArrayList getValidValues()
          Returns an ArrayList where each element is an instance of Value or Range, and the valid elements are those elements in any one of the Ranges or Values.
 java.lang.String toXML()
          Returns the constraint as XML.
 
Methods inherited from class com.topcoder.shared.problem.Constraint
encodeHTML, getRenderer, setRenderer
 
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
 

Field Detail

validValues

protected java.util.ArrayList validValues
An ArrayList where each element is an instance of Value or Range, and the valid elements are those elements in any one of the Ranges or Values.


paramName

protected java.lang.String paramName
The name of the parameter.


dimension

protected int dimension
The name of the dimension this constraint refers to.

Constructor Detail

ValidValuesConstraint

public ValidValuesConstraint(java.util.ArrayList validValues,
                             int dimension,
                             java.lang.String paramName)
Parameters:
validValues - An ArrayList where each element is an instance of Value or Range, and the valid elements are those elements in any one of the Ranges or Values.
paramName - The name of the parameter.
dimension - The dimension this constraint refers to.

ValidValuesConstraint

public ValidValuesConstraint()
Empty constructor required by custom serialization.

Method Detail

getValidValues

public java.util.ArrayList getValidValues()
Returns an ArrayList where each element is an instance of Value or Range, and the valid elements are those elements in any one of the Ranges or Values.

Returns:
the arraylist of Range/Value.
See Also:
Value, Range

getDimension

public int getDimension()
Returns the dimension this constraint refers to.

Returns:
the dimension this constraint refers to.

getParamName

public java.lang.String getParamName()
Returns the parameter name.

Returns:
the parameter name.

customWriteObject

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

Specified by:
customWriteObject in interface Element
Overrides:
customWriteObject in class Constraint
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

Specified by:
customReadObject in interface Element
Overrides:
customReadObject in class Constraint
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.

toXML

public java.lang.String toXML()
Returns the constraint as XML. Formated as <valid-values>XML of each value</valid-values>.

Returns:
the XML representation of this constraint.