本文整理汇总了Java中org.gedcom4j.model.IndividualEvent类的典型用法代码示例。如果您正苦于以下问题:Java IndividualEvent类的具体用法?Java IndividualEvent怎么用?Java IndividualEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndividualEvent类属于org.gedcom4j.model包,在下文中一共展示了IndividualEvent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getBirthDate
点赞 3
import org.gedcom4j.model.IndividualEvent; //导入依赖的package包/类
/**
* Get the birth date of preference from the supplied individual
*
* @param i
* the individual
* @param datePreference
* the preference for imprecise dates
* @return the date found, if any - null if no parseable date could be found
*/
protected DateAndString getBirthDate(Individual i, ImpreciseDatePreference datePreference) {
if (i == null) {
return null;
}
DateParser dp = new DateParser();
DateAndString result = new DateAndString();
for (IndividualEvent e : i.getEventsOfType(IndividualEventType.BIRTH)) {
if (isSpecified(e.getDate())) {
Date d = dp.parse(e.getDate().getValue());
if (d != null && (result.getDate() == null || d.before(result.getDate()))) {
result.setDate(d);
result.setDateString(e.getDate().getValue());
}
}
}
return result;
}
开发者ID:frizbog,
项目名称:gedantic,
代码行数:27,
代码来源:AAnalyzer.java
示例2: getDeathDate
点赞 3
import org.gedcom4j.model.IndividualEvent; //导入依赖的package包/类
/**
* Get the death date of preference from the supplied individual
*
* @param i
* the individual
* @param datePreference
* the preference for imprecise dates
* @return the date found, if any - null if no parseable date could be found
*/
protected DateAndString getDeathDate(Individual i, ImpreciseDatePreference datePreference) {
if (i == null) {
return null;
}
DateParser dp = new DateParser();
DateAndString result = new DateAndString();
for (IndividualEvent e : i.getEventsOfType(IndividualEventType.DEATH)) {
if (isSpecified(e.getDate())) {
Date d = dp.parse(e.getDate().getValue());
if (d != null && (result.getDate() == null || d.after(result.getDate()))) {
result.setDate(d);
result.setDateString(e.getDate().getValue());
}
}
}
return result;
}
开发者ID:frizbog,
项目名称:gedantic,
代码行数:27,
代码来源:AAnalyzer.java
示例3: analyze
点赞 3
import org.gedcom4j.model.IndividualEvent; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<AnalysisResult> analyze(Gedcom g) {
List<AnalysisResult> result = new ArrayList<>();
for (Individual i : g.getIndividuals().values()) {
if (i.getNames() == null || i.getNames().isEmpty()) {
continue;
}
List<IndividualEvent> births = i.getEventsOfType(IndividualEventType.BIRTH);
if (births.isEmpty()) {
result.add(new AnalysisResult("Individual", i.getFormattedName(), null, null, "No birth events."));
} else {
for (IndividualEvent b : births) {
if (b.getDate() == null || b.getDate().getValue() == null || b.getDate().getValue().isEmpty() || "UNKNOWN"
.equalsIgnoreCase(b.getDate().getValue())) {
result.add(new AnalysisResult("Individual", i.getFormattedName(), null, null, "Birth event with no date"));
}
}
}
}
return result;
}
开发者ID:frizbog,
项目名称:gedantic,
代码行数:28,
代码来源:PeopleWithoutBirthDatesAnalyzer.java
示例4: getFactTypeWithDescription
点赞 2
import org.gedcom4j.model.IndividualEvent; //导入依赖的package包/类
/**
* Get the fact type, with description if applicable
*
* @param e
* the event
* @return the fact type, with description if applicable
*/
private String getFactTypeWithDescription(IndividualEvent e) {
String pn = "";
if (e.getPlace() != null && e.getPlace().getPlaceName() != null) {
pn = " (at " + e.getPlace().getPlaceName() + ")";
}
String eventType;
if (IndividualEventType.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
示例5: getFactTypeWithDescription
点赞 2
import org.gedcom4j.model.IndividualEvent; //导入依赖的package包/类
/**
* Get the fact type, with description if applicable
*
* @param e
* the event
* @return the fact type, with description if applicable
*/
private String getFactTypeWithDescription(IndividualEvent e) {
String eventType;
if (IndividualEventType.EVENT == e.getType()) {
eventType = "Custom event: " + e.getSubType();
} else {
eventType = e.getType().getDisplay();
}
return eventType;
}
开发者ID:frizbog,
项目名称:gedantic,
代码行数:17,
代码来源:EventsWithoutPlacesOrDatesAnalyzer.java
示例6: analyze
点赞 2
import org.gedcom4j.model.IndividualEvent; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<AnalysisResult> analyze(Gedcom g) {
List<AnalysisResult> result = new ArrayList<>();
for (Individual i : g.getIndividuals().values()) {
if (i.getNames() == null || i.getNames().isEmpty()) {
continue;
}
List<IndividualEvent> deaths = i.getEventsOfType(IndividualEventType.DEATH);
if (!deaths.isEmpty()) {
continue;
}
List<IndividualEvent> births = i.getEventsOfType(IndividualEventType.BIRTH);
if (births.isEmpty()) {
result.add(new AnalysisResult("Individual", i.getFormattedName(), null, null, "No death (or birth) events."));
continue;
}
Date earliestBirthDate = null;
String earliestBirthDateString = null;
for (IndividualEvent b : births) {
if (b.getDate() != null && b.getDate().getValue() != null) {
Date bd = DP.parse(b.getDate().getValue(), ImpreciseDatePreference.FAVOR_EARLIEST);
if (bd != null && (earliestBirthDate == null || bd.before(earliestBirthDate))) {
earliestBirthDate = bd;
earliestBirthDateString = b.getDate().getValue();
}
}
}
if (earliestBirthDate == null) {
result.add(new AnalysisResult("Individual", i.getFormattedName(), null, null,
"No death events. Unable to parse birth dates to determine age if alive today."));
continue;
}
long difference = new Date().getTime() - earliestBirthDate.getTime();
long yearsOld = difference / (365L * 24 * 60 * 60 * 1000); // approximate
if (yearsOld > 80) {
result.add(new AnalysisResult("Individual", i.getFormattedName(), null, null, "No death events. Born about "
+ ((int) yearsOld) + " years ago (" + earliestBirthDateString + ")."));
}
}
return result;
}
开发者ID:frizbog,
项目名称:gedantic,
代码行数:49,
代码来源:PeopleWithoutDeathEventsAnalyzer.java
示例7: analyze
点赞 2
import org.gedcom4j.model.IndividualEvent; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<AnalysisResult> analyze(Gedcom g) {
List<AnalysisResult> result = new ArrayList<>();
for (Individual i : g.getIndividuals().values()) {
List<IndividualEvent> deaths = i.getEventsOfType(IndividualEventType.DEATH);
if (deaths.isEmpty()) {
continue;
}
List<IndividualEvent> births = i.getEventsOfType(IndividualEventType.BIRTH);
if (births.isEmpty()) {
continue;
}
Date earliestBirthDate = null;
String earliestBirthDateString = null;
for (IndividualEvent b : births) {
if (b.getDate() != null && b.getDate().getValue() != null) {
Date bd = DP.parse(b.getDate().getValue(), ImpreciseDatePreference.FAVOR_EARLIEST);
if (bd != null && (earliestBirthDate == null || bd.before(earliestBirthDate))) {
earliestBirthDate = bd;
earliestBirthDateString = b.getDate().getValue();
}
}
}
if (earliestBirthDate == null) {
continue;
}
Date latestDeathDate = null;
String latestDeathDateString = null;
for (IndividualEvent d : deaths) {
if (d.getDate() != null && d.getDate().getValue() != null) {
Date dd = DP.parse(d.getDate().getValue(), ImpreciseDatePreference.FAVOR_LATEST);
if (dd != null && (latestDeathDate == null || dd.after(latestDeathDate))) {
latestDeathDate = dd;
latestDeathDateString = d.getDate().getValue();
}
}
}
if (latestDeathDate == null) {
continue;
}
long difference = latestDeathDate.getTime() - earliestBirthDate.getTime();
long yearsOld = difference / (365L * 24 * 60 * 60 * 1000); // approximate
if (yearsOld >= 130) {
result.add(new AnalysisResult("Individual", i.getFormattedName(), null, null, "Lived to about " + yearsOld + " (b."
+ earliestBirthDateString + ", d." + latestDeathDateString + "). Probably incorrect dates."));
} else if (yearsOld >= 100) {
result.add(new AnalysisResult("Individua;", i.getFormattedName(), null, null, "Lived to about " + yearsOld + " (b."
+ earliestBirthDateString + ", d." + latestDeathDateString + ") - should verify."));
}
}
return result;
}
开发者ID:frizbog,
项目名称:gedantic,
代码行数:62,
代码来源:PeopleWhoLivedPast100Analyzer.java
示例8: GedcomEvent
点赞 2
import org.gedcom4j.model.IndividualEvent; //导入依赖的package包/类
public GedcomEvent(IndividualEvent event) {
this(event, TYPE_MAP.get(event.type));
}
开发者ID:dhemery,
项目名称:ancestors-java8,
代码行数:4,
代码来源:GedcomEvent.java