|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.domain.model.language.Language
public abstract class Language
Serves as the base class for all the classes that provide language-specific details such as the available data types
Constructor Summary | |
---|---|
Language(java.lang.String[] inDataTypes)
|
Method Summary | |
---|---|
java.lang.String[] |
getAllDataTypes()
Returns all the possible data types for the various languages |
java.lang.String |
getCaseHeader(java.lang.String value)
Returns a case statement for the switch |
java.lang.String |
getDefaultDataType()
The data type used for random number generation is an invalid data type has been specified |
java.lang.String |
getDefaultHeader()
Returns the default case of switch |
Equals |
getEqualsOperator()
Returns the Equals operator for this language |
ForLoopModel |
getForLoop(ActivationRecord parent,
HeapModel heap,
java.lang.String template,
int scopeType)
Returns the for loop model for the current language |
java.lang.String |
getIfHeader(java.lang.String condition)
Returns the header of an if statement |
void |
getIntegerTypes(java.util.Vector optionVector)
Returns the possible integer types for the various languages |
abstract int |
getMetaDataType(java.lang.String dataType)
Returns the language-neutral meta data type (integer) corresponding to the language-specific string |
abstract BaseModulus |
getModulusOperator()
Returns the Modulus operator for this language |
NotEquals |
getNotEqualsOperator()
Returns the Equals operator for this language |
int |
getNumDataTypes()
Returns the number of data types in this language |
java.lang.String |
getPrintString(java.lang.String printedValue,
java.lang.String dataType)
Returns the syntax for printing printedValue in the current language |
Program |
getProgram(ActivationRecord parentActivationRecord,
HeapModel heap,
java.lang.String template)
Returns a program object for the given language |
void |
getRealTypes(java.util.Vector optionVector)
Returns the possible real types for the various languages |
void |
getSignedTypes(java.util.Vector optionVector)
Returns the possible signed types for the various languages |
java.lang.String |
getStatementDelimiter()
Returns the delimiter for statements in the language |
java.lang.String |
getSwitchHeader(java.lang.String condition)
Returns the switch statement header |
void |
getUnsignedTypes(java.util.Vector optionVector)
Returns the possible unsigned types for the various languages |
java.lang.String |
getWhileHeader(java.lang.String condition)
Returns the header of a while statement |
boolean |
hasUnsignedType()
Returns whether unsigned data type exists in the language |
abstract boolean |
isIntegerType(java.lang.String dataType)
Returns whether dataType is of integer type in the language |
abstract boolean |
isRealType(java.lang.String dataType)
Returns whether dataType is of real type in the language |
boolean |
isValidDataType(java.lang.String currentDataType)
Returns whether currentDataType is a valid data type for this language |
static void |
main(java.lang.String[] args)
|
boolean |
shouldExplainCoercionInAssignment(int variableMetaDataType,
int valueMetaDataType)
We want to avoid explaining coercion in expressions such as unsigned short x; x = 5; where 5 is automatically treated as CDouble. |
Value |
typeCompatibleAssign(Assignable left,
Value right,
boolean isCompoundOperator)
Returns true if right value can be assigned to the left variable, and false otherwise |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Language(java.lang.String[] inDataTypes)
Method Detail |
---|
public final java.lang.String[] getAllDataTypes()
public int getNumDataTypes()
public void getIntegerTypes(java.util.Vector optionVector)
public void getSignedTypes(java.util.Vector optionVector)
public boolean hasUnsignedType()
public void getUnsignedTypes(java.util.Vector optionVector)
public void getRealTypes(java.util.Vector optionVector)
public boolean isValidDataType(java.lang.String currentDataType)
public abstract boolean isIntegerType(java.lang.String dataType)
dataType
- String which will be checked against integer types for the languagepublic abstract boolean isRealType(java.lang.String dataType)
dataType
- String which will be checked against real types for the languagepublic java.lang.String getDefaultDataType()
public abstract int getMetaDataType(java.lang.String dataType)
public boolean shouldExplainCoercionInAssignment(int variableMetaDataType, int valueMetaDataType)
public Value typeCompatibleAssign(Assignable left, Value right, boolean isCompoundOperator)
left
- Assignable variable/expressionright
- Value assigned to left variable/expression
public Equals getEqualsOperator()
public NotEquals getNotEqualsOperator()
public abstract BaseModulus getModulusOperator()
public java.lang.String getStatementDelimiter()
public java.lang.String getPrintString(java.lang.String printedValue, java.lang.String dataType)
public java.lang.String getSwitchHeader(java.lang.String condition)
public java.lang.String getCaseHeader(java.lang.String value)
public java.lang.String getDefaultHeader()
public java.lang.String getWhileHeader(java.lang.String condition)
public java.lang.String getIfHeader(java.lang.String condition)
public ForLoopModel getForLoop(ActivationRecord parent, HeapModel heap, java.lang.String template, int scopeType)
public Program getProgram(ActivationRecord parentActivationRecord, HeapModel heap, java.lang.String template)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |