當前位置: 首頁>>代碼示例>>Java>>正文


Java FamilyEvent類代碼示例

本文整理匯總了Java中org.gedcom4j.model.FamilyEvent的典型用法代碼示例。如果您正苦於以下問題:Java FamilyEvent類的具體用法?Java FamilyEvent怎麽用?Java FamilyEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FamilyEvent類屬於org.gedcom4j.model包,在下文中一共展示了FamilyEvent類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: analyze

import org.gedcom4j.model.FamilyEvent; //導入依賴的package包/類
@Override
public List<AnalysisResult> analyze(Gedcom g) {
    List<AnalysisResult> result = new ArrayList<>();
    for (Family f : g.getFamilies().values()) {
        if (f.getWife() != null && f.getHusband() != null) {
            // We have a couple
            boolean foundMarriageWithDate = false;
            for (FamilyEvent e : f.getEvents()) {
                if (e.getType() == FamilyEventType.MARRIAGE && e.getDate() != null && e.getDate().getValue().trim()
                        .length() >= 0) {
                    // We got a marriage date
                    foundMarriageWithDate = true;
                }
            }
            if (!foundMarriageWithDate) {
                result.add(new AnalysisResult("Family", getFamilyDescriptor(f), null, null,
                        "No marriage event with date found"));
            }
        }
    }
    return result;
}
 
開發者ID:frizbog,項目名稱:gedantic,代碼行數:23,代碼來源:MarriagesWithoutDatesAnalyzer.java

示例2: checkFamilies

import org.gedcom4j.model.FamilyEvent; //導入依賴的package包/類
/**
 * Check the family events
 * 
 * @param g
 *            the gedcom
 * @param result
 *            the results we're collecting
 */
protected void checkFamilies(Gedcom g, List<AnalysisResult> result) {
    for (Family f : g.getFamilies().values()) {
        if (f.getEvents() != null) {
            for (FamilyEvent fe : f.getEvents()) {
                if (fe.getEmails() != null) {
                    for (StringWithCustomFacts e : fe.getEmails()) {
                        if (e.getValue() != null && !EMAIL_PATTERN.matcher(e.getValue()).matches()) {
                            result.add(new AnalysisResult("Family", getFamilyDescriptor(f), "Email for " + fe.getType()
                                    .getDisplay(), e.getValue(), null));
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:frizbog,項目名稱:gedantic,代碼行數:25,代碼來源:BadEmailAnalyzer.java

示例3: getFactTypeWithDescription

import org.gedcom4j.model.FamilyEvent; //導入依賴的package包/類
/**
 * Get the fact type, with description if applicable
 * 
 * @param e
 *            the event
 * @return the fact type, with description if applicable
 */
private String getFactTypeWithDescription(FamilyEvent e) {
    String pn = "";
    if (e.getPlace() != null && e.getPlace().getPlaceName() != null) {
        pn = " (at " + e.getPlace().getPlaceName() + ")";
    }
    String eventType;
    if (FamilyEventType.EVENT == e.getType()) {
        eventType = "Custom event: " + e.getSubType();
    } else {
        eventType = e.getType().getDisplay();
    }
    String factType = eventType + pn;
    return factType;
}
 
開發者ID:frizbog,項目名稱:gedantic,代碼行數:22,代碼來源:EventsWithoutDatesAnalyzer.java

示例4: getFactTypeWithDescription

import org.gedcom4j.model.FamilyEvent; //導入依賴的package包/類
/**
 * Get the fact type, with description if applicable
 * 
 * @param e
 *            the event
 * @return the fact type, with description if applicable
 */
private String getFactTypeWithDescription(FamilyEvent e) {
    String eventType;
    if (FamilyEventType.EVENT == e.getType()) {
        eventType = "Custom event: " + e.getSubType();
    } else {
        eventType = e.getType().getDisplay();
    }
    return eventType;
}
 
開發者ID:frizbog,項目名稱:gedantic,代碼行數:17,代碼來源:EventsWithoutPlacesOrDatesAnalyzer.java

示例5: analyze

import org.gedcom4j.model.FamilyEvent; //導入依賴的package包/類
@Override
public List<AnalysisResult> analyze(Gedcom g) {
    List<AnalysisResult> result = new ArrayList<>();

    for (Family f : g.getFamilies().values()) {
        if (f.getHusband() == null || f.getWife() == null || f.getEvents() == null || f.getEvents().isEmpty()) {
            continue;
        }

        // Get the earliest possible marriage date
        FamilyEvent earliestMarriage = null;
        Date earliestMarriageDate = new Date();
        for (FamilyEvent e : f.getEvents()) {
            if (e.getType() == FamilyEventType.MARRIAGE) {
                if (e.getDate() != null && e.getDate().getValue() != null) {
                    Date d = DP.parse(e.getDate().getValue());
                    if (d != null && d.before(earliestMarriageDate)) {
                        earliestMarriage = e;
                        earliestMarriageDate = d;
                    }
                }
            }
        }
        if (earliestMarriage == null) {
            continue;
        }

        Individual husband = f.getHusband().getIndividual();
        DateAndString husbandLatestBirthDate = getBirthDate(husband, ImpreciseDatePreference.FAVOR_LATEST);

        Individual wife = f.getWife().getIndividual();
        DateAndString wifeLatestBirthDate = getBirthDate(wife, ImpreciseDatePreference.FAVOR_LATEST);

        // Both spouses need a birth date to proceed
        if ((husbandLatestBirthDate == null || husbandLatestBirthDate.getDate() == null || wifeLatestBirthDate == null
                || wifeLatestBirthDate.getDate() == null)) {
            continue;
        }

        long hDiff = earliestMarriageDate.getTime() - husbandLatestBirthDate.getDate().getTime();
        long wDiff = earliestMarriageDate.getTime() - wifeLatestBirthDate.getDate().getTime();

        if (hDiff <= MILLIS_IN_SIXTEEN_YEARS || wDiff <= MILLIS_IN_SIXTEEN_YEARS) {
            int hAgeAtMarriage = (int) (hDiff / MILLIS_IN_YEAR);
            int wAgeAtMarriage = (int) (wDiff / MILLIS_IN_YEAR);

            StringBuilder problem = new StringBuilder();
            if (hDiff <= MILLIS_IN_SIXTEEN_YEARS) {
                problem.append("Husband born ");
                problem.append(husbandLatestBirthDate.getDateString());
                problem.append(", aged ");
                problem.append(hAgeAtMarriage);
            }
            if (wDiff <= MILLIS_IN_SIXTEEN_YEARS) {
                if (problem.length() > 0) {
                    problem.append("; ");
                }
                problem.append("Wife born ");
                problem.append(wifeLatestBirthDate.getDateString());
                problem.append(", aged ");
                problem.append(wAgeAtMarriage);
            }

            result.add(new AnalysisResult("Family", getFamilyDescriptor(f), FamilyEventType.MARRIAGE.getDisplay(),
                    earliestMarriage.getDate().getValue(), problem.toString()));
        }
    }

    return result;
}
 
開發者ID:frizbog,項目名稱:gedantic,代碼行數:71,代碼來源:MarriedAtYoungAgeAnalyzer.java

示例6: GedcomEvent

import org.gedcom4j.model.FamilyEvent; //導入依賴的package包/類
public GedcomEvent(FamilyEvent event) {
    this(event, Type.MARRIAGE);
}
 
開發者ID:dhemery,項目名稱:ancestors-java8,代碼行數:4,代碼來源:GedcomEvent.java


注:本文中的org.gedcom4j.model.FamilyEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。