Package net.sf.smc

Class Smc


  • public final class Smc
    extends Object
    Main class for the state machine compiler application. This class is responsible for processing the command line arguments, configuring the parser, model and generator packages according to the command line and outputing the results to the user. The actual work is performed by the parser, model and generator packages.
    Author:
    Charles Rapp
    • Method Detail

      • main

        public static void main​(String[] args)
        The state machine compiler main method.
        Parameters:
        args - command line arguments.
      • findTargetLanguage

        public static final Smc.Language findTargetLanguage​(String name)
        Returns the language record associated with the given name. Returns null if name is not associated with any supported target language.
        Parameters:
        name - target language name.
        Returns:
        language record.
      • supportsOption

        public static boolean supportsOption​(String option,
                                             Smc.Language language)
        Returns true if the target language supports the specified option.
        Parameters:
        option - command line option.
        language - check if this language supports option.
        Returns:
        true if the command line option is valid for language.
      • isValidDirectory

        public static boolean isValidDirectory​(String path,
                                               boolean readable,
                                               boolean writable)
        Returns true if path is a valid directory. Valid means that the direct exists and is either readable or writable.
        Parameters:
        path - used to create File instance.
        readable - expected File.canRead() result.
        writable - expected File.canWrite() result.
        Returns:
        true if specified directory meets expected results.
      • isValidAccessLevel

        public static boolean isValidAccessLevel​(String s,
                                                 Smc.Language targetLanguage)
        Returns true if the given string is a valid access level for target language.
        Parameters:
        s - access level string.
        targetLanguage - target language.
        Returns:
        true if s is a valid targetLanguage access level.
      • isValidCast

        public static boolean isValidCast​(String castType)
        Returns true if castType is a valid C++ cast.
        Parameters:
        castType - C++ cast type.
        Returns:
        true if cast type is valid.
      • isValidGraphLevel

        public static boolean isValidGraphLevel​(int glevel)
        Returns true if glevel is a valid graph detail level.
        Parameters:
        glevel - validate this graph detail level.
        Returns:
        true if glevel is valid.
      • getFileName

        public static String getFileName​(String fullName)
        Returns name portion from path/name.sm.
        Parameters:
        fullName - full qualified file name.
        Returns:
        base file name.
      • outputMessages

        public static void outputMessages​(String srcFileName,
                                          PrintStream stream,
                                          List<SmcMessage> messages)
        Writes SMC output messages to the provided stream.
        Parameters:
        srcFileName - SMC target file name.
        stream - write messages to this print stream.
        messages - output these messages.