Class Prose
Work in progress.
- Author:
- Garret Wilson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The heading for an act of a work.static final int
The heading for an afterword heading of a work.static final int
The heading for an article of a work.static final int
The heading for a bibliography heading of a work.static final int
The heading for book.static final int
The heading for a chapter of a work.static final int
The heading for a contents heading of a work.static final int
The heading for a foreword heading of a work.static final int
The heading for a glossary heading of a work.static final int
The heading for the heading for a gospel.static final int
The heading for a an index heading of a work.static final int
The heading for an introduction heading of a work.static final int
The ordered heading with the highest value.static final int
The significant ordered heading with the highest value.static final int
Indicates no heading.static final int
The heading for page-break heading .static final int
The heading for a part of a work.static final int
The heading for a preface heading of a work.static final int
The heading for a scene a work.static final int
The heading for a sub-heading of a work.static final int
The heading for a title heading of a work.static final int
The heading for volume of a work. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsOnlyIgnoreCase
(String text, String[] requiredLabels, String[] optionalLabels) Determines if the given line contains several required and optional labels, compared without case sensitivity.static boolean
containsTitleLabel
(String text, String label) Determines if the given line contains a title label.static int
getHeadingType
(String text) Checks to see which type of heading is represented by the given text.static int
getSectionNumber
(String text, String sectionLabel) Determines whether the given text is a numbered section heading, based upon the specified heading label.static boolean
Determines if the given text is a page break.static boolean
isPageNumber
(String text) Determines if the given text is a page number.static boolean
Determines if the given string is quoted.static boolean
isSubHeading
(String text) Determines if the given text is a subheading.static boolean
Determines if the given string should be capitalized if appearing in a title.static boolean
isTitleHeading
(String text) Determines if the given text is a title heading.
-
Field Details
-
NO_HEADING
public static final int NO_HEADINGIndicates no heading.- See Also:
-
VOLUME_HEADING
public static final int VOLUME_HEADINGThe heading for volume of a work.- See Also:
-
BOOK_HEADING
public static final int BOOK_HEADINGThe heading for book.- See Also:
-
PART_HEADING
public static final int PART_HEADINGThe heading for a part of a work.- See Also:
-
CHAPTER_HEADING
public static final int CHAPTER_HEADINGThe heading for a chapter of a work.- See Also:
-
ACT_HEADING
public static final int ACT_HEADINGThe heading for an act of a work.- See Also:
-
SCENE_HEADING
public static final int SCENE_HEADINGThe heading for a scene a work.- See Also:
-
ARTICLE_HEADING
public static final int ARTICLE_HEADINGThe heading for an article of a work.- See Also:
-
SUB_HEADING
public static final int SUB_HEADINGThe heading for a sub-heading of a work.- See Also:
-
TITLE_HEADING
public static final int TITLE_HEADINGThe heading for a title heading of a work.- See Also:
-
MAX_SIGNIFICANT_HEADING
public static final int MAX_SIGNIFICANT_HEADINGThe significant ordered heading with the highest value.- See Also:
-
MAX_HEADING
public static final int MAX_HEADINGThe ordered heading with the highest value.- See Also:
-
CONTENTS_HEADING
public static final int CONTENTS_HEADINGThe heading for a contents heading of a work.- See Also:
-
PREFACE_HEADING
public static final int PREFACE_HEADINGThe heading for a preface heading of a work.- See Also:
-
FOREWORD_HEADING
public static final int FOREWORD_HEADINGThe heading for a foreword heading of a work.- See Also:
-
INTRODUCTION_HEADING
public static final int INTRODUCTION_HEADINGThe heading for an introduction heading of a work.- See Also:
-
AFTERWORD_HEADING
public static final int AFTERWORD_HEADINGThe heading for an afterword heading of a work.- See Also:
-
BIBLIOGRAPHY_HEADING
public static final int BIBLIOGRAPHY_HEADINGThe heading for a bibliography heading of a work.- See Also:
-
GLOSSARY_HEADING
public static final int GLOSSARY_HEADINGThe heading for a glossary heading of a work.- See Also:
-
INDEX_HEADING
public static final int INDEX_HEADINGThe heading for a an index heading of a work.- See Also:
-
GOSPEL_HEADING
public static final int GOSPEL_HEADINGThe heading for the heading for a gospel.- See Also:
-
PAGE_BREAK_HEADING
public static final int PAGE_BREAK_HEADINGThe heading for page-break heading .- See Also:
-
-
Constructor Details
-
Prose
public Prose()
-
-
Method Details
-
getHeadingType
Checks to see which type of heading is represented by the given text.The following types of headings are checked as numbered sections:
VOLUME_HEADING
BOOK_HEADING
ARTICLE_HEADING
PART_HEADING
CHAPTER_HEADING
ACT_HEADING
SCENE_HEADING
The following types of headings are checked by the presence of title labels:
CONTENTS_HEADING
PREFACE_HEADING
FOREWORD_HEADING
INTRODUCTION_HEADING
AFTERWORD_HEADING
BIBLIOGRAPHY_HEADING
GLOSSARY_HEADING
INDEX_HEADING
GOSPEL_HEADING
The following type of headings is recognized by being in uppercase and not consisting entirely of digits:
SUB_HEADING
The following type of headings is recognized by being correctly capitalized on a single line:
TITLE_HEADING
The following type of headings is recognized by its containing only the characters '*' and/or '-', or the string "page" after punctuation is removed, and appears only on a single line:
PAGE_BREAK_HEADING
- Parameters:
text
- The text to check for heading type.- Returns:
- The type of heading, or
NO_HEADING
if the heading could not be determined. - See Also:
-
isBreak
Determines if the given text is a page break.A break is one of the following conditions:
- Text comprised solely of the following characters: '*', '-', '_', em-dash, and/or en-dash.
- The word "page" surrounded by only punctuation and/or whitespace.
- Parameters:
text
- The text to check.- Returns:
true
if the text is a page break heading.
-
isPageNumber
Determines if the given text is a page number. A page number appears on a single line and has a page indicator and a number, along with an optional select set of symbols but no other letters.- Parameters:
text
- The text to check.- Returns:
true
if the text is a page number.
-
isSubHeading
Determines if the given text is a subheading. A subheading is in all uppercase, is not composed completely of digits, and is not surrounded by quotation marks.- Parameters:
text
- The text to check.- Returns:
true
if the text is a subheading.
-
isTitleHeading
Determines if the given text is a title heading. A title heading appears on a single line and capitalizes each word, except for some exception words (such as "the" and "of").Popular prepositions used from Heather MacFadyen, University of Ottawa, at http://www.uottawa.ca/academic/arts/writcent/hypergrammar/preposit.html
- Parameters:
text
- The text to check.- Returns:
true
if the text is a title heading.
-
isTitleCapitalizationRequired
Determines if the given string should be capitalized if appearing in a title.- Parameters:
word
- The word to test for title capitalization.- Returns:
true
if the word should be capitalized in a title.
-
containsTitleLabel
Determines if the given line contains a title label. The given label is matched case insensitively, but its first character must be capitalized.- Parameters:
text
- The text to check.label
- The label to match.- Returns:
true
if the given text contains the given title label.
-
containsOnlyIgnoreCase
public static boolean containsOnlyIgnoreCase(String text, String[] requiredLabels, String[] optionalLabels) Determines if the given line contains several required and optional labels, compared without case sensitivity.- Parameters:
text
- The text to check.requiredLabels
- The labels that must be present.optionalLabels
- The labels that are optional.- Returns:
true
if the given text contains the required labels and only the required and optional labels.
-
getSectionNumber
Determines whether the given text is a numbered section heading, based upon the specified heading label. If so, the section number is returned.A numbered section appears in one of the following formats on a single line, with "chapter" used to represent the section label:
- Chapter 11
- Chapter 11: The Frightened Goat
- Chapter XI
- Chapter XI: The Frightened Goat
- Eleventh Chapter
- The Eleventh Chapter
- Parameters:
text
- The string to test for a section heading.sectionLabel
- The label used for this type of section, case-insensitive.- Returns:
- The value of this section, or -1 if the string does not appear to be of the given section type.
-
isQuoted
Determines if the given string is quoted.- Parameters:
string
- The string to check.- Returns:
true
if the string's first or last non-whitespace character is some sort of quotation mark.
-