Package net.sf.smc

Class 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 SmcCodeGenerator subclass, and
    • whether the language also generates a header file and the header fill SmcCodeGenerator subclass.

    The reason the above information is stored in this class and not in the TargetLanguage enum is due to the code generator classes. If these classes were stored in TargetLanguage, this would create a circular dependency between the model and generator modules.

    • 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)
        Returns true if o is a Language instance referencing the same TargetLanguage.
        Overrides:
        equals in class Object
        Parameters:
        o - check equality with this Language instance.
        Returns:
        true if o is for the same TargetLanguage as this instance.
      • hashCode

        public int hashCode()
        Returns the TargetLanguage ordinal value as the hash code.
        Overrides:
        hashCode in class Object
        Returns:
        unique hash code for this Language.
      • toString

        public String toString()
        Returns the full language name.
        Overrides:
        toString in class Object
        Returns:
        print name.
      • language

        public TargetLanguage language()
        Returns the associated TargetLanguage.
        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()
        Returns true if this language uses header files.
        Returns:
        true if 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.