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 an HTML Page as a parameter (vectorized HTML) and perform any one (or all) of the following:- Modify the HTML Elements in the news
Article
- Clean or remove unnecessary portions of the
Article
- Update
URL's
before downloading the pictures - Insert HTML into portions of the page
- Extract salient information for internal processing
Hi-Lited Source-Code:- View Here: Torello/HTML/Tools/NewsSite/HTMLModifier.java
- Open New Browser-Tab: Torello/HTML/Tools/NewsSite/HTMLModifier.java
-
-
Field Summary
Serializable ID Modifier and Type Field static long
serialVersionUID
-
Method Summary
@FunctionalInterface (Lambda) Method Modifier and Type Method void
modifyOrRetrieve(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 theSerializable
Implementation 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
- Code:
- Exact Field Declaration Expression:
public static final long serialVersionUID = 1;
-
-
Method Detail
-
modifyOrRetrieve
void modifyOrRetrieve(java.util.Vector<HTMLNode> html, java.net.URL originalPageURL, int sectionNum, int articleNum)
FUNCTIONAL-INTERFACE METHOD: This is the method that must be fulfilled to meet the requirements of thisFunctionalInterface
- Parameters:
html
- This is the vectorized-HTML
news-articleoriginalPageURL
- This is the originalURL
from 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 thsVector
is 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 theArticle
in the download process. The 5thArticle
to be downloaded in a given / particular section would have filename'005.dat'
.
This value is provided here to this method just for convenience.
-
-