Package Torello.HTML.Tools.NewsSite
Interface HTMLModifier
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface HTMLModifier
A simple Java function-pointer / lambda-target that may be used to modify or alter Vectorized-HTML, in any way that the programmer has deemed necessary.
This allows a user to write a method, or a Lambda-Expression that can take a Vectorized-HTML Web-Page as a parameter and perform any one (or all) of the following:- Modify the HTML Elements in the news
Article - Clean or remove unnecessary or unsightly portions of the
Article - Update
URL'sbefore downloading the pictures - Insert HTML into portions of the page
- Extract salient information for any other extra processing
Hi-Lited Source-Code:- View Here: Torello/HTML/Tools/NewsSite/HTMLModifier.java
- Open New Browser-Tab: Torello/HTML/Tools/NewsSite/HTMLModifier.java
File Size: 1,983 Bytes Line Count: 45 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field static longserialVersionUID
-
Method Summary
@FunctionalInterface: (Lambda) Method Modifier and Type Method voidmodifyOrRetrieve(Vector<HTMLNode> html, URL originalPageURL, int sectionNum, int articleNum)
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable. Using theSerializableImplementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
Functional Interfaces are usually not thought of as Data Objects that need to be saved, stored and retrieved; however, having the ability to store intermediate results along with the lambda-functions that helped get those results can make debugging easier.- See Also:
- Constant Field Values
-
-
Method Detail
-
modifyOrRetrieve
void modifyOrRetrieve(java.util.Vector<HTMLNode> html, java.net.URL originalPageURL, int sectionNum, int articleNum)
FunctionalInterface Target-Method:
This method corresponds to the@FunctionalInterfaceAnnotation's method requirement. It is the only non-default, non-staticmethod in this interface, and may be the target of a Lambda-Expression or'::'(double-colon) Function-Pointer.- Parameters:
html- This is the vectorized-HTMLnews-articleoriginalPageURL- This is the originalURLfrom whence the page was downloaded. It is provided to this method, merely for convenience.sectionNum- Each article that is downloaded belonged to a particular news section. News sections are listed by their position in a JavaVector, and the index into thsVectoris treated as a the'ID', or the'number'of the section.
This value is provided here to this method just for convenience. When'.html'files are saved (as'.dat'files) - their save location is of the form of'directoryName/fileName.dat'- where theString 'directoryName'is this Section Number provided here.articleNum- Each article that is downloaded is given a number that is merely the order of theArticlein the download process. The 5thArticleto be downloaded in a given / particular section would have filename'005.dat'.
This value is provided here to this method just for convenience.
-
-