|
||||||||||
| 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.ProblemComponent
This class fully represents a problem statement. This consists of the following elements:
ProblemComponentFactory. This class
also provides a method to convert to its language-independent XML representation.
The class also provides methods for obtaining and modifying specific elements.
com.topcoder.shared.problemParser.ProblemComponentFactory,
Element,
BaseElement,
DataType,
Language,
Serialized Form| Constructor Summary | |
ProblemComponent()
Empty constructor required by custom serialization |
|
ProblemComponent(boolean unsafe)
A problem statement must be constructed with a set of known data types, the XML it was originally parsed from, and a flag specifying whether this instance is an 'unsafe' version. |
|
| Method Summary | |
void |
addMessage(ProblemMessage message)
Append a ProblemMessage to the list of messages. |
void |
clearMessages()
Clears the list of problem messages. |
void |
customReadObject(com.topcoder.shared.netCommon.CSReader reader)
Custom serialization |
void |
customWriteObject(com.topcoder.shared.netCommon.CSWriter writer)
Custom serialization |
static java.lang.String |
decodeXML(java.lang.String text)
Undoes the encoding scheme in encodeXML. |
static java.lang.String |
encodeHTML(java.lang.String text)
Utility function for encoding HTML entities in text. |
static java.lang.String |
encodeXML(java.lang.String text)
Utility function for encoding "special" xml characters, or characters not allowing xml to properly parse. |
java.util.ArrayList |
getArgs()
Deprecated. for old stuff, just gets array list of java types. |
java.lang.String |
getCacheKey()
Get's the cache key for this component |
static java.lang.String |
getCacheKey(int componentID)
Get's the cache key for supplied component id |
java.lang.String |
getClassName()
Get's the name of the class that should be defined in solutions to this problem. |
int |
getComponentId()
Get's the component id |
int |
getComponentTypeID()
Get's the component type id |
Constraint[] |
getConstraints()
Get's the list of constraints. |
java.lang.String |
getDefaultSolution()
Get's the default solution |
Element |
getIntro()
The 'intro' is the required introductory text for a problem statement (shown before the signature). |
java.util.ArrayList |
getMessages()
Get's the list of ProblemMessages generated by the parsing process. |
java.lang.String |
getMethodName()
Get's the name of the method that should be defined in solutions to this problem. |
Element[] |
getNotes()
Get's the list of notes. |
java.lang.String[] |
getParamNames()
Get's the names of the arguments to the method that should be defined in solutions to this problem. |
DataType[] |
getParamTypes()
Get's the data type of all of the arguments to the method that should be defined in solutions to this problem. |
int |
getProblemId()
Get's the problem id that this component is associated with |
ElementRenderer |
getRenderer()
Returns this elements renderer. |
java.lang.String |
getResultType()
Deprecated. |
DataType |
getReturnType()
Get's the return type of the method that should be defined in solutions to this problem. |
java.lang.String |
getReturnType(int language)
Get's the string representation of the return type for the required method for this component for the specified language |
Element |
getSpec()
The 'spec' is the optional text following the signature, typically giving more technical information about the problem. |
TestCase[] |
getTestCases()
Get's the list of test cases. |
static java.lang.String |
handleTextElement(java.lang.String name,
Element elem)
Helper method to format an element between an opening/closing html tag |
boolean |
isUnsafe()
If a problem component is unsafe, then it should not have all the system test cases, only those that are marked as examples. |
boolean |
isValid()
A problem statement is valid if it was successfully parsed without errors. |
static void |
main(java.lang.String[] args)
Main method to test out the encodeXML/decodeXML function |
void |
setClassName(java.lang.String className)
Set's the name of the class that should be defined in solutions to this problem. |
void |
setComponentId(int componentId)
Set's the component id |
void |
setComponentTypeID(int componentTypeID)
Set's the component type id |
void |
setConstraints(Constraint[] constraints)
Set's the list of constraints. |
void |
setDefaultSolution(java.lang.String solution)
Set's the default solution |
void |
setIntro(Element intro)
Updates the 'intro' element. |
void |
setMessages(java.util.ArrayList messages)
Set's the list of ProblemMessages generated by the parsing process. |
void |
setMethodName(java.lang.String methodName)
Set's the name of the method that should be defined in solutions to this problem. |
void |
setNotes(Element[] notes)
Set's the list of notes. |
void |
setParamNames(java.lang.String[] paramNames)
Set's the names of the arguments to the method that should be defined in solutions to this problem. |
void |
setParamTypes(DataType[] paramTypes)
Set's the data type of all of the arguments to the method that should be defined in solutions to this problem. |
void |
setProblemId(int problemId)
Set's the problem id that this component is associated with |
void |
setRenderer(ElementRenderer renderer)
Sets the renderer for this element. |
void |
setReturnType(DataType returnType)
Set's the return type of the method that should be defined in solutions to this problem. |
void |
setSpec(Element spec)
Updates the 'spec' element. |
void |
setTestCases(TestCase[] testCases)
Set's the list of test cases. |
void |
setUnsafe(boolean unsafe)
If a problem component is unsafe, then it should not have all the system test cases, only those that are marked as examples. |
void |
setValid(boolean valid)
Set's the validity of the problem statement |
java.lang.String |
toString()
Returns the string representation of this object |
java.lang.String |
toXML()
Get's an XML representation for this component |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.topcoder.shared.problem.Element |
getRenderer, setRenderer |
| Constructor Detail |
public ProblemComponent()
public ProblemComponent(boolean unsafe)
unsafe - If true, specifies that the problem statement contains
sensitive information that should be available only to MPSQAS| Method Detail |
public static java.lang.String encodeXML(java.lang.String text)
public static java.lang.String decodeXML(java.lang.String text)
text - the text to decode
public void customWriteObject(com.topcoder.shared.netCommon.CSWriter writer)
throws java.io.IOException
customWriteObject in interface Elementwriter - the writer to write to.
java.io.IOException - if an I/O error has occurred in the stream that backs the writer.
public void customReadObject(com.topcoder.shared.netCommon.CSReader reader)
throws java.io.IOException
customReadObject in interface Elementreader - the reader to read from.
java.io.IOException - if an I/O error has occurred in the stream that backs the reader.public boolean isUnsafe()
public void setUnsafe(boolean unsafe)
unsafe - whether the component is unsafe or notpublic boolean isValid()
public void setValid(boolean valid)
valid - whether the problem statement was parsed without errorspublic java.util.ArrayList getMessages()
ProblemMessages generated by the parsing process.
ArrayList of ProblemMessagesProblemMessagepublic void setMessages(java.util.ArrayList messages)
ProblemMessages generated by the parsing process.
messages - the list of ProblemMessages generated by the parsing process.ProblemMessagepublic void clearMessages()
public void addMessage(ProblemMessage message)
ProblemMessage to the list of messages.
message - the message to addProblemMessagepublic Element getIntro()
Elementpublic void setIntro(Element intro)
intro - the introductory textgetIntro(),
Elementpublic Element getSpec()
Elementpublic void setSpec(Element spec)
spec - the specification textgetSpec(),
Elementpublic java.lang.String getClassName()
public void setClassName(java.lang.String className)
className - the class namepublic java.lang.String getMethodName()
public void setMethodName(java.lang.String methodName)
methodName - the name of the methodpublic DataType getReturnType()
DataTypepublic void setReturnType(DataType returnType)
returnType - the return type for the methodDataType,
getReturnType()public DataType[] getParamTypes()
DataTypes, where the first value is the type of the first argument,
the second value is the type of the second argument, and so onDataTypepublic void setParamTypes(DataType[] paramTypes)
paramTypes - An array of DataTypes, where the first value is the type of the first argument,
the second value is the type of the second argument, and so onDataType,
getParamTypes()public java.lang.String[] getParamNames()
Strings, where the first value is the name of the first argument,
the second value is the name of the second argument, and so onpublic void setParamNames(java.lang.String[] paramNames)
paramNames - An array of Strings, where the first value is the name of the first argument,
the second value is the name of the second argument, and so ongetParamNames()public Element[] getNotes()
Elements, each Element representing a noteElementpublic void setNotes(Element[] notes)
notes - An array of Elements, each Element representing a noteElementpublic Constraint[] getConstraints()
Constraints, each Constraint representing a constraintConstraintpublic void setConstraints(Constraint[] constraints)
constraints - An array of Constraints, each Constraint representing a constraintConstraintpublic TestCase[] getTestCases()
TestCasepublic void setTestCases(TestCase[] testCases)
testCases - the list of test cases
public static java.lang.String handleTextElement(java.lang.String name,
Element elem)
name - name of the html tag (unformatted)elem - the element
public java.lang.String toXML()
toXML in interface Elementpublic java.lang.String toString()
toString in class java.lang.Objectpublic int getComponentTypeID()
public void setComponentTypeID(int componentTypeID)
componentTypeID - the component type idpublic final void setComponentId(int componentId)
componentId - the unique component idpublic final void setDefaultSolution(java.lang.String solution)
solution - the default solutionpublic final int getComponentId()
public final java.lang.String getDefaultSolution()
public int getProblemId()
public void setProblemId(int problemId)
problemId - the unique problem identifierpublic static java.lang.String getCacheKey(int componentID)
componentID - the component id
public final java.lang.String getCacheKey()
public java.lang.String getReturnType(int language)
language - the languageID
public java.lang.String getResultType()
public java.util.ArrayList getArgs()
public static void main(java.lang.String[] args)
args - the first element will be encoded and decoded
public 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 | |||||||||