Class 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 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:
        getRefactoringsToPrint in interface OutputInterface
        Returns:
        the number of suggested refactorings that will be printed in the final output.
      • setRefactoringsToPrint

        public void setRefactoringsToPrint​(int refactoringsToPrint)
        Specified by:
        setRefactoringsToPrint in interface OutputInterface
        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:
        getFiles in interface OutputInterface
        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:
        setFiles in interface OutputInterface
        Parameters:
        files - is a list of file objects.
      • getSectionOne

        public java.lang.String getSectionOne()
        Specified by:
        getSectionOne in interface OutputInterface
        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:
        getSectionTwo in interface OutputInterface
        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:
        getCompleteOutput in interface OutputInterface
        Returns:
        the complete string to printed to standard output.