Package reportWriter
Class Report
java.lang.Object
reportWriter.Report
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add another report.void
addSection
(ReportSection newSection) Add a new section to the reportint
addSections
(ReportSection[] newSections) boolean
deleteSection
(int indexToDelete) Delete a section, based on the index number.boolean
deleteSection
(String titleToDelete) Delete a section, based on the section title.get all sections, as an ArrayListint
Return the number of sections currently in the reportReturn the report titlegetSection
(String titleToGet) Get a section based on the title.String[]
Returns a list of the section titles
-
Constructor Details
-
Report
Create a new report
-
-
Method Details
-
getReportTitle
Return the report title- Returns:
-
addSection
Add a new section to the report- Parameters:
newSection
-
-
addSections
-
deleteSection
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
get all sections, as an ArrayList- Returns:
-
getSection
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
Returns a list of the section titles- Returns:
-
addReport
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).
-