Package edu.odu.cs.cs350
Class Input
- java.lang.Object
-
- edu.odu.cs.cs350.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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>getfileExtensions()java.util.List<java.io.File>getFiles()intgetMaxSubstitutions()intgetMinSequenceLength()intgetNSuggestions()intgetTokenCountForFile(java.io.File file)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.java.util.List<? extends TokenInterface>getTokens()voidsetFileExtensions()Sets file extension to default.voidsetFileExtensions(java.io.File propertiesFile)Sets the file extension to those listed in properties.ini.voidsetMinSequenceMaxSubs()Sets properties value to default defined in the SRD.voidsetMinSequenceMaxSubs(java.io.File propertiesFile)Sets the properties value for minimum sequence length and maxs substitution defined in the properties file.voidsetTokens()Generates the token list.
-
-
-
Method Detail
-
setTokens
public void setTokens()
Generates the token list.- Specified by:
setTokensin interfaceInputInterface
-
getFiles
public java.util.List<java.io.File> getFiles()
- Specified by:
getFilesin interfaceInputInterface- Returns:
- the list of all files that input received as arguments.
-
getTokens
public java.util.List<? extends TokenInterface> getTokens()
- Specified by:
getTokensin interfaceInputInterface- Returns:
- the list of tokens produced using the argument files.
-
getNSuggestions
public int getNSuggestions()
- Specified by:
getNSuggestionsin interfaceInputInterface- 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:
getTokenCountForFilesin interfaceInputInterface- Returns:
- a dictionary containing each file and the count of tokens in that file.
-
getTokenCountForFile
public int getTokenCountForFile(java.io.File file)
- Specified by:
getTokenCountForFilein interfaceInputInterface- 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:
getfileExtensionsin interfaceInputInterface- Returns:
- a list of strings representing the file extensions to be analyzed by the program.
-
getMinSequenceLength
public int getMinSequenceLength()
- Specified by:
getMinSequenceLengthin interfaceInputInterface- Returns:
- Minimum sequence length of token to be refactored.
-
getMaxSubstitutions
public int getMaxSubstitutions()
- Specified by:
getMaxSubstitutionsin interfaceInputInterface- 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:
setFileExtensionsin interfaceInputInterface
-
setFileExtensions
public void setFileExtensions(java.io.File propertiesFile) throws java.lang.ExceptionSets the file extension to those listed in properties.ini.- Specified by:
setFileExtensionsin interfaceInputInterface- Throws:
java.lang.Exception
-
setMinSequenceMaxSubs
public void setMinSequenceMaxSubs()
Sets properties value to default defined in the SRD.- Specified by:
setMinSequenceMaxSubsin interfaceInputInterface
-
setMinSequenceMaxSubs
public void setMinSequenceMaxSubs(java.io.File propertiesFile) throws java.lang.ExceptionSets the properties value for minimum sequence length and maxs substitution defined in the properties file.- Specified by:
setMinSequenceMaxSubsin interfaceInputInterface- Parameters:
propertiesFile- the properties file from the CLI.- Throws:
java.lang.Exception
-
-