kawigi.language
Class ExtendedJavaLanguage

java.lang.Object
  |
  +--kawigi.language.LanguageContainer
        |
        +--kawigi.language.ExtendedJavaLanguage
All Implemented Interfaces:
java.lang.Cloneable, com.topcoder.shared.netCommon.CustomSerializable, ExtendedLanguage, com.topcoder.shared.language.Language, java.io.Serializable, Templatable

public class ExtendedJavaLanguage
extends LanguageContainer
implements Templatable

See Also:
Serialized Form

Field Summary
protected  int caret
          Used to set the caret location in the code template.
static kawigi.language.ExtendedJavaLanguage EXTENDED_JAVA_LANGUAGE
          A singleton instance of the extended Java language.
 
Fields inherited from class kawigi.language.LanguageContainer
baselang
 
Constructor Summary
ExtendedJavaLanguage()
          Creates a new instance of the ExtendedLanguage that uses TC's singleton VB language instance.
ExtendedJavaLanguage(com.topcoder.shared.language.Language lang)
          Creates a new instance of the ExtendedLanguage that uses settings from the given TC Language.
 
Method Summary
protected  java.lang.String generateTestingCode(com.topcoder.shared.problem.ProblemComponent comp, com.topcoder.shared.language.Language lang)
          Returns the testing code for the problem statement's default testing cases.
 java.lang.String getCompileCommand(com.topcoder.shared.problem.ProblemComponent comp)
          Returns the command that should be used to compile the file.
 java.lang.String getDefaultTemplateCode()
          Returns the text of a default template.
 java.lang.String getFileName(com.topcoder.shared.problem.ProblemComponent comp)
          Returns the filename that the source file should be saved as.
 kawigi.template.TagLibrary getNativeTagLibrary()
          Returns a library of tags that may come in useful for writing templates extending this class.
 java.lang.String getRunCommand(com.topcoder.shared.problem.ProblemComponent comp, java.io.File cwd)
          Returns the command that should be used to run the program and test cases.
 kawigi.language.Skeleton getSkeleton(com.topcoder.shared.problem.ProblemComponent comp)
          Returns at a class and method declaration, with a main method that has testing code.
 kawigi.template.Template getTemplate()
          Returns the KTT template representing how this class is templated.
 java.lang.String getTemplateCode(com.topcoder.shared.problem.ProblemComponent comp, com.topcoder.shared.language.Language lang)
          The templatable method for the Java template
 java.lang.Class getViewClass()
          Returns the class of the Java implementation of a View
protected  java.lang.String makeParamList(com.topcoder.shared.problem.DataType[] types, java.lang.String[] names)
          Returns a string in the format , , etc.
protected  java.lang.String toJavaTest(com.topcoder.shared.problem.TestCase test, com.topcoder.shared.problem.DataType[] types, java.lang.String start)
          Quick utility function to provide the code that should return the answer.
protected static java.lang.String translateObject(java.lang.String type, java.lang.String value)
          Quck utility function to convert a value to code that creates that value in Java.
 
Methods inherited from class kawigi.language.LanguageContainer
customReadObject, customWriteObject, equals, getBaseLanguage, getId, getMethodSignature, getName, getPropertyClass
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENDED_JAVA_LANGUAGE

public static final kawigi.language.ExtendedJavaLanguage EXTENDED_JAVA_LANGUAGE
A singleton instance of the extended Java language.


caret

protected int caret
Used to set the caret location in the code template.

Constructor Detail

ExtendedJavaLanguage

public ExtendedJavaLanguage(com.topcoder.shared.language.Language lang)
Creates a new instance of the ExtendedLanguage that uses settings from the given TC Language. This object will behave strangely if lang is not a VBLanguage instance.


ExtendedJavaLanguage

public ExtendedJavaLanguage()
Creates a new instance of the ExtendedLanguage that uses TC's singleton VB language instance.

Method Detail

getSkeleton

public kawigi.language.Skeleton getSkeleton(com.topcoder.shared.problem.ProblemComponent comp)
Returns at a class and method declaration, with a main method that has testing code.

Specified by:
getSkeleton in interface ExtendedLanguage

getTemplateCode

public java.lang.String getTemplateCode(com.topcoder.shared.problem.ProblemComponent comp,
                                        com.topcoder.shared.language.Language lang)
The templatable method for the Java template


generateTestingCode

protected java.lang.String generateTestingCode(com.topcoder.shared.problem.ProblemComponent comp,
                                               com.topcoder.shared.language.Language lang)
Returns the testing code for the problem statement's default testing cases.


toJavaTest

protected java.lang.String toJavaTest(com.topcoder.shared.problem.TestCase test,
                                      com.topcoder.shared.problem.DataType[] types,
                                      java.lang.String start)
Quick utility function to provide the code that should return the answer.


translateObject

protected static java.lang.String translateObject(java.lang.String type,
                                                  java.lang.String value)
Quck utility function to convert a value to code that creates that value in Java.


makeParamList

protected java.lang.String makeParamList(com.topcoder.shared.problem.DataType[] types,
                                         java.lang.String[] names)
Returns a string in the format , , etc.


getCompileCommand

public java.lang.String getCompileCommand(com.topcoder.shared.problem.ProblemComponent comp)
Returns the command that should be used to compile the file. Ideally, this won't be platform-specific, but realistically, some people use different compilers than others completely. It may be possible at some point to allow this to be configured.

Specified by:
getCompileCommand in interface ExtendedLanguage

getRunCommand

public java.lang.String getRunCommand(com.topcoder.shared.problem.ProblemComponent comp,
                                      java.io.File cwd)
Returns the command that should be used to run the program and test cases. Again, some care will need to be taken to make this part platform-happy.

Specified by:
getRunCommand in interface ExtendedLanguage

getFileName

public java.lang.String getFileName(com.topcoder.shared.problem.ProblemComponent comp)
Returns the filename that the source file should be saved as. You may assume that this is the actual filename used when creating the compile and run commands.

Specified by:
getFileName in interface ExtendedLanguage

getViewClass

public java.lang.Class getViewClass()
Returns the class of the Java implementation of a View

Specified by:
getViewClass in interface ExtendedLanguage

getTemplate

public kawigi.template.Template getTemplate()
Returns the KTT template representing how this class is templated.

Specified by:
getTemplate in interface Templatable

getNativeTagLibrary

public kawigi.template.TagLibrary getNativeTagLibrary()
Returns a library of tags that may come in useful for writing templates extending this class.

Specified by:
getNativeTagLibrary in interface Templatable

getDefaultTemplateCode

public java.lang.String getDefaultTemplateCode()
Returns the text of a default template.

Specified by:
getDefaultTemplateCode in interface Templatable