当前位置: 首页>>代码示例>>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;未经允许,请勿转载。