HtmlSC uses the {template-method-pattern} to enable flexible checking algorithms:
Description
Failed to render macro
Reason: Invalid scheme for URL. Supported schemes are: [http, https, ftp, ftps, mailto, nntp, news, irc]
We achieve that by defining the skeleton of the checking algorithm in one operation, deferring the specific checking algorithm steps to subclasses.
The invariant steps are implemented in the abstract base class, while the variant checking algorithms have to be provided by the subclasses.
/**
* template method for performing a single type of checks
* on the given @see HtmlPage.
*
* Prerequisite: pageToCheck has been successfully parsed,
* prior to constructing this Checker instance.
*/
public CheckingResultsCollector performCheck() {
// assert prerequisite
assert pageToCheck != null
initResults()
return check() // execute the actual checking algorithm
}
Context
Elements
Name |
Short Description |
| abstract class, used in form of the template-pattern. Shall be subclassed for all checking algorithms. |
| checks if referenced local image files exist |
| checks if cross references (links referenced within the page) exist |
| checks if any id has multiple definitions |