本文整理汇总了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;
}
示例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));
}
}
}
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例6: GedcomEvent
import org.gedcom4j.model.FamilyEvent; //导入依赖的package包/类
public GedcomEvent(FamilyEvent event) {
this(event, Type.MARRIAGE);
}