Class 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 Detail

      • storedPersonObjects

        private static java.util.HashMap<java.lang.String,​Person> storedPersonObjects
      • visitedUrls

        private static java.util.HashSet<java.lang.String> visitedUrls
      • 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 to
        graph - 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' data
        personPageData - the PersonPageData this Person instance is related to
        dynastyTree - 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