Package edu.odu.cs.cs350
Class Output
- java.lang.Object
-
- edu.odu.cs.cs350.Output
-
- All Implemented Interfaces:
OutputInterface
public class Output extends java.lang.Object implements OutputInterface
Output contains all of the functionality to format and print to the console the complete output of the program. This includes the list of files, their metadata, the list of suggested refactorings, and their metadata.
-
-
Constructor Summary
Constructors Constructor Description Output()The default constructor for Output.Output(InputInterface input, RecommenderInterface recommender)Constructs an Output object using Input and Recommender objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCompleteOutput()Cocatenates the strings for Section 1 and Section 2.java.util.List<java.io.File>getFiles()java.util.List<RefactoringInterface>getRefactorings()intgetRefactoringsToPrint()java.lang.StringgetSectionOne()java.lang.StringgetSectionTwo()voidsetFiles(java.util.List<java.io.File> files)Sets the list of files that will be output in Section 1 of the final output.voidsetRefactorings(java.util.List<? extends RefactoringInterface> refactorings)voidsetRefactoringsToPrint(int refactoringsToPrint)
-
-
-
Constructor Detail
-
Output
public Output()
The default constructor for Output. Creates a new Output object by calling the default constructor for each data member in turn.
-
Output
public Output(InputInterface input, RecommenderInterface recommender)
Constructs an Output object using Input and Recommender objects.- Parameters:
input- a completed Input object; contains all files and all tokens.recommender- a completed Recommender object; contains all refactoring recommendations.
-
-
Method Detail
-
getRefactoringsToPrint
public int getRefactoringsToPrint()
- Specified by:
getRefactoringsToPrintin interfaceOutputInterface- Returns:
- the number of suggested refactorings that will be printed in the final output.
-
setRefactoringsToPrint
public void setRefactoringsToPrint(int refactoringsToPrint)
- Specified by:
setRefactoringsToPrintin interfaceOutputInterface- Parameters:
refactoringsToPrint- sets the number of refactorings that will be printed in the final output.
-
getFiles
public java.util.List<java.io.File> getFiles()
- Specified by:
getFilesin interfaceOutputInterface- Returns:
- the list of file objects that have been processed by the system.
-
setFiles
public void setFiles(java.util.List<java.io.File> files)
Sets the list of files that will be output in Section 1 of the final output.- Specified by:
setFilesin interfaceOutputInterface- Parameters:
files- is a list of file objects.
-
getRefactorings
public java.util.List<RefactoringInterface> getRefactorings()
- Specified by:
getRefactoringsin interfaceOutputInterface- Returns:
- the list of Refactoring objects to be printed in Section 2 of the final output.
-
setRefactorings
public void setRefactorings(java.util.List<? extends RefactoringInterface> refactorings)
- Specified by:
setRefactoringsin interfaceOutputInterface
-
getSectionOne
public java.lang.String getSectionOne()
- Specified by:
getSectionOnein interfaceOutputInterface- Returns:
- a string containing the complete output for Section 1. Section 1 includes the absolute path for each file processed and the total number of tokens discovered in that file. Returns an empty string if there were no files processed.
-
getSectionTwo
public java.lang.String getSectionTwo()
- Specified by:
getSectionTwoin interfaceOutputInterface- Returns:
- a string containing the complete output for Section 2. Section 2 includes the number of tokens, absolute path, line/column number for the start, and the list of tokens in each refactoring opportunity. Returns an empty string if there were no files processed. If @param refactoringsToPrint less than the number of refactorings, prints all refactorings. Else, prints only that number of refactorings.
-
getCompleteOutput
public java.lang.String getCompleteOutput()
Cocatenates the strings for Section 1 and Section 2.- Specified by:
getCompleteOutputin interfaceOutputInterface- Returns:
- the complete string to printed to standard output.
-
-