Package Torello.HTML.Tools.SearchEngines
Class GoogleQuery.SearchResult
- java.lang.Object
-
- Torello.HTML.Tools.SearchEngines.GoogleQuery.SearchResult
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- GoogleQuery
public static class GoogleQuery.SearchResult extends java.lang.Object implements java.io.Serializable
This class is returned as a result of performing a search on Google.- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/HTML/Tools/SearchEngines/GoogleQuery.java
- Open New Browser-Tab: Torello/HTML/Tools/SearchEngines/GoogleQuery.java
-
-
Field Summary
Fields Modifier and Type Field static long
serialVersionUID
GoogleQuery.SearchResult[]
subResults
String
title
String
url
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method String
toString()
-
-
-
Field Detail
-
serialVersionUID
public 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;
-
url
public final java.lang.String url
This is the link of'this'
search result.- Code:
- Exact Field Declaration Expression:
public final String url;
-
title
public final java.lang.String title
This is the "Anchor Text" that Google provided for this link. To be specific, it is the text between the<A HREF=url>
and the</A>
.- Code:
- Exact Field Declaration Expression:
public final String title;
-
subResults
public final GoogleQuery.SearchResult[] subResults
Usually, this array will be null. Note, null will be used in place of a zero length array. There are some sites for which a search-result would have multiple, or even numerous matches for a given search-String
. When a search using Google provides more than one result, the list of 'Additional Matches' are scraped and put into this array.- Code:
- Exact Field Declaration Expression:
public final SearchResult[] subResults;
-
-
Method Detail
-
toString
public java.lang.String toString()
Converts this search result to a simpleString
- Overrides:
toString
in classjava.lang.Object
- Returns:
- A
String
version of this Search Result. - Code:
- Exact Method Body:
if (subResults == null) return title + '\n' + url + '\n'; StringBuilder sb = new StringBuilder(); for (SearchResult sr : subResults) sb.append('\t' + sr.title + "\n\t" + sr.url + '\n'); return title + '\n' + url + '\n' + sb.toString();
-
-