kawigi.problem
Class ClassDecl

java.lang.Object
  extended by kawigi.problem.ClassDecl

public class ClassDecl
extends java.lang.Object

This class represents the code side of a problem statement. This means it has the class name, the information the method you are required to write, and a list of example tests. This serves many of the same purposes that TopCoder's ProblemComponent does, and most of the data from a ProblemComponent is converted into one of these objects for KawigiEdit's use. The reason I don't just use the ProblemComponent instead of having this class is so that I can have this class independent of TopCoder's classes and use it in stadalone mode. Then, assuming I can properly parse a problem statement (which I can't all the time, it's on the list), I can generate code the exact same way I would in plugin mode, and standalone won't suffer from having re-implemented code generation (it will just suffer from inadequate problem parsing).


Constructor Summary
ClassDecl(java.lang.String className, MethodDecl method)
          Constructs a new ClassDecl with the given name and method.
 
Method Summary
 void addTest(Test t)
          Adds this test to the list of tests for this problem.
 int countTests()
          Returns the current number of tests for this problem.
 java.lang.String evaluateTag(java.lang.String tag, EditorLanguage language)
          Evaluates a KawigiEdit tag from a template.
 MethodDecl getMethod()
          Returns the method declaration that needs to be implemented in this class.
 java.lang.String getName()
          Returns the name of this class.
 Test getTest(int index)
          Returns the test case at the given index.
 void removeAllTests()
          Deletes all test cases.
 void removeTest(int index)
          Deletes the test case at the given index.
 void setTest(int index, Test t)
          Changes the test case at the given index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassDecl

public ClassDecl(java.lang.String className,
                 MethodDecl method)
Constructs a new ClassDecl with the given name and method.

Method Detail

addTest

public void addTest(Test t)
Adds this test to the list of tests for this problem.


getName

public java.lang.String getName()
Returns the name of this class.


getMethod

public MethodDecl getMethod()
Returns the method declaration that needs to be implemented in this class.


countTests

public int countTests()
Returns the current number of tests for this problem.


getTest

public Test getTest(int index)
Returns the test case at the given index.


setTest

public void setTest(int index,
                    Test t)
Changes the test case at the given index.


removeTest

public void removeTest(int index)
Deletes the test case at the given index.


removeAllTests

public void removeAllTests()
Deletes all test cases.


evaluateTag

public java.lang.String evaluateTag(java.lang.String tag,
                                    EditorLanguage language)
Evaluates a KawigiEdit tag from a template. Certain tags aren't handled here because they shouldn't be expanded yet in the code edited by the user (for instance, the testing-code tag is left alone here, because it isn't evaluated until either TopCoder asks for your code or your code gets saved locally.