Package net.sf.smc
Class Smc.Language
- java.lang.Object
-
- net.sf.smc.Smc.Language
-
- Enclosing class:
- Smc
public static final class Smc.Language extends Object
This class explicitly stores each target language's properties:- the start of the command line option,
- the language's full name,
-
the language's
SmcCodeGeneratorsubclass, and -
whether the language also generates a header file and
the header fill
SmcCodeGeneratorsubclass.
The reason the above information is stored in this class and not in the
TargetLanguageenum is due to the code generator classes. If these classes were stored inTargetLanguage, this would create a circular dependency between the model and generator modules.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Returnstrueifois aLanguageinstance referencing the sameTargetLanguage.SmcCodeGeneratorgenerator(SmcOptions options)Returns an instance of the source code generator.inthashCode()Returns theTargetLanguageordinal value as the hash code.booleanhasHeaderFile()Returnstrueif this language uses header files.SmcCodeGeneratorheaderGenerator(SmcOptions options)Returns an instance of the header code generator.TargetLanguagelanguage()Returns the associatedTargetLanguage.Stringname()Returns the full language name.StringoptionFlag()Returns the command line option string for this language.StringtoString()Returns the full language name.
-
-
-
Constructor Detail
-
Language
public Language(TargetLanguage language, String optionFlag, String name, Class generator, Class headerGenerator)
Creates a new language instance for the given properties.- Parameters:
language- the target language enum value.optionFlag- command line option flag for this language.name- language print name.generator- code generator class.headerGenerator- header code generator class.
-
-
Method Detail
-
equals
public boolean equals(Object o)
Returnstrueifois aLanguageinstance referencing the sameTargetLanguage.
-
hashCode
public int hashCode()
Returns theTargetLanguageordinal value as the hash code.
-
toString
public String toString()
Returns the full language name.
-
language
public TargetLanguage language()
Returns the associatedTargetLanguage.- Returns:
TargetLanguage.
-
optionFlag
public String optionFlag()
Returns the command line option string for this language.- Returns:
- language command line option.
-
name
public String name()
Returns the full language name.- Returns:
- print name.
-
generator
public SmcCodeGenerator generator(SmcOptions options)
Returns an instance of the source code generator.- Parameters:
options- SMC command line options.- Returns:
- source code generator instance.
-
hasHeaderFile
public boolean hasHeaderFile()
Returnstrueif this language uses header files.- Returns:
trueif language has headers.
-
headerGenerator
public SmcCodeGenerator headerGenerator(SmcOptions options)
Returns an instance of the header code generator.- Parameters:
options- SMC command line options.- Returns:
- header code generator instance.
-
-