Package reportWriter

Class Report

java.lang.Object
reportWriter.Report

public class Report extends Object
Top level Report object. Contains a title and a list of sections. All methods to organize the Report (e.g. section manipulation) are in this class.
Author:
mo55
  • Constructor Details

    • Report

      public Report(String title)
      Create a new report
  • Method Details

    • getReportTitle

      public String getReportTitle()
      Return the report title
      Returns:
    • addSection

      public void addSection(ReportSection newSection)
      Add a new section to the report
      Parameters:
      newSection -
    • addSections

      public int addSections(ReportSection[] newSections)
    • deleteSection

      public boolean deleteSection(String titleToDelete)
      Delete a section, based on the section title. The title passed to this method must exactly match the section title. Note that this method will delete the first section it finds with a matching title, including null. If multiple sections have the same title, use the method listOfTitles to get the order and deleteSection(int) instead.
      Parameters:
      titleToDelete -
      Returns:
      true if successfully deleted, false if unsuccessful or not found
    • deleteSection

      public boolean deleteSection(int indexToDelete)
      Delete a section, based on the index number. Use the listOfTitles method first to figure out which index number you want to get rid of.
      Parameters:
      indexToDelete -
      Returns:
    • getNumSections

      public int getNumSections()
      Return the number of sections currently in the report
      Returns:
    • getAllSections

      public ArrayList<ReportSection> getAllSections()
      get all sections, as an ArrayList
      Returns:
    • getSection

      public ReportSection getSection(String titleToGet)
      Get a section based on the title. If the section is not found, null is returned
      Parameters:
      titleToGet -
      Returns:
      the section, or null if the section title is not found
    • listOfTitles

      public String[] listOfTitles()
      Returns a list of the section titles
      Returns:
    • addReport

      public void addReport(Report otherReport)
      Add another report. Basically just concatenate all the sections
      The title from the other report will be lost in current version.
      Parameters:
      otherReport - another report (collection of sections).