Package org.gedcom4j.model

Examples of org.gedcom4j.model.Individual


    /**
     * Test when people are 2 generations apart. Includes negative test where the ancestor/descendant are swapped.
     */
    @Test
    public void testGenerationCount2() {
        Individual robert = getPerson("Andrews", "Robert");
        // Steven is Robert's grandfather
        Individual steven = getPerson("Struthers", "Steven");
        assertNotNull(robert);
        assertNotNull(steven);
        assertEquals(2, anc.getGenerationCount(robert, steven));
        try {
            anc.getGenerationCount(steven, robert);
View Full Code Here


    /**
     * Test when people are several generations apart. Includes negative test where the ancestor/descendant are swapped.
     */
    @Test
    public void testGenerationCount3() {
        Individual alex = getPerson("Zucco", "Alex");
        // Kenneth is Alex's great-great-great-grandfather
        Individual kenneth = getPerson("Struthers", "Kenneth");
        assertNotNull(alex);
        assertNotNull(kenneth);
        assertEquals(5, anc.getGenerationCount(alex, kenneth));
        try {
            anc.getGenerationCount(kenneth, alex);
View Full Code Here

    /**
     * Test degenerate case for a married couple that has no common ancestors
     */
    @Test
    public void testLowestCommonAncestor1() {
        Individual ulysses = getPerson("Jackson", "Ulysses");
        Individual abigail = getPerson("Wood", "Abigail");

        Set<Individual> lowestCommonAncestors = anc.getLowestCommonAncestors(ulysses, abigail);
        assertEquals("Ulysses and Abigail have no common ancestors", 0, lowestCommonAncestors.size());
    }
View Full Code Here

    /**
     * Test simple case for a brother and sister of the same two parents and no known grandparents
     */
    @Test
    public void testLowestCommonAncestor2() {
        Individual sally = getPerson("Struthers", "Sally");
        Individual sammy = getPerson("Struthers", "Sammy");

        Set<Individual> lowestCommonAncestors = anc.getLowestCommonAncestors(sally, sammy);
        assertEquals("Sammy and Sally (brother and sister) have two common ancestors (their parents)", 2,
                lowestCommonAncestors.size());
        Individual steven = getPerson("Struthers", "Steven");
        Individual gladys = getPerson("Knight", "Gladys");
        assertTrue("Steven is a common ancestor (their dad)", lowestCommonAncestors.contains(steven));
        assertTrue("Gladys is a common ancestor (their mom)", lowestCommonAncestors.contains(gladys));
    }
View Full Code Here

     * Test simple case for a person and his parent(s) - the grandparent(s) should be in common - the grandparents have
     * no parents in the gedcom
     */
    @Test
    public void testLowestCommonAncestor3() {
        Individual robert = getPerson("Andrews", "Robert");
        Individual sammy = getPerson("Struthers", "Sammy");

        Set<Individual> lowestCommonAncestors = anc.getLowestCommonAncestors(robert, sammy);
        assertEquals(
                "Robert (son) and Sammy (father) have two ancestors in common: Sammy's parents/Robert's grandparents",
                2, lowestCommonAncestors.size());
        Individual steven = getPerson("Struthers", "Steven");
        Individual gladys = getPerson("Knight", "Gladys");
        assertTrue("Steven is a common ancestor (Sammy's dad and Robert's grandfather)",
                lowestCommonAncestors.contains(steven));
        assertTrue("Gladys is a common ancestor (Sammy's mom and Robert's grandmother)",
                lowestCommonAncestors.contains(gladys));
    }
View Full Code Here

     * grandparents DO have parents in the gedcom - so the paternal GREAT grandparents should NOT be in the list, as
     * they are not the lowest common ancestors.
     */
    @Test
    public void testLowestCommonAncestor4() {
        Individual robert = getPerson("Andrews", "Robert");
        Individual theresa = getPerson("Andrews", "Theresa");

        if (VERBOSE) {
            System.out.println("Any match of these will be fine:");
            for (Individual i : anc.getExtendedAncestry(robert)) {
                System.out.println("\t" + i.names.get(0).basic);
            }
        }
        Set<Individual> lowestCommonAncestors = anc.getLowestCommonAncestors(robert, theresa);
        assertEquals("Robert (father) and Theresa (daughter) should have two lowest common ancestors:"
                + " James Andrews, and Sally Struthers", 2, lowestCommonAncestors.size());
        Individual sally = getPerson("Struthers", "Sally");
        Individual james = getPerson("Andrews", "James");
        assertTrue("Sally is a common ancestor (Robert's mom and Theresa's grandmother)",
                lowestCommonAncestors.contains(sally));
        assertTrue("James is a common ancestor (Robert's dad and Theresa's grandfather)",
                lowestCommonAncestors.contains(james));
        assertFalse("Steven Struthers (Robert's grandfather) is a common ancestor, but not a LOWEST common ancestor",
View Full Code Here

     * @param givenName
     *            the given name of the person we want
     * @return the person
     */
    private Individual getPerson(String surname, String givenName) {
        Individual result = finder.findByName(surname, givenName).get(0);
        assertNotNull("Couldn't find " + givenName + " " + surname + " by name in the gedcom", result);
        return result;
    }
View Full Code Here

        boolean foundJohn = false;
        boolean foundMary = false;
        for (Entry<String, Individual> i : gp.gedcom.individuals.entrySet()) {
            if (i.getKey().equalsIgnoreCase("@I1@")) {
                foundJohn = true;
                Individual john = i.getValue();
                assertNotNull(john);
                checkJohn(john.notes);
            }
            if (i.getKey().equalsIgnoreCase("@I2@")) {
                foundMary = true;
                Individual mary = i.getValue();
                assertNotNull(mary);
                checkMary(mary.notes);
            }
        }
        assertTrue("Didn't find john", foundJohn);
View Full Code Here

                g1.equals(g2));
        g2.trailer = null;
        assertEquals(
                "objects are equal again, so equals() should return true again",
                g1, g2);
        g1.individuals.put("FryingPan", new Individual());
        assertFalse(
                "objects are no longer equal, so equals() should return false",
                g1.equals(g2));
        g2.individuals.put("FryingPan", new Individual());
        assertEquals(
                "objects are equal again, so equals() should return true again",
                g1, g2);
        assertFalse(g1.equals(null));
        assertFalse(g1.equals(this));
View Full Code Here

                g1.hashCode() == g2.hashCode());
        g2.trailer = null;
        assertEquals(
                "objects are equal again, so hashcodes should equal again",
                g1.hashCode(), g2.hashCode());
        g1.individuals.put("FryingPan", new Individual());
        assertFalse(
                "objects are no longer equal, so hashcodes should no longer equal",
                g1.hashCode() == g2.hashCode());
        g2.individuals.put("FryingPan", new Individual());
        assertEquals(
                "objects are equal again, so hashcodes should equal again",
                g1.hashCode(), g2.hashCode());
    }
View Full Code Here

TOP

Related Classes of org.gedcom4j.model.Individual

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.