Class Person
- java.lang.Object
-
- romanemperorsscraper.scraping.people.Person
-
public class Person extends java.lang.Object
Class offering a recursive constructor to visit, starting from a Dynasty founder, all the dynasty members' Wikipedia pages- Author:
- Matteo Collica, Radu Ionut Barbalata, Sara Lazzaroni
- See Also:
PersonPageData
,DynastyTree
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<Person>
adoptedChildren
private Person
adoptiveFather
private java.util.ArrayList<Person>
children
private Person
father
private Person
mother
private PersonPageData
personPageData
private java.util.ArrayList<Person>
spouses
private static java.util.HashMap<java.lang.String,Person>
storedPersonObjects
private java.util.ArrayList<Person>
successors
private static java.util.HashSet<java.lang.String>
visitedUrls
-
Constructor Summary
Constructors Constructor Description Person(org.openqa.selenium.WebDriver webDriver, PersonPageData personPageData, DynastyTree dynastyTree)
Construct a Person object and set the corresponding graph node's style, then, if the PersonPageData to create a Person object from is an emperor or dictator, scrape relatives' Wikipedia pages, add their nodes to the graph and finally connect them to its node.Person(PersonPageData personPageData, org.graphstream.graph.Graph graph)
Construct a Person object and set the corresponding graph node's style
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PersonPageData
getPersonPageData()
static java.util.HashMap<java.lang.String,Person>
getStoredPersonObjects()
java.util.ArrayList<Person>
getSuccessors()
static void
resetVisitedUrls()
Empty the visitedUrls HashSet by instantiating it again, so that all previously visited urls will no longer result as such.
-
-
-
Field Detail
-
storedPersonObjects
private static java.util.HashMap<java.lang.String,Person> storedPersonObjects
-
visitedUrls
private static java.util.HashSet<java.lang.String> visitedUrls
-
personPageData
private PersonPageData personPageData
-
mother
private Person mother
-
father
private Person father
-
adoptiveFather
private Person adoptiveFather
-
successors
private java.util.ArrayList<Person> successors
-
spouses
private java.util.ArrayList<Person> spouses
-
children
private java.util.ArrayList<Person> children
-
adoptedChildren
private java.util.ArrayList<Person> adoptedChildren
-
-
Constructor Detail
-
Person
public Person(PersonPageData personPageData, org.graphstream.graph.Graph graph)
Construct a Person object and set the corresponding graph node's style- Parameters:
personPageData
- the PersonPageData this Person instance is related tograph
- the Graph instance this Person instance's graph node is placed into
-
Person
public Person(org.openqa.selenium.WebDriver webDriver, PersonPageData personPageData, DynastyTree dynastyTree)
Construct a Person object and set the corresponding graph node's style, then, if the PersonPageData to create a Person object from is an emperor or dictator, scrape relatives' Wikipedia pages, add their nodes to the graph and finally connect them to its node.- Parameters:
webDriver
- the WebDriver needed to scrape relatives' datapersonPageData
- the PersonPageData this Person instance is related todynastyTree
- the DynastyTree instance this Person instance belongs to
-
-
Method Detail
-
resetVisitedUrls
public static void resetVisitedUrls()
Empty the visitedUrls HashSet by instantiating it again, so that all previously visited urls will no longer result as such. Useful before scraping a new dynasty for example.
-
getStoredPersonObjects
public static java.util.HashMap<java.lang.String,Person> getStoredPersonObjects()
- Returns:
- the storedPersonObjects HashMap, containing the already constructed Person objects by their Wikipedia page URL
-
getPersonPageData
public PersonPageData getPersonPageData()
- Returns:
- the PersonPageData object related to this Person instance
-
getSuccessors
public java.util.ArrayList<Person> getSuccessors()
- Returns:
- an ArrayList of successors' Person objects
-
-