Class Input

  • All Implemented Interfaces:
    InputInterface

    public class Input
    extends java.lang.Object
    implements InputInterface
    Input file will be invoked using command line arguments. args[0] is reserved for the number of suggestions the user wants to print. args[1] is an optional input to load a properties file, if no properties file is loaded, it will set to default properties. args[i] i will be any number of files supplied in the command line.
    • Method Detail

      • setTokens

        public void setTokens()
        Generates the token list.
        Specified by:
        setTokens in interface InputInterface
      • getFiles

        public java.util.List<java.io.File> getFiles()
        Specified by:
        getFiles in interface InputInterface
        Returns:
        the list of all files that input received as arguments.
      • getTokens

        public java.util.List<? extends TokenInterface> getTokens()
        Specified by:
        getTokens in interface InputInterface
        Returns:
        the list of tokens produced using the argument files.
      • getNSuggestions

        public int getNSuggestions()
        Specified by:
        getNSuggestions in interface InputInterface
        Returns:
        the number of suggestions for Output to print back to the user.
      • getTokenCountForFiles

        public java.util.Dictionary<java.io.File,​java.lang.Integer> getTokenCountForFiles()
        Key: a File object Value: an Integer object reprsenting the total tokens in that File.
        Specified by:
        getTokenCountForFiles in interface InputInterface
        Returns:
        a dictionary containing each file and the count of tokens in that file.
      • getTokenCountForFile

        public int getTokenCountForFile​(java.io.File file)
        Specified by:
        getTokenCountForFile in interface InputInterface
        Parameters:
        file - any of a list of files that was passed to input as an argument.
        Returns:
        the number of tokens present in that file.
      • getfileExtensions

        public java.util.List<java.lang.String> getfileExtensions()
        Specified by:
        getfileExtensions in interface InputInterface
        Returns:
        a list of strings representing the file extensions to be analyzed by the program.
      • getMinSequenceLength

        public int getMinSequenceLength()
        Specified by:
        getMinSequenceLength in interface InputInterface
        Returns:
        Minimum sequence length of token to be refactored.
      • getMaxSubstitutions

        public int getMaxSubstitutions()
        Specified by:
        getMaxSubstitutions in interface InputInterface
        Returns:
        Max number of lexeme substitutions defined in the properties.ini file.
      • setFileExtensions

        public void setFileExtensions()
        Sets file extension to default. Default: [".h,.cpp"]
        Specified by:
        setFileExtensions in interface InputInterface
      • setFileExtensions

        public void setFileExtensions​(java.io.File propertiesFile)
                               throws java.lang.Exception
        Sets the file extension to those listed in properties.ini.
        Specified by:
        setFileExtensions in interface InputInterface
        Throws:
        java.lang.Exception
      • setMinSequenceMaxSubs

        public void setMinSequenceMaxSubs()
        Sets properties value to default defined in the SRD.
        Specified by:
        setMinSequenceMaxSubs in interface InputInterface
      • setMinSequenceMaxSubs

        public void setMinSequenceMaxSubs​(java.io.File propertiesFile)
                                   throws java.lang.Exception
        Sets the properties value for minimum sequence length and maxs substitution defined in the properties file.
        Specified by:
        setMinSequenceMaxSubs in interface InputInterface
        Parameters:
        propertiesFile - the properties file from the CLI.
        Throws:
        java.lang.Exception