From 55ece53aaad958a34f53d222222df2d9a2d7fc09 Mon Sep 17 00:00:00 2001 From: "Matt Harrah (frizbog)" Date: Sun, 22 Jan 2017 11:07:22 -0500 Subject: [PATCH] Issue #58 --- .../java/org/gedantic/analyzer/AAnalyzer.java | 3 +- .../java/org/gedantic/analyzer/AResult.java | 148 ---------- .../org/gedantic/analyzer/AnalysisResult.java | 172 +++++++++++ .../org/gedantic/analyzer/AnalysisTag.java | 4 +- .../analyzer/{result => }/DateAndString.java | 2 +- .../java/org/gedantic/analyzer/IAnalyzer.java | 18 +- .../comparator/AnalysisResultComparator.java | 101 +++++++ .../IndividualResultSortComparator.java | 105 ------- .../comparator/MixedResultSortComparator.java | 164 ----------- .../impl/AdultsWithoutSpousesAnalyzer.java | 21 +- .../analyzer/impl/BadEmailAnalyzer.java | 68 +++-- .../impl/BirthsToOldParentsAnalyzer.java | 8 +- .../impl/BirthsToYoungParentsAnalyzer.java | 8 +- ...ChildrenWithDifferentSurnamesAnalyzer.java | 10 +- .../ChildrenWithSameFirstNamesAnalyzer.java | 6 +- .../impl/CircularAncestryAnalyzer.java | 6 +- .../impl/ConflictingDatesAnalyzer.java | 10 +- .../CouplesWithCommonAncestorsAnalyzer.java | 6 +- ...CouplesWithLargeAgeDifferenceAnalyzer.java | 8 +- .../impl/CouplesWithSameBirthSurnames.java | 6 +- .../impl/CouplesWithoutChildrenAnalyzer.java | 6 +- .../impl/DatesButNoPlacesAnalyzer.java | 6 +- ...escendantsBornBeforeAncestorsAnalyzer.java | 8 +- .../impl/EventsWithoutDatesAnalyzer.java | 6 +- .../EventsWithoutPlacesOrDatesAnalyzer.java | 6 +- .../impl/FactsWithoutSourcesAnalyzer.java | 10 +- .../impl/FutureBirthDeathDatesAnalyzer.java | 6 +- .../impl/MaleWivesFemaleHusbandsAnalyzer.java | 6 +- .../impl/MarriagesWithoutDatesAnalyzer.java | 6 +- .../impl/MarriedAtYoungAgeAnalyzer.java | 8 +- .../analyzer/impl/OnlyChildrenAnalyzer.java | 6 +- .../impl/PeopleWhoLivedPast100Analyzer.java | 6 +- .../PeopleWithOneMissingParentAnalyzer.java | 6 +- .../impl/PeopleWithOnlySurnamesAnalyzer.java | 6 +- .../impl/PeopleWithoutBirthDatesAnalyzer.java | 6 +- .../PeopleWithoutDeathEventsAnalyzer.java | 6 +- .../impl/PeopleWithoutNamesAnalyzer.java | 14 +- .../PeopleWithoutOccupationsAnalysis.java | 6 +- .../impl/PeopleWithoutParentsAnalyzer.java | 6 +- .../impl/PeopleWithoutSurnamesAnalyzer.java | 10 +- .../impl/PlacesButNoDatesAnalyzer.java | 6 +- .../impl/QuadrupletsAndMoreAnalyzer.java | 12 +- ...eousBirthsInMultipleLocationsAnalyzer.java | 6 +- ...outRepositoryCitationsOrMediaAnalyzer.java | 8 +- .../impl/UnparsableDatesAnalyzer.java | 6 +- .../analyzer/impl/UnspecifiedSexAnalyzer.java | 6 +- .../analyzer/result/FamilyRelatedResult.java | 105 ------- .../result/IndividualRelatedResult.java | 85 ------ .../result/RelationshipRelatedResult.java | 71 ----- .../result/RepositoryRelatedResult.java | 70 ----- .../analyzer/result/SourceRelatedResult.java | 69 ----- .../result/SubmitterRelatedResult.java | 70 ----- .../analyzer/result/UnrelatedResult.java | 69 ----- .../analyzer/result/package-info.java | 32 -- .../gedantic/web/servlet/AnalyzerServlet.java | 8 +- .../gedantic/web/servlet/WorkbookCreator.java | 274 +----------------- 56 files changed, 484 insertions(+), 1427 deletions(-) delete mode 100644 src/main/java/org/gedantic/analyzer/AResult.java create mode 100644 src/main/java/org/gedantic/analyzer/AnalysisResult.java rename src/main/java/org/gedantic/analyzer/{result => }/DateAndString.java (99%) create mode 100644 src/main/java/org/gedantic/analyzer/comparator/AnalysisResultComparator.java delete mode 100644 src/main/java/org/gedantic/analyzer/comparator/IndividualResultSortComparator.java delete mode 100644 src/main/java/org/gedantic/analyzer/comparator/MixedResultSortComparator.java delete mode 100644 src/main/java/org/gedantic/analyzer/result/FamilyRelatedResult.java delete mode 100644 src/main/java/org/gedantic/analyzer/result/IndividualRelatedResult.java delete mode 100644 src/main/java/org/gedantic/analyzer/result/RelationshipRelatedResult.java delete mode 100644 src/main/java/org/gedantic/analyzer/result/RepositoryRelatedResult.java delete mode 100644 src/main/java/org/gedantic/analyzer/result/SourceRelatedResult.java delete mode 100644 src/main/java/org/gedantic/analyzer/result/SubmitterRelatedResult.java delete mode 100644 src/main/java/org/gedantic/analyzer/result/UnrelatedResult.java delete mode 100644 src/main/java/org/gedantic/analyzer/result/package-info.java diff --git a/src/main/java/org/gedantic/analyzer/AAnalyzer.java b/src/main/java/org/gedantic/analyzer/AAnalyzer.java index 8deff82..1647b89 100644 --- a/src/main/java/org/gedantic/analyzer/AAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/AAnalyzer.java @@ -32,7 +32,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.gedantic.analyzer.result.DateAndString; import org.gedcom4j.model.Individual; import org.gedcom4j.model.IndividualEvent; import org.gedcom4j.model.PersonalName; @@ -178,7 +177,7 @@ protected boolean isSpecified(String s) { } /** - * Is the supplied string with custom tags non-null, and has something other than whitespace in its value field? + * Is the supplied string with custom tags non-null, and has something other than whitespace in its item field? * * @param swct * the string with custom tags diff --git a/src/main/java/org/gedantic/analyzer/AResult.java b/src/main/java/org/gedantic/analyzer/AResult.java deleted file mode 100644 index 18630a2..0000000 --- a/src/main/java/org/gedantic/analyzer/AResult.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer; - -import java.util.List; -import java.util.Set; - -import org.apache.commons.lang.StringEscapeUtils; -import org.gedcom4j.model.Individual; -import org.gedcom4j.relationship.SimpleRelationship; - -/** - * Base class for an analysis result - * - * @author frizbog - */ -public abstract class AResult { - - /** - * The type of fact having an issue - */ - protected final String factType; - - /** - * The value that caused the problem - */ - protected final Object value; - - /** - * The description of the problem - */ - protected final String problem; - - /** - * Instantiates a new a result. - * - * @param factType - * the fact type - * @param value - * the value - * @param problem - * the problem - */ - public AResult(String factType, Individual value, String problem) { - this.factType = StringEscapeUtils.escapeHtml(factType); - this.value = value; - this.problem = StringEscapeUtils.escapeHtml(problem); - } - - /** - * Instantiates a new a result. - * - * @param factType - * the fact type - * @param value - * the value - * @param problem - * the problem - */ - public AResult(String factType, List> value, String problem) { - this.factType = StringEscapeUtils.escapeHtml(factType); - this.value = value; - this.problem = StringEscapeUtils.escapeHtml(problem); - } - - /** - * Instantiates a new a result. - * - * @param factType - * the fact type - * @param value - * the value - * @param problem - * the problem - */ - public AResult(String factType, Set value, String problem) { - this.factType = StringEscapeUtils.escapeHtml(factType); - this.value = value; - this.problem = StringEscapeUtils.escapeHtml(problem); - } - - /** - * Instantiates a new a result. - * - * @param factType - * the fact type - * @param value - * the value - * @param problem - * the problem - */ - public AResult(String factType, String value, String problem) { - this.factType = StringEscapeUtils.escapeHtml(factType); - this.value = StringEscapeUtils.escapeHtml(value); - this.problem = StringEscapeUtils.escapeHtml(problem); - } - - /** - * Get the fact type - * - * @return the fact type - */ - public String getFactType() { - return factType; - } - - /** - * Get the problem description - * - * @return the problem description - */ - public String getProblem() { - return problem; - } - - /** - * Get the problematic value - * - * @return the value that cause the problem - */ - public Object getValue() { - return value; - } -} diff --git a/src/main/java/org/gedantic/analyzer/AnalysisResult.java b/src/main/java/org/gedantic/analyzer/AnalysisResult.java new file mode 100644 index 0000000..208efee --- /dev/null +++ b/src/main/java/org/gedantic/analyzer/AnalysisResult.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2016 Matthew R. Harrah + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +package org.gedantic.analyzer; + +import org.apache.commons.lang.StringEscapeUtils; + +/** + * Base class for an analysis result + * + * @author frizbog + */ +public class AnalysisResult { + + /** + * The type of fact having an issue + */ + protected final String factType; + + /** + * The type of item having an issue + */ + protected final String itemType; + + /** + * The thing that had the problemDescription + */ + protected final String item; + + /** + * The description of the problemDescription + */ + protected final String problemDescription; + + /** + * Instantiates a new a result. + * + * @param factType + * the fact type + * @param itemType + * the type of item with the problem + * @param item + * the item + * @param problemDescription + * the problemDescription + */ + public AnalysisResult(String factType, String itemType, String item, String problemDescription) { + this.factType = StringEscapeUtils.escapeHtml(factType); + this.itemType = StringEscapeUtils.escapeHtml(itemType); + this.item = StringEscapeUtils.escapeHtml(item); + this.problemDescription = StringEscapeUtils.escapeHtml(problemDescription); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof AnalysisResult)) { + return false; + } + AnalysisResult other = (AnalysisResult) obj; + if (factType == null) { + if (other.factType != null) { + return false; + } + } else if (!factType.equals(other.factType)) { + return false; + } + if (item == null) { + if (other.item != null) { + return false; + } + } else if (!item.equals(other.item)) { + return false; + } + if (itemType == null) { + if (other.itemType != null) { + return false; + } + } else if (!itemType.equals(other.itemType)) { + return false; + } + if (problemDescription == null) { + if (other.problemDescription != null) { + return false; + } + } else if (!problemDescription.equals(other.problemDescription)) { + return false; + } + return true; + } + + /** + * Get the fact type + * + * @return the fact type + */ + public String getFactType() { + return factType; + } + + /** + * Get the problematic item + * + * @return the item that cause the problemDescription + */ + public String getItem() { + return item; + } + + /** + * Get the itemType + * + * @return the itemType + */ + public String getItemType() { + return itemType; + } + + /** + * Get the problemDescription description + * + * @return the problemDescription description + */ + public String getProblemDescription() { + return problemDescription; + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((factType == null) ? 0 : factType.hashCode()); + result = prime * result + ((item == null) ? 0 : item.hashCode()); + result = prime * result + ((itemType == null) ? 0 : itemType.hashCode()); + result = prime * result + ((problemDescription == null) ? 0 : problemDescription.hashCode()); + return result; + } +} diff --git a/src/main/java/org/gedantic/analyzer/AnalysisTag.java b/src/main/java/org/gedantic/analyzer/AnalysisTag.java index 6e3c88b..4e90dbd 100644 --- a/src/main/java/org/gedantic/analyzer/AnalysisTag.java +++ b/src/main/java/org/gedantic/analyzer/AnalysisTag.java @@ -36,9 +36,9 @@ */ public enum AnalysisTag { /** - * A likely problem with the data + * A likely problemDescription with the data */ - PROBLEM("1", "Problem", "A likely problem, inconsistency, or item to be verified/corrected"), + PROBLEM("1", "Problem", "A likely problemDescription, inconsistency, or item to be verified/corrected"), /** * Analysis about or includes families diff --git a/src/main/java/org/gedantic/analyzer/result/DateAndString.java b/src/main/java/org/gedantic/analyzer/DateAndString.java similarity index 99% rename from src/main/java/org/gedantic/analyzer/result/DateAndString.java rename to src/main/java/org/gedantic/analyzer/DateAndString.java index 098209a..7212d1a 100644 --- a/src/main/java/org/gedantic/analyzer/result/DateAndString.java +++ b/src/main/java/org/gedantic/analyzer/DateAndString.java @@ -24,7 +24,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -package org.gedantic.analyzer.result; +package org.gedantic.analyzer; import java.util.Date; diff --git a/src/main/java/org/gedantic/analyzer/IAnalyzer.java b/src/main/java/org/gedantic/analyzer/IAnalyzer.java index 5d3fe0f..80a9ba3 100644 --- a/src/main/java/org/gedantic/analyzer/IAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/IAnalyzer.java @@ -37,6 +37,15 @@ */ public interface IAnalyzer { + /** + * Analyze a {@link Gedcom}, and return some results + * + * @param g + * the {@link Gedcom} to analyze + * @return a {@link List} of results + */ + List analyze(Gedcom g); + /** * Get a description for this analyzer. * @@ -80,13 +89,4 @@ public interface IAnalyzer { */ boolean isNewish(); - /** - * Analyze a {@link Gedcom}, and return some results - * - * @param g - * the {@link Gedcom} to analyze - * @return a {@link List} of results - */ - List analyze(Gedcom g); - } diff --git a/src/main/java/org/gedantic/analyzer/comparator/AnalysisResultComparator.java b/src/main/java/org/gedantic/analyzer/comparator/AnalysisResultComparator.java new file mode 100644 index 0000000..3a2006e --- /dev/null +++ b/src/main/java/org/gedantic/analyzer/comparator/AnalysisResultComparator.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2016 Matthew R. Harrah + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +package org.gedantic.analyzer.comparator; + +import java.util.Comparator; + +import org.gedantic.analyzer.AnalysisResult; + +/** + * Comparator for sorting results + * + * @author frizbog + */ +public class AnalysisResultComparator implements Comparator { + + @Override + public int compare(AnalysisResult o1, AnalysisResult o2) { + int result = 0; + if (o1 == null) { + if (o2 == null) { + return result; + } + return 1; + } + if (o2 == null) { + return -1; + } + + if (o1.getItemType() == null) { + if (o2.getItemType() != null) { + return 1; + } + } else { + result = o1.getItemType().compareTo(o2.getItemType()); + if (result != 0) { + return result; + } + } + + if (o1.getItem() == null) { + if (o2.getItem() != null) { + return 1; + } + } else { + result = o1.getItem().compareTo(o2.getItem()); + if (result != 0) { + return result; + } + } + + if (o1.getFactType() == null) { + if (o2.getFactType() != null) { + return 1; + } + } else { + result = o1.getFactType().compareTo(o2.getFactType()); + if (result != 0) { + return result; + } + } + + if (o1.getProblemDescription() == null) { + if (o2.getProblemDescription() != null) { + return 1; + } + } else { + result = o1.getProblemDescription().compareTo(o2.getProblemDescription()); + if (result != 0) { + return result; + } + } + + return 0; + + } + +} diff --git a/src/main/java/org/gedantic/analyzer/comparator/IndividualResultSortComparator.java b/src/main/java/org/gedantic/analyzer/comparator/IndividualResultSortComparator.java deleted file mode 100644 index f60fa09..0000000 --- a/src/main/java/org/gedantic/analyzer/comparator/IndividualResultSortComparator.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.comparator; - -import java.io.Serializable; -import java.util.Comparator; - -import org.gedantic.analyzer.AResult; -import org.gedantic.analyzer.result.IndividualRelatedResult; -import org.gedcom4j.model.Individual; -import org.gedcom4j.model.PersonalName; - -/** - * Comparator for sorting results about individuals by last name (surname) first, then first (given) name - * - * @author frizbog1 - * - */ -public class IndividualResultSortComparator implements Serializable, Comparator { - - /** - * Serial Version UID - */ - private static final long serialVersionUID = -8121061183483337581L; - - /** - * Compare two individuals - * - * @param ar1 - * result 1, which is assumed to be an {@link IndividualRelatedResult} - * @param ar2 - * result 2, which is assumed to be an {@link IndividualRelatedResult} - * @return -1 if i1 < i2, 0 if i1 == i2, 1 if i1 > i2 - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(AResult ar1, AResult ar2) { - - IndividualRelatedResult r1 = (IndividualRelatedResult) ar1; - IndividualRelatedResult r2 = (IndividualRelatedResult) ar2; - - Individual i1 = r1.getIndividual(); - Individual i2 = r2.getIndividual(); - - String s1 = "-unknown-"; - String s2 = "-unknown-"; - PersonalName n1 = null; - PersonalName n2 = null; - if (!i1.getNames().isEmpty()) { - n1 = i1.getNames().get(0); - } - if (!i2.getNames().isEmpty()) { - n2 = i2.getNames().get(0); - } - - if (n1 != null) { - if (n1.getSurname() == null && n1.getGivenName() == null) { - if (n1.getBasic().contains("/")) { - String sn = n1.getBasic().substring(n1.getBasic().indexOf("/")); - String gn = n1.getBasic().substring(0, n1.getBasic().indexOf("/")); - s1 = sn + ", " + gn; - } - } else { - s1 = n1.getSurname() + ", " + n1.getGivenName(); - } - } - - if (n2 != null) { - if (n2.getSurname() == null && n2.getGivenName() == null) { - if (n2.getBasic().contains("/")) { - String sn = n2.getBasic().substring(n2.getBasic().indexOf("/")); - String gn = n2.getBasic().substring(0, n2.getBasic().indexOf("/")); - s2 = sn + ", " + gn; - } - } else { - s2 = n2.getSurname() + ", " + n2.getGivenName(); - } - } - - return s1.compareTo(s2); - } -} diff --git a/src/main/java/org/gedantic/analyzer/comparator/MixedResultSortComparator.java b/src/main/java/org/gedantic/analyzer/comparator/MixedResultSortComparator.java deleted file mode 100644 index e2ece7a..0000000 --- a/src/main/java/org/gedantic/analyzer/comparator/MixedResultSortComparator.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.comparator; - -import java.io.Serializable; -import java.util.Comparator; - -import org.gedantic.analyzer.AResult; -import org.gedantic.analyzer.result.FamilyRelatedResult; -import org.gedantic.analyzer.result.IndividualRelatedResult; -import org.gedcom4j.model.Family; -import org.gedcom4j.model.Individual; -import org.gedcom4j.model.PersonalName; - -/** - * Comparator for sorting results about individuals by last name (surname) first, then first (given) name - * - * @author frizbog1 - */ -public class MixedResultSortComparator implements Serializable, Comparator { - - /** - * Serial Version UID - */ - private static final long serialVersionUID = -8121061183483337581L; - - /** - * Compare two results, based on the individuals in them. - * - * @param ar1 - * result 1, which is assumed to be an {@link IndividualRelatedResult} or a {@link FamilyRelatedResult} - * @param ar2 - * result 2, which is assumed to be an {@link IndividualRelatedResult} or a {@link FamilyRelatedResult} - * @return -1 if i1 < i2, 0 if i1 == i2, 1 if i1 > i2 - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(AResult ar1, AResult ar2) { - - Individual i1 = getIndividualReferenced(ar1); - Individual i2 = getIndividualReferenced(ar2); - - return compareIndividuals(i1, i2); - } - - /** - * Compare two individuals - * - * @param i1 - * the first individual - * @param i2 - * the second individual - * @return -1 if i1 < i2, 0 if i1 == i2, 1 if i1 > i2 - */ - private int compareIndividuals(Individual i1, Individual i2) { - String s1 = "-unknown-"; - String s2 = "-unknown-"; - PersonalName n1 = null; - PersonalName n2 = null; - - if (i1 != null && i1.getNames() != null && !i1.getNames().isEmpty()) { - n1 = i1.getNames().get(0); - } - if (i2 != null && i2.getNames() != null && !i2.getNames().isEmpty()) { - n2 = i2.getNames().get(0); - } - - if (n1 != null) { - if (n1.getSurname() == null && n1.getGivenName() == null) { - if (n1.getBasic().contains("/")) { - String sn = n1.getBasic().substring(n1.getBasic().indexOf("/")); - String gn = n1.getBasic().substring(0, n1.getBasic().indexOf("/")); - s1 = sn + ", " + gn; - } - } else { - s1 = n1.getSurname() + ", " + n1.getGivenName(); - } - } - - if (n2 != null) { - if (n2.getSurname() == null && n2.getGivenName() == null) { - if (n2.getBasic().contains("/")) { - String sn = n2.getBasic().substring(n2.getBasic().indexOf("/")); - String gn = n2.getBasic().substring(0, n2.getBasic().indexOf("/")); - s2 = sn + ", " + gn; - } - } else { - s2 = n2.getSurname() + ", " + n2.getGivenName(); - } - } - - return s1.compareTo(s2); - } - - /** - * Get the individual referenced in the result supplied. For families, go with the husband unless there isn't one, in which case - * go with the wife...a sexist strategy to be sure, but one most likely to work with most genealogical records. - * - * @param analysisResult - * the analysis result - * @return the individual referenced. - */ - private Individual getIndividualReferenced(AResult analysisResult) { - if (analysisResult instanceof FamilyRelatedResult) { - return getIndividualReferenced((FamilyRelatedResult) analysisResult); - } - return getIndividualReferenced((IndividualRelatedResult) analysisResult); - } - - /** - * Get the individual referenced in the result supplied. For families, go with the husband unless there isn't one, in which case - * go with the wife...a sexist strategy to be sure, but one most likely to work with most genealogical records. - * - * @param analysisResult - * the analysis result - * @return the individual referenced. - */ - private Individual getIndividualReferenced(FamilyRelatedResult analysisResult) { - Family f = analysisResult.getFamily(); - if (f == null) { - return null; - } - if (f.getHusband() != null) { - return f.getHusband().getIndividual(); - } - return f.getWife() == null ? null : f.getWife().getIndividual(); - - } - - /** - * Get the individual referenced in the result supplied. - * - * @param analysisResult - * the analysis result - * @return the individual referenced. - */ - private Individual getIndividualReferenced(IndividualRelatedResult analysisResult) { - return analysisResult.getIndividual(); - } - -} diff --git a/src/main/java/org/gedantic/analyzer/impl/AdultsWithoutSpousesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/AdultsWithoutSpousesAnalyzer.java index e40f853..e307ccb 100644 --- a/src/main/java/org/gedantic/analyzer/impl/AdultsWithoutSpousesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/AdultsWithoutSpousesAnalyzer.java @@ -32,11 +32,10 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; -import org.gedantic.analyzer.comparator.IndividualResultSortComparator; -import org.gedantic.analyzer.result.DateAndString; -import org.gedantic.analyzer.result.IndividualRelatedResult; +import org.gedantic.analyzer.DateAndString; +import org.gedantic.analyzer.comparator.AnalysisResultComparator; import org.gedantic.web.Constants; import org.gedcom4j.model.Family; import org.gedcom4j.model.FamilySpouse; @@ -55,9 +54,9 @@ public class AdultsWithoutSpousesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { boolean foundSpouse = false; @@ -96,14 +95,16 @@ public List analyze(Gedcom g) { long difference = endDate.getTime() - birthDate.getDate().getTime(); long yearsOld = difference / (365L * 24 * 60 * 60 * 1000); // approximate if (yearsOld >= 18) { - result.add(new IndividualRelatedResult(i, null, (String) null, (deathDate == null || deathDate.getDate() == null - ? "Born " + yearsOld + " years ago with no death date available" : "Lived to " + yearsOld) - + ", but no spouses")); + String itemType = "Individual"; + String item = i.getFormattedName(); + String problemDescription = (deathDate == null || deathDate.getDate() == null ? "Born " + yearsOld + + " years ago with no death date available" : "Lived to " + yearsOld) + ", but no spouses"; + result.add(new AnalysisResult(null, itemType, item, problemDescription)); } } - Collections.sort(result, new IndividualResultSortComparator()); + Collections.sort(result, new AnalysisResultComparator()); return result; } diff --git a/src/main/java/org/gedantic/analyzer/impl/BadEmailAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/BadEmailAnalyzer.java index 5fa1ca6..aef24da 100644 --- a/src/main/java/org/gedantic/analyzer/impl/BadEmailAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/BadEmailAnalyzer.java @@ -31,13 +31,8 @@ import java.util.regex.Pattern; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; -import org.gedantic.analyzer.result.FamilyRelatedResult; -import org.gedantic.analyzer.result.IndividualRelatedResult; -import org.gedantic.analyzer.result.RepositoryRelatedResult; -import org.gedantic.analyzer.result.SubmitterRelatedResult; -import org.gedantic.analyzer.result.UnrelatedResult; import org.gedantic.web.Constants; import org.gedcom4j.model.Family; import org.gedcom4j.model.FamilyEvent; @@ -63,8 +58,8 @@ public class BadEmailAnalyzer extends AAnalyzer { private static final Pattern EMAIL_PATTERN = Pattern.compile("(?i)\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b"); @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); checkHeaderCorporation(g, result); checkIndividuals(g, result); @@ -102,15 +97,15 @@ public AnalysisTag[] getTags() { * @param result * the results we're collecting */ - protected void checkFamilies(Gedcom g, List result) { + protected void checkFamilies(Gedcom g, List 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 FamilyRelatedResult(f, "Email for " + fe.getType().getDisplay() + " event", e - .getValue(), null)); + result.add(new AnalysisResult("Email", fe.getType().getDisplay() + " event for family " + + getFamilyDescriptor(f), e.getValue(), null)); } } } @@ -127,12 +122,12 @@ protected void checkFamilies(Gedcom g, List result) { * @param result * the results we're collecting */ - protected void checkHeaderCorporation(Gedcom g, List result) { + protected void checkHeaderCorporation(Gedcom g, List result) { if (g.getHeader().getSourceSystem() != null && g.getHeader().getSourceSystem().getCorporation() != null && g.getHeader() .getSourceSystem().getCorporation().getEmails() != null) { for (StringWithCustomFacts e : g.getHeader().getSourceSystem().getCorporation().getEmails()) { if (e.getValue() != null && !EMAIL_PATTERN.matcher(e.getValue()).matches()) { - result.add(new UnrelatedResult("Header - Source System", "Email for Corporation", e.getValue(), null)); + result.add(new AnalysisResult("Email", "Header - Source System", e.getValue(), null)); } } } @@ -146,15 +141,15 @@ protected void checkHeaderCorporation(Gedcom g, List result) { * @param result * the results we're collecting */ - protected void checkIndividuals(Gedcom g, List result) { + protected void checkIndividuals(Gedcom g, List result) { for (Individual i : g.getIndividuals().values()) { if (i.getAttributes() != null) { for (IndividualAttribute ia : i.getAttributes()) { if (ia.getEmails() != null) { for (StringWithCustomFacts e : ia.getEmails()) { if (e.getValue() != null && !EMAIL_PATTERN.matcher(e.getValue()).matches()) { - result.add(new IndividualRelatedResult(i, "Email for " + ia.getType().getDisplay() + " attribute", e - .getValue(), null)); + result.add(new AnalysisResult("Email", ia.getType().getDisplay() + " attribute for " + i + .getFormattedName(), e.getValue(), null)); } } } @@ -165,8 +160,8 @@ protected void checkIndividuals(Gedcom g, List result) { if (ie.getEmails() != null) { for (StringWithCustomFacts e : ie.getEmails()) { if (e.getValue() != null && !EMAIL_PATTERN.matcher(e.getValue()).matches()) { - result.add(new IndividualRelatedResult(i, "Email for " + ie.getType().getDisplay() + " event", e - .getValue(), null)); + result.add(new AnalysisResult("Email", ie.getType().getDisplay() + " event for " + i + .getFormattedName(), e.getValue(), null)); } } } @@ -183,12 +178,12 @@ protected void checkIndividuals(Gedcom g, List result) { * @param result * the results we're collecting */ - protected void checkRepositories(Gedcom g, List result) { + protected void checkRepositories(Gedcom g, List result) { for (Repository r : g.getRepositories().values()) { if (r.getEmails() != null) { for (StringWithCustomFacts e : r.getEmails()) { if (e.getValue() != null && !EMAIL_PATTERN.matcher(e.getValue()).matches()) { - result.add(new RepositoryRelatedResult(r, "Email for Repository", e.getValue(), null)); + result.add(new AnalysisResult("Email", "Repository " + r.getName(), e.getValue(), null)); } } } @@ -203,15 +198,44 @@ protected void checkRepositories(Gedcom g, List result) { * @param result * the results we're collecting */ - protected void checkSubmitters(Gedcom g, List result) { + protected void checkSubmitters(Gedcom g, List result) { for (Submitter s : g.getSubmitters().values()) { if (s.getEmails() != null) { for (StringWithCustomFacts e : s.getEmails()) { if (e.getValue() != null && !EMAIL_PATTERN.matcher(e.getValue()).matches()) { - result.add(new SubmitterRelatedResult(s, "Email for Submitter", e.getValue(), null)); + result.add(new AnalysisResult("Email", "Submitter " + s.getName(), e.getValue(), null)); } } } } } + + /** + * Get a textual description of the family (the names of the spouses) + * + * @param f + * the family + * @return a textual description of the family + */ + protected String getFamilyDescriptor(Family f) { + StringBuilder sb = new StringBuilder(); + if (f.getHusband() == null || f.getHusband().getIndividual() == null) { + // Unknown husband + if (f.getWife() == null || f.getWife().getIndividual() == null) { + // Unknown wife too + sb.append("Unknown couple"); + } else { + sb.append(f.getWife().getIndividual().getFormattedName()).append(" and unknown husband"); + } + } else { + sb.append(f.getHusband().getIndividual().getFormattedName()).append(" and "); + if (f.getWife() == null || f.getWife().getIndividual() == null) { + // Unknown wife too + sb.append("unknown wife"); + } else { + sb.append(f.getWife().getIndividual().getFormattedName()); + } + } + return sb.toString(); + } } diff --git a/src/main/java/org/gedantic/analyzer/impl/BirthsToOldParentsAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/BirthsToOldParentsAnalyzer.java index 3a9ddaf..c4cfef9 100644 --- a/src/main/java/org/gedantic/analyzer/impl/BirthsToOldParentsAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/BirthsToOldParentsAnalyzer.java @@ -30,9 +30,9 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; -import org.gedantic.analyzer.result.DateAndString; +import org.gedantic.analyzer.DateAndString; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; import org.gedcom4j.model.Family; @@ -59,8 +59,8 @@ public class BirthsToOldParentsAnalyzer extends AAnalyzer { private static final long MILLIS_IN_YEAR = (long) (365.25 * 24 * 60 * 60 * 1000); @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { // No kids? Not interested diff --git a/src/main/java/org/gedantic/analyzer/impl/BirthsToYoungParentsAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/BirthsToYoungParentsAnalyzer.java index 3075e25..4cddaa4 100644 --- a/src/main/java/org/gedantic/analyzer/impl/BirthsToYoungParentsAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/BirthsToYoungParentsAnalyzer.java @@ -30,9 +30,9 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; -import org.gedantic.analyzer.result.DateAndString; +import org.gedantic.analyzer.DateAndString; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; import org.gedcom4j.model.Family; @@ -59,8 +59,8 @@ public class BirthsToYoungParentsAnalyzer extends AAnalyzer { private static final long MILLIS_IN_YEAR = (long) (365.25 * 24 * 60 * 60 * 1000); @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { // No kids? Not interested diff --git a/src/main/java/org/gedantic/analyzer/impl/ChildrenWithDifferentSurnamesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/ChildrenWithDifferentSurnamesAnalyzer.java index 377a170..2540aa8 100644 --- a/src/main/java/org/gedantic/analyzer/impl/ChildrenWithDifferentSurnamesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/ChildrenWithDifferentSurnamesAnalyzer.java @@ -33,7 +33,7 @@ import java.util.TreeSet; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -52,9 +52,9 @@ public class ChildrenWithDifferentSurnamesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getFamiliesWhereChild() == null || i.getFamiliesWhereChild().isEmpty()) { @@ -80,8 +80,8 @@ public List analyze(Gedcom g) { Set commonSurnames = new TreeSet<>(allParentSurnames); commonSurnames.retainAll(personSurnames); if (commonSurnames.isEmpty()) { - // Found a problem - AResult r = new IndividualRelatedResult(i, null, (String) null, "Individual has surnames " + personSurnames + // Found a problemDescription + AnalysisResult r = new IndividualRelatedResult(i, null, (String) null, "Individual has surnames " + personSurnames + " and parents have surnames " + allParentSurnames); result.add(r); } diff --git a/src/main/java/org/gedantic/analyzer/impl/ChildrenWithSameFirstNamesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/ChildrenWithSameFirstNamesAnalyzer.java index 2f88eee..4fbee81 100644 --- a/src/main/java/org/gedantic/analyzer/impl/ChildrenWithSameFirstNamesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/ChildrenWithSameFirstNamesAnalyzer.java @@ -36,7 +36,7 @@ import java.util.Set; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.MixedResultSortComparator; import org.gedantic.analyzer.result.FamilyRelatedResult; @@ -56,9 +56,9 @@ public class ChildrenWithSameFirstNamesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { if (f.getChildren() == null) { diff --git a/src/main/java/org/gedantic/analyzer/impl/CircularAncestryAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/CircularAncestryAnalyzer.java index 610c231..7109d0c 100644 --- a/src/main/java/org/gedantic/analyzer/impl/CircularAncestryAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/CircularAncestryAnalyzer.java @@ -30,7 +30,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.result.RelationshipRelatedResult; import org.gedantic.web.Constants; @@ -53,8 +53,8 @@ public class CircularAncestryAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { List ancestors = new ArrayList<>(i.getAncestors()); if (ancestors.contains(i)) { diff --git a/src/main/java/org/gedantic/analyzer/impl/ConflictingDatesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/ConflictingDatesAnalyzer.java index 6abf448..926430b 100644 --- a/src/main/java/org/gedantic/analyzer/impl/ConflictingDatesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/ConflictingDatesAnalyzer.java @@ -35,7 +35,7 @@ import java.util.TreeMap; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.MixedResultSortComparator; import org.gedantic.analyzer.result.FamilyRelatedResult; @@ -63,8 +63,8 @@ public class ConflictingDatesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); checkIndividualEvents(g, result); checkFamilyEvents(g, result); @@ -110,7 +110,7 @@ public AnalysisTag[] getTags() { * @param result * the results */ - private void checkFamilyEvents(Gedcom gedcom, List result) { + private void checkFamilyEvents(Gedcom gedcom, List result) { DateParser dp = new DateParser(); for (Family i : gedcom.getFamilies().values()) { Map> indEventsByType = new TreeMap<>(); @@ -172,7 +172,7 @@ private void checkFamilyEvents(Gedcom gedcom, List result) { * @param result * the results */ - private void checkIndividualEvents(Gedcom gedcom, List result) { + private void checkIndividualEvents(Gedcom gedcom, List result) { DateParser dp = new DateParser(); for (Individual i : gedcom.getIndividuals().values()) { Map> indEventsByType = new TreeMap<>(); diff --git a/src/main/java/org/gedantic/analyzer/impl/CouplesWithCommonAncestorsAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/CouplesWithCommonAncestorsAnalyzer.java index b4b0efe..516634d 100644 --- a/src/main/java/org/gedantic/analyzer/impl/CouplesWithCommonAncestorsAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/CouplesWithCommonAncestorsAnalyzer.java @@ -31,7 +31,7 @@ import java.util.Set; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; @@ -48,9 +48,9 @@ public class CouplesWithCommonAncestorsAnalyzer extends AAnalyzer { @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { AncestryCalculator ac = new AncestryCalculator(); - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { if (f.getWife() != null && f.getHusband() != null) { diff --git a/src/main/java/org/gedantic/analyzer/impl/CouplesWithLargeAgeDifferenceAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/CouplesWithLargeAgeDifferenceAnalyzer.java index 7ae92be..bd6304c 100644 --- a/src/main/java/org/gedantic/analyzer/impl/CouplesWithLargeAgeDifferenceAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/CouplesWithLargeAgeDifferenceAnalyzer.java @@ -30,9 +30,9 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; -import org.gedantic.analyzer.result.DateAndString; +import org.gedantic.analyzer.DateAndString; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; import org.gedcom4j.model.Family; @@ -58,8 +58,8 @@ public class CouplesWithLargeAgeDifferenceAnalyzer extends AAnalyzer { private static final long MILLIS_IN_YEAR = (long) (365.25 * 24 * 60 * 60 * 1000); @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { if (f.getHusband() == null || f.getWife() == null) { diff --git a/src/main/java/org/gedantic/analyzer/impl/CouplesWithSameBirthSurnames.java b/src/main/java/org/gedantic/analyzer/impl/CouplesWithSameBirthSurnames.java index 75188f4..71f135b 100644 --- a/src/main/java/org/gedantic/analyzer/impl/CouplesWithSameBirthSurnames.java +++ b/src/main/java/org/gedantic/analyzer/impl/CouplesWithSameBirthSurnames.java @@ -31,7 +31,7 @@ import java.util.Set; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; @@ -46,8 +46,8 @@ public class CouplesWithSameBirthSurnames extends AAnalyzer { @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { if (f.getWife() != null && f.getHusband() != null) { diff --git a/src/main/java/org/gedantic/analyzer/impl/CouplesWithoutChildrenAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/CouplesWithoutChildrenAnalyzer.java index 3a889b7..1dd7bea 100644 --- a/src/main/java/org/gedantic/analyzer/impl/CouplesWithoutChildrenAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/CouplesWithoutChildrenAnalyzer.java @@ -30,7 +30,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; @@ -45,8 +45,8 @@ public class CouplesWithoutChildrenAnalyzer extends AAnalyzer { @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { if (f.getWife() != null && f.getHusband() != null && (f.getChildren() == null || f.getChildren().isEmpty())) { result.add(new FamilyRelatedResult(f, null, (String) null, null)); diff --git a/src/main/java/org/gedantic/analyzer/impl/DatesButNoPlacesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/DatesButNoPlacesAnalyzer.java index f243a74..72a30db 100644 --- a/src/main/java/org/gedantic/analyzer/impl/DatesButNoPlacesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/DatesButNoPlacesAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.MixedResultSortComparator; import org.gedantic.analyzer.result.FamilyRelatedResult; @@ -54,8 +54,8 @@ public class DatesButNoPlacesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { for (IndividualEvent e : i.getEvents()) { boolean hasDate = e.getDate() != null && e.getDate().getValue() != null; diff --git a/src/main/java/org/gedantic/analyzer/impl/DescendantsBornBeforeAncestorsAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/DescendantsBornBeforeAncestorsAnalyzer.java index b5c1088..283928c 100644 --- a/src/main/java/org/gedantic/analyzer/impl/DescendantsBornBeforeAncestorsAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/DescendantsBornBeforeAncestorsAnalyzer.java @@ -31,10 +31,10 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; +import org.gedantic.analyzer.DateAndString; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; -import org.gedantic.analyzer.result.DateAndString; import org.gedantic.analyzer.result.IndividualRelatedResult; import org.gedantic.web.Constants; import org.gedcom4j.model.Gedcom; @@ -52,8 +52,8 @@ public class DescendantsBornBeforeAncestorsAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { DateAndString ibd = getBirthDate(i, ImpreciseDatePreference.FAVOR_EARLIEST); if (ibd == null || ibd.getDate() == null) { diff --git a/src/main/java/org/gedantic/analyzer/impl/EventsWithoutDatesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/EventsWithoutDatesAnalyzer.java index f4c9b44..4799458 100644 --- a/src/main/java/org/gedantic/analyzer/impl/EventsWithoutDatesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/EventsWithoutDatesAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.MixedResultSortComparator; import org.gedantic.analyzer.result.FamilyRelatedResult; @@ -56,8 +56,8 @@ public class EventsWithoutDatesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { for (IndividualEvent e : i.getEvents()) { if (e.getDate() == null || e.getDate().getValue() == null || e.getDate().getValue().trim().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/EventsWithoutPlacesOrDatesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/EventsWithoutPlacesOrDatesAnalyzer.java index 3bc89e7..a5c2506 100644 --- a/src/main/java/org/gedantic/analyzer/impl/EventsWithoutPlacesOrDatesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/EventsWithoutPlacesOrDatesAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.MixedResultSortComparator; import org.gedantic.analyzer.result.FamilyRelatedResult; @@ -56,8 +56,8 @@ public class EventsWithoutPlacesOrDatesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { for (IndividualEvent e : i.getEvents()) { if (e.getDate() != null && e.getDate().getValue() != null && !e.getDate().getValue().trim().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/FactsWithoutSourcesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/FactsWithoutSourcesAnalyzer.java index c040a6c..0630dfa 100644 --- a/src/main/java/org/gedantic/analyzer/impl/FactsWithoutSourcesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/FactsWithoutSourcesAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.MixedResultSortComparator; import org.gedantic.analyzer.result.FamilyRelatedResult; @@ -56,8 +56,8 @@ public class FactsWithoutSourcesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { for (PersonalName n : i.getNames()) { if (n.getCitations().isEmpty()) { @@ -122,11 +122,11 @@ private String getEventShortDescription(AbstractEvent e) { if (e.getDate() != null) { sb.append(e.getDate()); } else { - sb.append("(no value)"); + sb.append("(no item)"); } sb.append(", Place: "); if (e.getPlace() == null || e.getPlace().getPlaceName() == null || e.getPlace().getPlaceName().trim().isEmpty()) { - sb.append("(no value)"); + sb.append("(no item)"); } else { sb.append(e.getPlace().getPlaceName()); } diff --git a/src/main/java/org/gedantic/analyzer/impl/FutureBirthDeathDatesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/FutureBirthDeathDatesAnalyzer.java index 6ad13d9..4a9e209 100644 --- a/src/main/java/org/gedantic/analyzer/impl/FutureBirthDeathDatesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/FutureBirthDeathDatesAnalyzer.java @@ -32,7 +32,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -59,10 +59,10 @@ public class FutureBirthDeathDatesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { Date now = new Date(); - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { List births = i.getEventsOfType(IndividualEventType.BIRTH); diff --git a/src/main/java/org/gedantic/analyzer/impl/MaleWivesFemaleHusbandsAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/MaleWivesFemaleHusbandsAnalyzer.java index 657bfa1..0dee6d9 100644 --- a/src/main/java/org/gedantic/analyzer/impl/MaleWivesFemaleHusbandsAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/MaleWivesFemaleHusbandsAnalyzer.java @@ -30,7 +30,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; @@ -46,8 +46,8 @@ public class MaleWivesFemaleHusbandsAnalyzer extends AAnalyzer { @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { boolean wifeMale = false; boolean husbandFemale = false; diff --git a/src/main/java/org/gedantic/analyzer/impl/MarriagesWithoutDatesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/MarriagesWithoutDatesAnalyzer.java index 6c76b6f..c4090f5 100644 --- a/src/main/java/org/gedantic/analyzer/impl/MarriagesWithoutDatesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/MarriagesWithoutDatesAnalyzer.java @@ -30,7 +30,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; @@ -47,8 +47,8 @@ public class MarriagesWithoutDatesAnalyzer extends AAnalyzer { @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { if (f.getWife() != null && f.getHusband() != null) { // We have a couple diff --git a/src/main/java/org/gedantic/analyzer/impl/MarriedAtYoungAgeAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/MarriedAtYoungAgeAnalyzer.java index ed2900c..570102e 100644 --- a/src/main/java/org/gedantic/analyzer/impl/MarriedAtYoungAgeAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/MarriedAtYoungAgeAnalyzer.java @@ -31,9 +31,9 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; -import org.gedantic.analyzer.result.DateAndString; +import org.gedantic.analyzer.DateAndString; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; import org.gedcom4j.model.Family; @@ -67,8 +67,8 @@ public class MarriedAtYoungAgeAnalyzer extends AAnalyzer { private static final DateParser DP = new DateParser(); @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { if (f.getHusband() == null || f.getWife() == null || f.getEvents() == null || f.getEvents().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/OnlyChildrenAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/OnlyChildrenAnalyzer.java index 57da2b6..85cd45c 100644 --- a/src/main/java/org/gedantic/analyzer/impl/OnlyChildrenAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/OnlyChildrenAnalyzer.java @@ -33,7 +33,7 @@ import java.util.Set; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -52,8 +52,8 @@ public class OnlyChildrenAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getFamiliesWhereChild() == null || i.getFamiliesWhereChild().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWhoLivedPast100Analyzer.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWhoLivedPast100Analyzer.java index 7432ac8..76a64ca 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWhoLivedPast100Analyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWhoLivedPast100Analyzer.java @@ -32,7 +32,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -60,9 +60,9 @@ public class PeopleWhoLivedPast100Analyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { List deaths = i.getEventsOfType(IndividualEventType.DEATH); diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWithOneMissingParentAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWithOneMissingParentAnalyzer.java index 32fd095..bcd96c2 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWithOneMissingParentAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWithOneMissingParentAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -52,8 +52,8 @@ public class PeopleWithOneMissingParentAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getFamiliesWhereChild() != null && !i.getFamiliesWhereChild().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWithOnlySurnamesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWithOnlySurnamesAnalyzer.java index 3994a29..b8b4cce 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWithOnlySurnamesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWithOnlySurnamesAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -51,9 +51,9 @@ public class PeopleWithOnlySurnamesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getNames() == null || i.getNames().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutBirthDatesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutBirthDatesAnalyzer.java index 49c606c..39fb996 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutBirthDatesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutBirthDatesAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -50,9 +50,9 @@ public class PeopleWithoutBirthDatesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getNames() == null || i.getNames().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutDeathEventsAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutDeathEventsAnalyzer.java index 8561296..0d68232 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutDeathEventsAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutDeathEventsAnalyzer.java @@ -32,7 +32,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -60,9 +60,9 @@ public class PeopleWithoutDeathEventsAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getNames() == null || i.getNames().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutNamesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutNamesAnalyzer.java index 8cb7c28..a4ad80a 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutNamesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutNamesAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -50,13 +50,13 @@ public class PeopleWithoutNamesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getNames() == null || i.getNames().isEmpty()) { - AResult r = new IndividualRelatedResult(i, null, (String) null, "Individual has no names"); + AnalysisResult r = new IndividualRelatedResult(i, null, (String) null, "Individual has no names"); result.add(r); } else { for (PersonalName pn : i.getNames()) { @@ -66,7 +66,7 @@ public List analyze(Gedcom g) { boolean noNameIndicated = ("//".equals(pn.getBasic()) || pn.getBasic() == null || "".equals(pn.getBasic() .trim()) || "/".equals(pn.getBasic())); if (noNameIndicated && componentsUnspecified) { - AResult r = new IndividualRelatedResult(i, null, (String) null, "One of this individual's names is blank"); + AnalysisResult r = new IndividualRelatedResult(i, null, (String) null, "One of this individual's names is blank"); result.add(r); } } @@ -107,11 +107,11 @@ public AnalysisTag[] getTags() { } /** - * Return true if the supplied string value is null or empty when trimmed + * Return true if the supplied string item is null or empty when trimmed * * @param s * teh string - * @return true if the supplied string value is null or empty when trimmed + * @return true if the supplied string item is null or empty when trimmed */ private boolean notSpecified(StringWithCustomFacts s) { if (s == null || s.getValue() == null || s.getValue().trim().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutOccupationsAnalysis.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutOccupationsAnalysis.java index cc6f60e..c10b124 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutOccupationsAnalysis.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutOccupationsAnalysis.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -52,9 +52,9 @@ public class PeopleWithoutOccupationsAnalysis extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getNames() == null || i.getNames().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutParentsAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutParentsAnalyzer.java index c94b0d1..ca10864 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutParentsAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutParentsAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -49,8 +49,8 @@ public class PeopleWithoutParentsAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getFamiliesWhereChild() == null || i.getFamiliesWhereChild().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutSurnamesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutSurnamesAnalyzer.java index 29d9d8a..549647d 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutSurnamesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PeopleWithoutSurnamesAnalyzer.java @@ -32,7 +32,7 @@ import java.util.Set; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -51,9 +51,9 @@ public class PeopleWithoutSurnamesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getNames() == null || i.getNames().isEmpty()) { @@ -62,8 +62,8 @@ public List analyze(Gedcom g) { Set personSurnames = getSurnamesFromIndividual(i); if (personSurnames.isEmpty() || (personSurnames.size() == 1 && personSurnames.contains("")) || (personSurnames .size() == 1 && personSurnames.contains("//"))) { - // Found a problem - AResult r = new IndividualRelatedResult(i, null, (String) null, "Individual has no surnames"); + // Found a problemDescription + AnalysisResult r = new IndividualRelatedResult(i, null, (String) null, "Individual has no surnames"); result.add(r); } } diff --git a/src/main/java/org/gedantic/analyzer/impl/PlacesButNoDatesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/PlacesButNoDatesAnalyzer.java index b87507a..62a95ba 100644 --- a/src/main/java/org/gedantic/analyzer/impl/PlacesButNoDatesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/PlacesButNoDatesAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.MixedResultSortComparator; import org.gedantic.analyzer.result.FamilyRelatedResult; @@ -54,8 +54,8 @@ public class PlacesButNoDatesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { for (IndividualEvent e : i.getEvents()) { boolean hasDate = e.getDate() != null && e.getDate().getValue() != null; diff --git a/src/main/java/org/gedantic/analyzer/impl/QuadrupletsAndMoreAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/QuadrupletsAndMoreAnalyzer.java index 41d80e8..8c1a852 100644 --- a/src/main/java/org/gedantic/analyzer/impl/QuadrupletsAndMoreAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/QuadrupletsAndMoreAnalyzer.java @@ -35,9 +35,9 @@ import java.util.Set; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; -import org.gedantic.analyzer.result.DateAndString; +import org.gedantic.analyzer.DateAndString; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; import org.gedcom4j.model.Family; @@ -54,8 +54,8 @@ public class QuadrupletsAndMoreAnalyzer extends AAnalyzer { @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Family f : g.getFamilies().values()) { // If there aren't at least 4 children there's nothing to do with this family @@ -91,9 +91,9 @@ public List analyze(Gedcom g) { /* Look through the birth dates and see if any have 4 or more individuals born on those dates */ for (Entry> e : births.entrySet()) { - if (e.getValue().size() >= 4) { + if (e.getItem().size() >= 4) { // We got a hit, add to results - result.add(new FamilyRelatedResult(f, null, e.getValue(), null)); + result.add(new FamilyRelatedResult(f, null, e.getItem(), null)); } } diff --git a/src/main/java/org/gedantic/analyzer/impl/SimultaneousBirthsInMultipleLocationsAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/SimultaneousBirthsInMultipleLocationsAnalyzer.java index c24c3f1..878d370 100644 --- a/src/main/java/org/gedantic/analyzer/impl/SimultaneousBirthsInMultipleLocationsAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/SimultaneousBirthsInMultipleLocationsAnalyzer.java @@ -36,7 +36,7 @@ import java.util.Set; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.result.FamilyRelatedResult; import org.gedantic.web.Constants; @@ -69,8 +69,8 @@ private class Birth { } @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); DateParser dp = new DateParser(); for (Family f : g.getFamilies().values()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/SourcesWithoutRepositoryCitationsOrMediaAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/SourcesWithoutRepositoryCitationsOrMediaAnalyzer.java index 65a2542..3a29216 100644 --- a/src/main/java/org/gedantic/analyzer/impl/SourcesWithoutRepositoryCitationsOrMediaAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/SourcesWithoutRepositoryCitationsOrMediaAnalyzer.java @@ -30,7 +30,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.result.SourceRelatedResult; import org.gedantic.web.Constants; @@ -41,7 +41,7 @@ /** * Analyzer that finds {@link Source} items without {@link RepositoryCitation} or {@link Multimedia} records attached. Not a - * problem, but a good potential area for more research so the sources can be validated. + * problemDescription, but a good potential area for more research so the sources can be validated. * * @author frizbog */ @@ -51,8 +51,8 @@ public class SourcesWithoutRepositoryCitationsOrMediaAnalyzer extends AAnalyzer * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); if (g == null || g.getSources() == null) { return result; } diff --git a/src/main/java/org/gedantic/analyzer/impl/UnparsableDatesAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/UnparsableDatesAnalyzer.java index 4b210e8..08369ab 100644 --- a/src/main/java/org/gedantic/analyzer/impl/UnparsableDatesAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/UnparsableDatesAnalyzer.java @@ -32,7 +32,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.MixedResultSortComparator; import org.gedantic.analyzer.result.FamilyRelatedResult; @@ -56,9 +56,9 @@ public class UnparsableDatesAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { + public List analyze(Gedcom g) { DateParser dp = new DateParser(); - List result = new ArrayList<>(); + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { for (IndividualEvent e : i.getEvents()) { if (e.getDate() != null && e.getDate().getValue() != null && !e.getDate().getValue().trim().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/impl/UnspecifiedSexAnalyzer.java b/src/main/java/org/gedantic/analyzer/impl/UnspecifiedSexAnalyzer.java index 6ce1903..e82de96 100644 --- a/src/main/java/org/gedantic/analyzer/impl/UnspecifiedSexAnalyzer.java +++ b/src/main/java/org/gedantic/analyzer/impl/UnspecifiedSexAnalyzer.java @@ -31,7 +31,7 @@ import java.util.List; import org.gedantic.analyzer.AAnalyzer; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalysisTag; import org.gedantic.analyzer.comparator.IndividualResultSortComparator; import org.gedantic.analyzer.result.IndividualRelatedResult; @@ -48,8 +48,8 @@ public class UnspecifiedSexAnalyzer extends AAnalyzer { * {@inheritDoc} */ @Override - public List analyze(Gedcom g) { - List result = new ArrayList<>(); + public List analyze(Gedcom g) { + List result = new ArrayList<>(); for (Individual i : g.getIndividuals().values()) { if (i.getSex() == null || i.getSex().getValue().trim().isEmpty()) { diff --git a/src/main/java/org/gedantic/analyzer/result/FamilyRelatedResult.java b/src/main/java/org/gedantic/analyzer/result/FamilyRelatedResult.java deleted file mode 100644 index 2278dba..0000000 --- a/src/main/java/org/gedantic/analyzer/result/FamilyRelatedResult.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.result; - -import java.util.Set; - -import org.gedantic.analyzer.AResult; -import org.gedcom4j.model.Family; -import org.gedcom4j.model.Individual; - -/** - * An analysis result about a specific family. Immutable. - * - * @author frizbog - */ -public class FamilyRelatedResult extends AResult { - /** - * The Family - */ - private final Family family; - - /** - * Constructor - * - * @param family - * the family with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the individual that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public FamilyRelatedResult(Family family, String factType, Individual value, String problem) { - super(factType, value, problem); - this.family = family; - } - - /** - * Constructor - * - * @param family - * the family with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the individuals that were problematic - optional, usually a list of children - * @param problem - * a description of the problem - optional - */ - public FamilyRelatedResult(Family family, String factType, Set value, String problem) { - super(factType, value, problem); - this.family = family; - } - - /** - * Constructor - * - * @param family - * the family with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the value that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public FamilyRelatedResult(Family family, String factType, String value, String problem) { - super(factType, value, problem); - this.family = family; - } - - /** - * Get the family - * - * @return the family - */ - public Family getFamily() { - return family; - } -} diff --git a/src/main/java/org/gedantic/analyzer/result/IndividualRelatedResult.java b/src/main/java/org/gedantic/analyzer/result/IndividualRelatedResult.java deleted file mode 100644 index f5850bd..0000000 --- a/src/main/java/org/gedantic/analyzer/result/IndividualRelatedResult.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.result; - -import org.gedantic.analyzer.AResult; -import org.gedcom4j.model.Individual; - -/** - * An analysis result about a specific individual. Immutable. - * - * @author frizbog - */ -public class IndividualRelatedResult extends AResult { - /** - * The individual - */ - private final Individual individual; - - /** - * Constructor - * - * @param individual - * the individual with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the other individual that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public IndividualRelatedResult(Individual individual, String factType, Individual value, String problem) { - super(factType, value, problem); - this.individual = individual; - } - - /** - * Constructor - * - * @param individual - * the individual with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the value that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public IndividualRelatedResult(Individual individual, String factType, String value, String problem) { - super(factType, value, problem); - this.individual = individual; - } - - /** - * Get the individual - * - * @return the individual - */ - public Individual getIndividual() { - return individual; - } -} diff --git a/src/main/java/org/gedantic/analyzer/result/RelationshipRelatedResult.java b/src/main/java/org/gedantic/analyzer/result/RelationshipRelatedResult.java deleted file mode 100644 index 546cb0d..0000000 --- a/src/main/java/org/gedantic/analyzer/result/RelationshipRelatedResult.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.result; - -import java.util.List; - -import org.gedantic.analyzer.AResult; -import org.gedcom4j.model.Individual; -import org.gedcom4j.relationship.SimpleRelationship; - -/** - * An analysis result about a relationship between two people. Immutable. - * - * @author frizbog - */ -public class RelationshipRelatedResult extends AResult { - /** - * The individual - */ - private final Individual individual; - - /** - * Constructor - * - * @param individual - * the individual with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the value that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public RelationshipRelatedResult(Individual individual, String factType, List> value, String problem) { - super(factType, value, problem); - this.individual = individual; - } - - /** - * Get the individual - * - * @return the individual - */ - public Individual getIndividual() { - return individual; - } -} diff --git a/src/main/java/org/gedantic/analyzer/result/RepositoryRelatedResult.java b/src/main/java/org/gedantic/analyzer/result/RepositoryRelatedResult.java deleted file mode 100644 index b37880a..0000000 --- a/src/main/java/org/gedantic/analyzer/result/RepositoryRelatedResult.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.result; - -import org.gedantic.analyzer.AResult; -import org.gedcom4j.model.Repository; - -/** - * An analysis result about a {@link Repository} - * - * @author frizbog - */ -public class RepositoryRelatedResult extends AResult { - - /** - * The repository this result is about - */ - private final Repository repo; - - /** - * Constructor - * - * @param repo - * the repo with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the value that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public RepositoryRelatedResult(Repository repo, String factType, String value, String problem) { - super(factType, value, problem); - this.repo = repo; - } - - /** - * Get the source - * - * @return the source - */ - public Repository getRepository() { - return repo; - } - -} diff --git a/src/main/java/org/gedantic/analyzer/result/SourceRelatedResult.java b/src/main/java/org/gedantic/analyzer/result/SourceRelatedResult.java deleted file mode 100644 index 4a15c5e..0000000 --- a/src/main/java/org/gedantic/analyzer/result/SourceRelatedResult.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.result; - -import org.gedantic.analyzer.AResult; -import org.gedcom4j.model.Source; - -/** - * An analysis result about a {@link Source} - * - * @author frizbog - */ -public class SourceRelatedResult extends AResult { - - /** - * The source this result is about - */ - private final Source source; - - /** - * Constructor - * - * @param source - * the source with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the value that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public SourceRelatedResult(Source source, String factType, String value, String problem) { - super(factType, value, problem); - this.source = source; - } - - /** - * Get the source - * @return the source - */ - public Source getSource() { - return source; - } - -} diff --git a/src/main/java/org/gedantic/analyzer/result/SubmitterRelatedResult.java b/src/main/java/org/gedantic/analyzer/result/SubmitterRelatedResult.java deleted file mode 100644 index 4418b19..0000000 --- a/src/main/java/org/gedantic/analyzer/result/SubmitterRelatedResult.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.result; - -import org.gedantic.analyzer.AResult; -import org.gedcom4j.model.Submitter; - -/** - * An analysis result about a {@link Submitter} - * - * @author frizbog - */ -public class SubmitterRelatedResult extends AResult { - - /** - * The submitter this result is about - */ - private final Submitter submitter; - - /** - * Constructor - * - * @param submitter - * the submitter with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the value that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public SubmitterRelatedResult(Submitter submitter, String factType, String value, String problem) { - super(factType, value, problem); - this.submitter = submitter; - } - - /** - * Get the source - * - * @return the source - */ - public Submitter getSubmitter() { - return submitter; - } - -} diff --git a/src/main/java/org/gedantic/analyzer/result/UnrelatedResult.java b/src/main/java/org/gedantic/analyzer/result/UnrelatedResult.java deleted file mode 100644 index b9826a0..0000000 --- a/src/main/java/org/gedantic/analyzer/result/UnrelatedResult.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -package org.gedantic.analyzer.result; - -import org.gedantic.analyzer.AResult; - -/** - * An analysis result about a generic object which is described with a string rather than a reference to an object - * - * @author frizbog - */ -public class UnrelatedResult extends AResult { - - /** - * The item this result is about - */ - private final String item; - - /** - * Constructor - * - * @param item - * a description of the item with the finding - * @param factType - * the fact that the finding relates to - optional - * @param value - * the value that was problematic - optional - * @param problem - * a description of the problem - optional - */ - public UnrelatedResult(String item, String factType, String value, String problem) { - super(factType, value, problem); - this.item = item; - } - - /** - * Get the item description - * - * @return the item - */ - public String getItem() { - return item; - } - -} diff --git a/src/main/java/org/gedantic/analyzer/result/package-info.java b/src/main/java/org/gedantic/analyzer/result/package-info.java deleted file mode 100644 index 8f69284..0000000 --- a/src/main/java/org/gedantic/analyzer/result/package-info.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2016 Matthew R. Harrah - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -/** - * Result types from analyzers. - * - * @author frizbog - */ -package org.gedantic.analyzer.result; \ No newline at end of file diff --git a/src/main/java/org/gedantic/web/servlet/AnalyzerServlet.java b/src/main/java/org/gedantic/web/servlet/AnalyzerServlet.java index c9dc234..88cfc21 100644 --- a/src/main/java/org/gedantic/web/servlet/AnalyzerServlet.java +++ b/src/main/java/org/gedantic/web/servlet/AnalyzerServlet.java @@ -37,7 +37,7 @@ import org.apache.commons.lang.StringEscapeUtils; import org.apache.poi.ss.usermodel.Workbook; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.AnalyzerList; import org.gedantic.analyzer.IAnalyzer; import org.gedantic.web.Constants; @@ -78,9 +78,9 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S * @param resp * the http response * @throws ServletException - * if there is a code-related problem + * if there is a code-related problemDescription * @throws IOException - * if there is a network or storage-related problem + * if there is a network or storage-related problemDescription */ private void process(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); @@ -119,7 +119,7 @@ private void process(HttpServletRequest req, HttpServletResponse resp) throws Se LOG.info("before analysis " + a.getId() + " - freeMemory:" + Double.toString(freeMemory / (1024 * 1024)) + " maxMemory:" + Double.toString(maxMemory / (1024 * 1024))); - List results = a.analyze(g); + List results = a.analyze(g); maxMemory = rt.maxMemory(); freeMemory = rt.freeMemory(); diff --git a/src/main/java/org/gedantic/web/servlet/WorkbookCreator.java b/src/main/java/org/gedantic/web/servlet/WorkbookCreator.java index d42ca01..6957b3a 100644 --- a/src/main/java/org/gedantic/web/servlet/WorkbookCreator.java +++ b/src/main/java/org/gedantic/web/servlet/WorkbookCreator.java @@ -27,9 +27,7 @@ package org.gedantic.web.servlet; import java.util.List; -import java.util.Set; -import org.apache.commons.lang.StringEscapeUtils; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Font; @@ -43,17 +41,8 @@ import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFColor; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.gedantic.analyzer.AResult; +import org.gedantic.analyzer.AnalysisResult; import org.gedantic.analyzer.IAnalyzer; -import org.gedantic.analyzer.result.FamilyRelatedResult; -import org.gedantic.analyzer.result.IndividualRelatedResult; -import org.gedantic.analyzer.result.RelationshipRelatedResult; -import org.gedantic.analyzer.result.RepositoryRelatedResult; -import org.gedantic.analyzer.result.SourceRelatedResult; -import org.gedantic.analyzer.result.SubmitterRelatedResult; -import org.gedantic.analyzer.result.UnrelatedResult; -import org.gedcom4j.model.Individual; -import org.gedcom4j.relationship.SimpleRelationship; /** * Class for creating an Excel workbook from the results. @@ -63,7 +52,7 @@ public class WorkbookCreator { /** The results. */ - private final List results; + private final List results; /** The analyzer. */ private final IAnalyzer analyzer; @@ -112,7 +101,7 @@ public class WorkbookCreator { * @param results * the results */ - public WorkbookCreator(IAnalyzer analyzer, List results) { + public WorkbookCreator(IAnalyzer analyzer, List results) { this.analyzer = analyzer; this.results = results; } @@ -142,71 +131,6 @@ public Workbook create() { return wb; } - /** - * Adds the family row. - * - * @param frr - * the family related result - */ - private void addFamilyRow(FamilyRelatedResult frr) { - cell.setCellValue("Family"); - Individual husband = frr.getFamily().getHusband() == null ? null : frr.getFamily().getHusband().getIndividual(); - Individual wife = frr.getFamily().getWife() == null ? null : frr.getFamily().getWife().getIndividual(); - - StringBuilder sb = new StringBuilder(); - if (husband != null) { - sb.append(husband.getFormattedName()); - } else { - sb.append("Unknown"); - } - sb.append(" and "); - if (wife != null) { - sb.append(wife.getFormattedName()); - } else { - sb.append("Unknown"); - } - - nextCol(); - cell.setCellValue(sb.toString()); - - nextCol(); - cell.setCellValue(frr.getFactType()); - - nextCol(); - if (frr.getValue() != null) { - if (frr.getValue() instanceof Individual) { - Individual i = (Individual) frr.getValue(); - cell.setCellValue(i.getFormattedName()); - } else if (frr.getValue() instanceof Set) { - @SuppressWarnings("unchecked") - Set others = (Set) frr.getValue(); - - short c = colNum; - boolean first = true; - for (Individual i : others) { - if (!first) { - nextRow(); - colNum = (short) (c - 1); - nextCol(); - } else { - first = false; - nextCol(); - cell.setCellValue(frr.getProblem()); - colNum = (short) (c - 1); - nextCol(); - } - cell.setCellValue(i.getFormattedName()); - } - } else { - cell.setCellValue(StringEscapeUtils.unescapeHtml(frr.getValue().toString())); - } - } - - nextCol(); - cell.setCellValue(frr.getProblem()); - - } - /** * Adds the footer. */ @@ -249,176 +173,24 @@ private void addHeaders() { } - /** - * Adds the individual row. - * - * @param irr - * the individual related result - */ - private void addIndividualRow(IndividualRelatedResult irr) { - cell.setCellValue("Individual"); - - nextCol(); - cell.setCellValue(irr.getIndividual().getFormattedName()); - - nextCol(); - cell.setCellValue(irr.getFactType()); - - nextCol(); - if (irr.getValue() instanceof Individual) { - Individual i = (Individual) irr.getValue(); - cell.setCellValue(i.getFormattedName()); - } else { - if (irr.getValue() != null) { - cell.setCellValue(StringEscapeUtils.unescapeHtml(irr.getValue().toString())); - } - } - - nextCol(); - cell.setCellValue(irr.getProblem()); - } - - /** - * Adds the relationship row. - * - * @param rrr - * the relationship-related result - */ - private void addRelationshipRow(RelationshipRelatedResult rrr) { - cell.setCellValue(rrr.getIndividual().getFormattedName()); - - nextCol(); - cell.setCellValue(rrr.getFactType()); - - nextCol(); - @SuppressWarnings("unchecked") - List> path = (List>) rrr.getValue(); - - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < path.size(); i++) { - List chain = path.get(i); - for (int j = 0; j < chain.size(); j++) { - if (j > 0) { - sb.append("\n"); - } - SimpleRelationship sr = chain.get(j); - - sb.append(sr.getIndividual1().getFormattedName()); - if (sr.getName() == null) { - sb.append(" > UNKNOWN RELATIONSHIP TYPE > "); - } else { - sb.append(" > " + sr.getName().toString() + " > "); - } - sb.append(sr.getIndividual2().getFormattedName()); - - } - nextCol(); - cell.setCellValue(sb.toString()); - } - nextCol(); - cell.setCellValue(rrr.getProblem()); - } - - /** - * Adds the repository row. - * - * @param rrr - * the repository-related result - */ - private void addRepositoryRow(RepositoryRelatedResult rrr) { - cell.setCellValue("Repository"); - - nextCol(); - cell.setCellValue(rrr.getRepository().getName().getValue()); - - nextCol(); - cell.setCellValue(rrr.getFactType()); - - nextCol(); - if (rrr.getValue() != null) { - cell.setCellValue(StringEscapeUtils.unescapeHtml(rrr.getValue().toString())); - } - - nextCol(); - cell.setCellValue(rrr.getProblem()); - } - /** * Adds the rows of data. */ private void addRowsOfData() { - for (AResult r : results) { + for (AnalysisResult r : results) { nextRow(); - if (r instanceof IndividualRelatedResult) { - addIndividualRow((IndividualRelatedResult) r); - } else if (r instanceof FamilyRelatedResult) { - addFamilyRow((FamilyRelatedResult) r); - } else if (r instanceof RelationshipRelatedResult) { - addRelationshipRow((RelationshipRelatedResult) r); - } else if (r instanceof SourceRelatedResult) { - addSourceRow((SourceRelatedResult) r); - } else if (r instanceof RepositoryRelatedResult) { - addRepositoryRow((RepositoryRelatedResult) r); - } else if (r instanceof SubmitterRelatedResult) { - addSubmitterRow((SubmitterRelatedResult) r); - } else if (r instanceof UnrelatedResult) { - addUnrelatedRow((UnrelatedResult) r); - } else { - cell.setCellValue("Unknown row type - " + r.getClass().getName()); - nextRow(); - } - } - - } - - /** - * Adds the source row. - * - * @param srr - * the source-related result - */ - private void addSourceRow(SourceRelatedResult srr) { - cell.setCellValue("Source"); - - nextCol(); - cell.setCellValue(srr.getSource().getTitle().getLines().get(0)); - - nextCol(); - cell.setCellValue(srr.getFactType()); - - nextCol(); - if (srr.getValue() != null) { - cell.setCellValue(StringEscapeUtils.unescapeHtml(srr.getValue().toString())); - } - - nextCol(); - cell.setCellValue(srr.getProblem()); - } - - /** - * Adds the submitter row. - * - * @param sr - * the submitter-related result - */ - private void addSubmitterRow(SubmitterRelatedResult sr) { - cell.setCellValue("Miscellaneous"); + cell.setCellValue(r.getItemType()); - nextCol(); - if (sr.getSubmitter() != null && sr.getSubmitter().getName() != null) { - cell.setCellValue(sr.getSubmitter().getName().getValue()); - } + nextCol(); + cell.setCellValue(r.getItem()); - nextCol(); - cell.setCellValue(sr.getFactType()); + nextCol(); + cell.setCellValue(r.getFactType()); - nextCol(); - if (sr.getValue() != null) { - cell.setCellValue(StringEscapeUtils.unescapeHtml(sr.getValue().toString())); + nextCol(); + cell.setCellValue(r.getProblemDescription()); } - nextCol(); - cell.setCellValue(sr.getProblem()); } /** @@ -436,30 +208,6 @@ private void addTitleAndSubTitle() { nextRow(); } - /** - * Adds the unrelated row. - * - * @param ur - * the ur - */ - private void addUnrelatedRow(UnrelatedResult ur) { - cell.setCellValue("Miscellaneous"); - - nextCol(); - cell.setCellValue(ur.getItem()); - - nextCol(); - cell.setCellValue(ur.getFactType()); - - nextCol(); - if (ur.getValue() != null) { - cell.setCellValue(StringEscapeUtils.unescapeHtml(ur.getValue().toString())); - } - - nextCol(); - cell.setCellValue(ur.getProblem()); - } - /** * Autofit columns. */