--- /dev/null
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.model.name;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.persistence.Transient;
+
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+
+/**
+ * @author a.mueller
+ * @date 21.01.2017
+ *
+ */
+public interface INonViralName<T extends NonViralName> extends ITaxonNameBase<T>{
+
+ /**
+ * Creates a new {@link HybridRelationship#HybridRelationship(TaxonNameBase, TaxonNameBase, HybridRelationshipType, String) hybrid relationship}
+ * to <i>this</i> non viral name. A HybridRelationship may be of type
+ * "is first/second parent" or "is male/female parent". By invoking this
+ * method <i>this</i> non viral name becomes a parent of the hybrid child
+ * non viral name.
+ *
+ * @param childName the non viral name of the child for this new hybrid name relationship
+ * @param type the type of this new name relationship
+ * @param ruleConsidered the string which specifies the rule on which this name relationship is based
+ * @return
+ * @see #addHybridParent(TaxonNameBase, HybridRelationshipType,String )
+ * @see #getRelationsToThisName()
+ * @see #getNameRelations()
+ * @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
+ * @see #addNameRelationship(NameRelationship)
+ */
+ public HybridRelationship addHybridChild(NonViralName childName, HybridRelationshipType type, String ruleConsidered);
+
+ /**
+ * Creates a new {@link HybridRelationship#HybridRelationship(TaxonNameBase, TaxonNameBase, HybridRelationshipType, String) hybrid relationship}
+ * to <i>this</i> non viral name. A HybridRelationship may be of type
+ * "is first/second parent" or "is male/female parent". By invoking this
+ * method <i>this</i> non viral name becomes a hybrid child of the parent
+ * non viral name.
+ *
+ * @param parentName the non viral name of the parent for this new hybrid name relationship
+ * @param type the type of this new name relationship
+ * @param ruleConsidered the string which specifies the rule on which this name relationship is based
+ * @return
+ * @see #addHybridChild(TaxonNameBase, HybridRelationshipType,String )
+ * @see #getRelationsToThisName()
+ * @see #getNameRelations()
+ * @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
+ * @see #addNameRelationship(NameRelationship)
+ */
+ public HybridRelationship addHybridParent(NonViralName parentName, HybridRelationshipType type, String ruleConsidered);
+
+ /**
+ * Shortcut. Returns the basionym authors title cache. Returns null if no basionym author exists.
+ * @return
+ */
+ public String computeBasionymAuthorNomenclaturalTitle() ;
+
+ /**
+ * Shortcut. Returns the combination authors title cache. Returns null if no combination author exists.
+ * @return
+ */
+ public String computeCombinationAuthorNomenclaturalTitle();
+
+ /**
+ * Shortcut. Returns the ex-basionym authors title cache. Returns null if no exbasionym author exists.
+ * @return
+ */
+ public String computeExBasionymAuthorNomenclaturalTitle();
+
+ /**
+ * Shortcut. Returns the ex-combination authors title cache. Returns null if no ex-combination author exists.
+ * @return
+ */
+ public String computeExCombinationAuthorNomenclaturalTitle();
+
+ /**
+ * Generates and returns a concatenated and formatted author teams string
+ * including basionym and combination authors of <i>this</i> non viral taxon name
+ * according to the strategy defined in
+ * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName) INonViralNameCacheStrategy}.
+ *
+ * @return the string with the concatenated and formated author teams for <i>this</i> non viral taxon name
+ * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName)
+ */
+ public String generateAuthorship();
+
+
+ /**
+ * Returns the concatenated and formatted author teams string including
+ * basionym and combination authors of <i>this</i> non viral taxon name.
+ * If the protectedAuthorshipCache flag is set this method returns the
+ * string stored in the the authorshipCache attribute, otherwise it
+ * generates the complete authorship string, returns it and stores it in
+ * the authorshipCache attribute.
+ *
+ * @return the string with the concatenated and formated author teams for <i>this</i> non viral taxon name
+ * @see #generateAuthorship()
+ */
+ @Transient
+ public String getAuthorshipCache();
+
+ /**
+ * Returns the {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase author (team)} that published the original combination
+ * on which <i>this</i> non viral taxon name is nomenclaturally based. Such an
+ * author (team) can only exist if <i>this</i> non viral taxon name is a new
+ * combination due to a taxonomical revision.
+ *
+ * @return the nomenclatural basionym author (team) of <i>this</i> non viral taxon name
+ * @see #getCombinationAuthorship()
+ * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
+ * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
+ */
+ public TeamOrPersonBase<?> getBasionymAuthorship();
+
+ /**
+ * Returns the {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase author (team)} that published <i>this</i> non viral
+ * taxon name.
+ *
+ * @return the nomenclatural author (team) of <i>this</i> non viral taxon name
+ * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
+ * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
+ */
+ public TeamOrPersonBase<?> getCombinationAuthorship();
+
+
+ /**
+ * Returns the {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase author (team)} that contributed to
+ * the publication of the original combination <i>this</i> non viral taxon name is
+ * based on. This should have been generally stated by
+ * the {@link #getBasionymAuthorship() basionym author (team)} itself.
+ * The presence of a basionym author (team) of <i>this</i> non viral taxon name is a
+ * condition for the existence of an ex basionym author (team)
+ * for <i>this</i> same name.
+ *
+ * @return the nomenclatural ex basionym author (team) of <i>this</i> non viral taxon name
+ * @see #getBasionymAuthorship()
+ * @see #getExCombinationAuthorship()
+ * @see #getCombinationAuthorship()
+ * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
+ * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
+ */
+ public TeamOrPersonBase<?> getExBasionymAuthorship();
+
+ /**
+ * Returns the {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase author (team)} that contributed to
+ * the publication of <i>this</i> non viral taxon name as generally stated by
+ * the {@link #getCombinationAuthorship() combination author (team)} itself.<BR>
+ * An ex-author(-team) is an author(-team) to whom a taxon name was ascribed
+ * although it is not the author(-team) of a valid publication (for instance
+ * without the validating description or diagnosis in case of a name for a
+ * new taxon). The name of this ascribed authorship, followed by "ex", may
+ * be inserted before the name(s) of the publishing author(s) of the validly
+ * published name:<BR>
+ * <i>Lilium tianschanicum</i> was described by Grubov (1977) as a new species and
+ * its name was ascribed to Ivanova; since there is no indication that
+ * Ivanova provided the validating description, the name may be cited as
+ * <i>Lilium tianschanicum</i> N. A. Ivanova ex Grubov or <i>Lilium tianschanicum</i> Grubov.
+ * <P>
+ * The presence of an author (team) of <i>this</i> non viral taxon name is a
+ * condition for the existence of an ex author (team) for <i>this</i> same name.
+ *
+ * @return the nomenclatural ex author (team) of <i>this</i> non viral taxon name
+ * @see #getCombinationAuthorship()
+ * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
+ * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
+ */
+ public TeamOrPersonBase<?> getExCombinationAuthorship();
+
+ /**
+ * Returns either the scientific name string (without authorship) for <i>this</i>
+ * non viral taxon name if its rank is genus or higher (monomial) or the string for
+ * the genus part of it if its {@link Rank rank} is lower than genus (bi- or trinomial).
+ * Genus or uninomial strings begin with an upper case letter.
+ *
+ * @return the string containing the suprageneric name, the genus name or the genus part of <i>this</i> non viral taxon name
+ * @see #getNameCache()
+ */
+ public String getGenusOrUninomial();
+
+ /**
+ * Returns the set of all {@link HybridRelationship hybrid relationships}
+ * in which <i>this</i> taxon name is involved as a {@link common.RelationshipBase#getRelatedTo() child}.
+ *
+ * @see #getHybridRelationships()
+ * @see #getParentRelationships()
+ * @see HybridRelationshipType
+ */
+ public Set<HybridRelationship> getHybridChildRelations();
+
+ /**
+ * Returns the set of all {@link HybridRelationship hybrid relationships}
+ * in which <i>this</i> taxon name is involved as a {@link common.RelationshipBase#getRelatedFrom() parent}.
+ *
+ * @see #getHybridRelationships()
+ * @see #getChildRelationships()
+ * @see HybridRelationshipType
+ */
+ public Set<HybridRelationship> getHybridParentRelations();
+
+ /**
+ * Returns the genus subdivision epithet string (infrageneric part) for
+ * <i>this</i> non viral taxon name if its {@link Rank rank} is infrageneric (lower than genus and
+ * higher than species aggregate: binomial). Genus subdivision epithet
+ * strings begin with an upper case letter.
+ *
+ * @return the string containing the infrageneric part of <i>this</i> non viral taxon name
+ * @see #getNameCache()
+ */
+ public String getInfraGenericEpithet();
+
+ /**
+ * Returns the species epithet string for <i>this</i> non viral taxon name if its {@link Rank rank} is
+ * species aggregate or lower (bi- or trinomial). Species epithet strings
+ * begin with a lower case letter.
+ *
+ * @return the string containing the species epithet of <i>this</i> non viral taxon name
+ * @see #getNameCache()
+ */
+ public String getSpecificEpithet();
+
+ /**
+ * Returns the species subdivision epithet string (infraspecific part) for
+ * <i>this</i> non viral taxon name if its {@link Rank rank} is infraspecific
+ * (lower than species: trinomial). Species subdivision epithet strings
+ * begin with a lower case letter.
+ *
+ * @return the string containing the infraspecific part of <i>this</i> non viral taxon name
+ * @see #getNameCache()
+ */
+ public String getInfraSpecificEpithet();
+
+
+ /**
+ * Defines the last part of the name.
+ * This is for infraspecific taxa, the infraspecific epithet,
+ * for species the specific epithet, for infageneric taxa the infrageneric epithet
+ * else the genusOrUninomial.
+ * However, the result does not depend on the rank (which may be not correctly set
+ * in case of dirty data) but returns the first name part which is not blank
+ * considering the above order.
+ * @return the first not blank name part in reverse order
+ */
+ public String getLastNamePart();
+
+ /**
+ * Returns or generates the nameCache (scientific name
+ * without author strings and year) string for <i>this</i> non viral taxon name. If the
+ * {@link #isProtectedNameCache() protectedNameCache} flag is not set (False)
+ * the string will be generated according to a defined strategy,
+ * otherwise the value of the actual nameCache string will be returned.
+ *
+ * @return the string which identifies <i>this</i> non viral taxon name (without authors or year)
+ * @see #generateNameCache()
+ */
+ @Transient
+ public String getNameCache() ;
+
+ /**
+ * Returns the hybrid child relationships ordered by relationship type, or if equal
+ * by title cache of the related names.
+ * @see #getHybridParentRelations()
+ */
+ @Transient
+ public List<HybridRelationship> getOrderedChildRelationships();
+
+ /**
+ * Tests if the given name has any authors.
+ * @return false if no author ((ex)combination or (ex)basionym) exists, true otherwise
+ */
+ public boolean hasAuthors();
+
+ /**
+ * Needs to be implemented by those classes that handle autonyms (e.g. botanical names).
+ **/
+ @Transient
+ public boolean isAutonym();
+
+
+ /**
+ * Returns the boolean value of the flag indicating whether the name of <i>this</i>
+ * botanical taxon name is a hybrid formula (true) or not (false). A hybrid
+ * named by a hybrid formula (composed with its parent names by placing the
+ * multiplication sign between them) does not have an own published name
+ * and therefore has neither an {@link NonViralName#getAuthorshipCache() autorship}
+ * nor other name components. If this flag is set no other hybrid flags may
+ * be set.
+ *
+ * @return the boolean value of the isHybridFormula flag
+ * @see #isMonomHybrid()
+ * @see #isBinomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public boolean isHybridFormula();
+
+ /**
+ * Returns the boolean value of the flag indicating whether <i>this</i> botanical
+ * taxon name is the name of an intergeneric hybrid (true) or not (false).
+ * In this case the multiplication sign is placed before the scientific
+ * name. If this flag is set no other hybrid flags may be set.
+ *
+ * @return the boolean value of the isMonomHybrid flag
+ * @see #isHybridFormula()
+ * @see #isBinomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public boolean isMonomHybrid();
+
+ /**
+ * Returns the boolean value of the flag indicating whether <i>this</i> botanical
+ * taxon name is the name of an interspecific hybrid (true) or not (false).
+ * In this case the multiplication sign is placed before the species
+ * epithet. If this flag is set no other hybrid flags may be set.
+ *
+ * @return the boolean value of the isBinomHybrid flag
+ * @see #isHybridFormula()
+ * @see #isMonomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public boolean isBinomHybrid();
+
+ /**
+ * Returns the boolean value of the flag indicating whether <i>this</i> botanical
+ * taxon name is the name of an infraspecific hybrid (true) or not (false).
+ * In this case the term "notho-" (optionally abbreviated "n-") is used as
+ * a prefix to the term denoting the infraspecific rank of <i>this</i> botanical
+ * taxon name. If this flag is set no other hybrid flags may be set.
+ *
+ * @return the boolean value of the isTrinomHybrid flag
+ * @see #isHybridFormula()
+ * @see #isMonomHybrid()
+ * @see #isBinomHybrid()
+ */
+ public boolean isTrinomHybrid();
+
+
+ /**
+ * Returns the boolean value of the flag intended to protect (true)
+ * or not (false) the {@link #getAuthorshipCache() authorshipCache} (complete authorship string)
+ * of <i>this</i> non viral taxon name.
+ *
+ * @return the boolean value of the protectedAuthorshipCache flag
+ * @see #getAuthorshipCache()
+ */
+ public boolean isProtectedAuthorshipCache();
+
+
+ /**
+ * Returns the boolean value of the flag intended to protect (true)
+ * or not (false) the {@link #getNameCache() nameCache} (scientific name without author strings and year)
+ * string of <i>this</i> non viral taxon name.
+ *
+ * @return the boolean value of the protectedNameCache flag
+ * @see #getNameCache()
+ */
+ public boolean isProtectedNameCache();
+
+ public void removeHybridChild(NonViralName child);
+
+ public void removeHybridParent(NonViralName parent);
+
+ /**
+ * Removes one {@link HybridRelationship hybrid relationship} from the set of
+ * {@link #getHybridRelationships() hybrid relationships} in which <i>this</i> botanical taxon name
+ * is involved. The hybrid relationship will also be removed from the set
+ * belonging to the second botanical taxon name involved.
+ *
+ * @param relationship the hybrid relationship which should be deleted from the corresponding sets
+ * @see #getHybridRelationships()
+ */
+ public void removeHybridRelationship(HybridRelationship hybridRelation);
+
+ /**
+ * Assigns an authorshipCache string to <i>this</i> non viral taxon name. Sets the isProtectedAuthorshipCache
+ * flag to <code>true</code>.
+ *
+ * @param authorshipCache the string which identifies the complete authorship of <i>this</i> non viral taxon name
+ * @see #getAuthorshipCache()
+ */
+ public void setAuthorshipCache(String authorshipCache);
+
+
+ /**
+ * Assigns an authorshipCache string to <i>this</i> non viral taxon name.
+ *
+ * @param authorshipCache the string which identifies the complete authorship of <i>this</i> non viral taxon name
+ * @param protectedAuthorshipCache if true the isProtectedAuthorshipCache flag is set to <code>true</code>, otherwise
+ * the flag is set to <code>false</code>.
+ * @see #getAuthorshipCache()
+ */
+ public void setAuthorshipCache(String authorshipCache, boolean protectedAuthorshipCache);
+
+ /**
+ * @see #getBasionymAuthorship()
+ */
+ public void setBasionymAuthorship(TeamOrPersonBase<?> basionymAuthorship);
+
+ /**
+ * @see #isBinomHybrid()
+ * @see #isMonomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public void setBinomHybrid(boolean binomHybrid);
+
+
+ /**
+ * @see #getCombinationAuthorship()
+ */
+ public void setCombinationAuthorship(TeamOrPersonBase<?> combinationAuthorship);
+
+ /**
+ * @see #getExBasionymAuthorship()
+ */
+ public void setExBasionymAuthorship(TeamOrPersonBase<?> exBasionymAuthorship);
+
+
+ /**
+ * @see #getExCombinationAuthorship()
+ */
+ public void setExCombinationAuthorship(TeamOrPersonBase<?> exCombinationAuthorship);
+
+ /**
+ * @see #getGenusOrUninomial()
+ */
+ public void setGenusOrUninomial(String genusOrUninomial);
+
+ /**
+ * @see #isHybridFormula()
+ */
+ public void setHybridFormula(boolean hybridFormula);
+
+ /**
+ * @see #getInfraGenericEpithet()
+ */
+ public void setInfraGenericEpithet(String infraGenericEpithet);
+
+ /**
+ * @see #getInfraSpecificEpithet()
+ */
+ public void setInfraSpecificEpithet(String infraSpecificEpithet);
+
+ /**
+ * @see #isMonomHybrid()
+ * @see #isBinomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public void setMonomHybrid(boolean monomHybrid);
+
+ /**
+ * Assigns a nameCache string to <i>this</i> non viral taxon name and protects it from being overwritten.
+ * Sets the protectedNameCache flag to <code>true</code>.
+ *
+ * @param nameCache the string which identifies <i>this</i> non viral taxon name (without authors or year)
+ * @see #getNameCache()
+ */
+ public void setNameCache(String nameCache);
+
+ /**
+ * Assigns a nameCache string to <i>this</i> non viral taxon name and protects it from being overwritten.
+ * Sets the protectedNameCache flag to <code>true</code>.
+ *
+ * @param nameCache the string which identifies <i>this</i> non viral taxon name (without authors or year)
+ * @param protectedNameCache if true teh protectedNameCache is set to <code>true</code> or otherwise set to
+ * <code>false</code>
+ * @see #getNameCache()
+ */
+ public void setNameCache(String nameCache, boolean protectedNameCache);
+
+ /**
+ * @see #isProtectedAuthorshipCache()
+ * @see #getAuthorshipCache()
+ */
+ public void setProtectedAuthorshipCache(boolean protectedAuthorshipCache);
+
+ /**
+ * @see #isProtectedNameCache()
+ */
+ public void setProtectedNameCache(boolean protectedNameCache);
+
+ /**
+ * @see #getSpecificEpithet()
+ */
+ public void setSpecificEpithet(String specificEpithet);
+
+ /**
+ * @see #isTrinomHybrid()
+ * @see #isBinomHybrid()
+ * @see #isMonomHybrid()
+ */
+ public void setTrinomHybrid(boolean trinomHybrid);
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.model.name;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.persistence.Transient;
+
+import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.IParsable;
+import eu.etaxonomy.cdm.model.common.IRelated;
+import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.strategy.cache.TaggedText;
+import eu.etaxonomy.cdm.strategy.match.IMatchable;
+
+/**
+ *
+ * The upmost interface for taxon names.
+ * <P>
+ * This class corresponds partially to: <ul>
+ * <li> TaxonName according to the TDWG ontology
+ * <li> ScientificName and CanonicalName according to the TCS
+ * <li> ScientificName according to the ABCD schema
+ * </ul>
+ *
+ * @author a.mueller
+ * @date 21.01.2017
+ *
+ */
+public interface ITaxonNameBase<T extends TaxonNameBase<?,?>>
+ extends IIdentifiableEntity, IParsable, IRelated, IMatchable, Cloneable{
+
+ public String generateFullTitle();
+
+ @Transient
+ public String getFullTitleCache();
+
+ @Transient
+ public NomenclaturalCode getNomenclaturalCode();
+
+
+ /**
+ * Returns the boolean value "false" since the components of <i>this</i> taxon name
+ * cannot follow the rules of a corresponding {@link NomenclaturalCode nomenclatural code}
+ * which is not defined for this class. The nomenclature code depends on
+ * the concrete name subclass ({@link BacterialName BacterialName},
+ * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName},
+ * {@link ZoologicalName ZoologicalName} or {@link ViralName ViralName})
+ * to which a taxon name belongs.
+ *
+ * @return false
+ */
+ @Transient
+ public boolean isCodeCompliant();
+
+ public List<TaggedText> getTaggedName();
+
+ public void setFullTitleCache(String fullTitleCache);
+
+ public void setFullTitleCache(String fullTitleCache, boolean protectCache);
+
+ public boolean isProtectedFullTitleCache();
+
+ void setProtectedFullTitleCache(boolean protectedFullTitleCache);
+
+ /**
+ * Returns the set of all {@link NameRelationship name relationships}
+ * in which <i>this</i> taxon name is involved. A taxon name can be both source
+ * in some name relationships or target in some others.
+ *
+ * @see #getRelationsToThisName()
+ * @see #getRelationsFromThisName()
+ * @see #addNameRelationship(NameRelationship)
+ * @see #addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
+ * @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
+ */
+ public Set<NameRelationship> getNameRelations();
+
+ /**
+ * Creates a new {@link NameRelationship#NameRelationship(TaxonNameBase, TaxonNameBase, NameRelationshipType, String) name relationship} from <i>this</i> taxon name to another taxon name
+ * and adds it both to the set of {@link #getRelationsFromThisName() relations from <i>this</i> taxon name} and
+ * to the set of {@link #getRelationsToThisName() relations to the other taxon name}.
+ *
+ * @param toName the taxon name of the target for this new name relationship
+ * @param type the type of this new name relationship
+ * @param ruleConsidered the string which specifies the rule on which this name relationship is based
+ * @see #getRelationsToThisName()
+ * @see #getNameRelations()
+ * @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
+ * @see #addNameRelationship(NameRelationship)
+ */
+ public void addRelationshipToName(TaxonNameBase toName, NameRelationshipType type, String ruleConsidered);
+
+ /**
+ * Creates a new {@link NameRelationship#NameRelationship(TaxonNameBase, TaxonNameBase, NameRelationshipType, String) name relationship} from <i>this</i> taxon name to another taxon name
+ * and adds it both to the set of {@link #getRelationsFromThisName() relations from <i>this</i> taxon name} and
+ * to the set of {@link #getRelationsToThisName() relations to the other taxon name}.
+ *
+ * @param toName the taxon name of the target for this new name relationship
+ * @param type the type of this new name relationship
+ * @param ruleConsidered the string which specifies the rule on which this name relationship is based
+ * @return
+ * @see #getRelationsToThisName()
+ * @see #getNameRelations()
+ * @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
+ * @see #addNameRelationship(NameRelationship)
+ */
+ public NameRelationship addRelationshipToName(TaxonNameBase toName, NameRelationshipType type, Reference citation,
+ String microCitation, String ruleConsidered);
+
+ /**
+ * Creates a new {@link NameRelationship#NameRelationship(TaxonNameBase, TaxonNameBase, NameRelationshipType, String) name relationship} from another taxon name to <i>this</i> taxon name
+ * and adds it both to the set of {@link #getRelationsToThisName() relations to <i>this</i> taxon name} and
+ * to the set of {@link #getRelationsFromThisName() relations from the other taxon name}.
+ *
+ * @param fromName the taxon name of the source for this new name relationship
+ * @param type the type of this new name relationship
+ * @param ruleConsidered the string which specifies the rule on which this name relationship is based
+ * @param citation the reference in which this relation was described
+ * @param microCitation the reference detail for this relation (e.g. page)
+ * @see #getRelationsFromThisName()
+ * @see #getNameRelations()
+ * @see #addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
+ * @see #addNameRelationship(NameRelationship)
+ */
+ public NameRelationship addRelationshipFromName(TaxonNameBase fromName, NameRelationshipType type, String ruleConsidered);
+
+ /**
+ * Creates a new {@link NameRelationship#NameRelationship(TaxonNameBase, TaxonNameBase, NameRelationshipType, String) name relationship} from another taxon name to <i>this</i> taxon name
+ * and adds it both to the set of {@link #getRelationsToThisName() relations to <i>this</i> taxon name} and
+ * to the set of {@link #getRelationsFromThisName() relations from the other taxon name}.
+ *
+ * @param fromName the taxon name of the source for this new name relationship
+ * @param type the type of this new name relationship
+ * @param ruleConsidered the string which specifies the rule on which this name relationship is based
+ * @param citation the reference in which this relation was described
+ * @param microCitation the reference detail for this relation (e.g. page)
+ * @see #getRelationsFromThisName()
+ * @see #getNameRelations()
+ * @see #addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
+ * @see #addNameRelationship(NameRelationship)
+ */
+ public NameRelationship addRelationshipFromName(TaxonNameBase fromName, NameRelationshipType type, Reference citation,
+ String microCitation, String ruleConsidered);
+
+ /**
+ * Removes one {@link NameRelationship name relationship} from one of both sets of
+ * {@link #getNameRelations() name relationships} in which <i>this</i> taxon name is involved.
+ * The name relationship will also be removed from one of both sets belonging
+ * to the second taxon name involved. Furthermore the fromName and toName
+ * attributes of the name relationship object will be nullified.
+ *
+ * @param nameRelation the name relationship which should be deleted from one of both sets
+ * @see #getNameRelations()
+ */
+ public void removeNameRelationship(NameRelationship nameRelation);
+
+ public void removeRelationToTaxonName(TaxonNameBase toTaxonName);
+
+ /**
+ * Returns the set of all {@link NameRelationship name relationships}
+ * in which <i>this</i> taxon name is involved as a source ("from"-side).
+ *
+ * @see #getNameRelations()
+ * @see #getRelationsToThisName()
+ * @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
+ */
+ public Set<NameRelationship> getRelationsFromThisName();
+
+ /**
+ * Returns the set of all {@link NameRelationship name relationships}
+ * in which <i>this</i> taxon name is involved as a target ("to"-side).
+ *
+ * @see #getNameRelations()
+ * @see #getRelationsFromThisName()
+ * @see #addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
+ */
+ public Set<NameRelationship> getRelationsToThisName();
+
+ /**
+ * Returns the set of {@link NomenclaturalStatus nomenclatural status} assigned
+ * to <i>this</i> taxon name according to its corresponding nomenclature code.
+ * This includes the {@link NomenclaturalStatusType type} of the nomenclatural status
+ * and the nomenclatural code rule considered.
+ *
+ * @see NomenclaturalStatus
+ * @see NomenclaturalStatusType
+ */
+ public Set<NomenclaturalStatus> getStatus();
+
+ /**
+ * Adds a new {@link NomenclaturalStatus nomenclatural status}
+ * to <i>this</i> taxon name's set of nomenclatural status.
+ *
+ * @param nomStatus the nomenclatural status to be added
+ * @see #getStatus()
+ */
+ public void addStatus(NomenclaturalStatus nomStatus);
+
+ public NomenclaturalStatus addStatus(NomenclaturalStatusType statusType, Reference citation, String microCitation);
+
+ /**
+ * Removes one element from the set of nomenclatural status of <i>this</i> taxon name.
+ * Type and ruleConsidered attributes of the nomenclatural status object
+ * will be nullified.
+ *
+ * @param nomStatus the nomenclatural status of <i>this</i> taxon name which should be deleted
+ * @see #getStatus()
+ */
+ public void removeStatus(NomenclaturalStatus nomStatus);
+
+ /**
+ * Indicates whether <i>this</i> taxon name is a {@link NameRelationshipType#BASIONYM() basionym}
+ * or a {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonym}
+ * of any other taxon name. Returns "true", if a basionym or a replaced
+ * synonym {@link NameRelationship relationship} from <i>this</i> taxon name to another taxon name exists,
+ * false otherwise (also in case <i>this</i> taxon name is the only one in the
+ * homotypical group).
+ */
+ public boolean isOriginalCombination();
+
+ /**
+ * Indicates <i>this</i> taxon name is a {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonym}
+ * of any other taxon name. Returns "true", if a replaced
+ * synonym {@link NameRelationship relationship} from <i>this</i> taxon name to another taxon name exists,
+ * false otherwise (also in case <i>this</i> taxon name is the only one in the
+ * homotypical group).
+ */
+ public boolean isReplacedSynonym();
+
+ /**
+ * Returns the taxon name which is the {@link NameRelationshipType#BASIONYM() basionym} of <i>this</i> taxon name.
+ * The basionym of a taxon name is its epithet-bringing synonym.
+ * For instance <i>Pinus abies</i> L. was published by Linnaeus and the botanist
+ * Karsten transferred later <i>this</i> taxon to the genus Picea. Therefore,
+ * <i>Pinus abies</i> L. is the basionym of the new combination <i>Picea abies</i> (L.) H. Karst.
+ *
+ * If more than one basionym exists one is choosen at radom.
+ *
+ * If no basionym exists null is returned.
+ */
+ public TaxonNameBase getBasionym();
+
+ /**
+ * Returns the set of taxon names which are the {@link NameRelationshipType#BASIONYM() basionyms} of <i>this</i> taxon name.
+ * The basionym of a taxon name is its epithet-bringing synonym.
+ * For instance <i>Pinus abies</i> L. was published by Linnaeus and the botanist
+ * Karsten transferred later <i>this</i> taxon to the genus Picea. Therefore,
+ * <i>Pinus abies</i> L. is the basionym of the new combination <i>Picea abies</i> (L.) H. Karst.
+ */
+ public Set<TaxonNameBase> getBasionyms();
+
+ /**
+ * Assigns a taxon name as {@link NameRelationshipType#BASIONYM() basionym} of <i>this</i> taxon name.
+ * The basionym {@link NameRelationship relationship} will be added to <i>this</i> taxon name
+ * and to the basionym. The basionym cannot have itself a basionym.
+ * The {@link HomotypicalGroup homotypical groups} of <i>this</i> taxon name and of the basionym
+ * will be {@link HomotypicalGroup#merge(HomotypicalGroup) merged}.
+ *
+ * @param basionym the taxon name to be set as the basionym of <i>this</i> taxon name
+ * @see #getBasionym()
+ * @see #addBasionym(TaxonNameBase, String)
+ */
+ public void addBasionym(T basionym);
+
+ /**
+ * Assigns a taxon name as {@link NameRelationshipType#BASIONYM() basionym} of <i>this</i> taxon name
+ * and keeps the nomenclatural rule considered for it. The basionym
+ * {@link NameRelationship relationship} will be added to <i>this</i> taxon name and to the basionym.
+ * The basionym cannot have itself a basionym.
+ * The {@link HomotypicalGroup homotypical groups} of <i>this</i> taxon name and of the basionym
+ * will be {@link HomotypicalGroup#merge(HomotypicalGroup) merged}.
+ *
+ * @param basionym the taxon name to be set as the basionym of <i>this</i> taxon name
+ * @param ruleConsidered the string identifying the nomenclatural rule
+ * @return
+ * @see #getBasionym()
+ * @see #addBasionym(TaxonNameBase)
+ */
+ public NameRelationship addBasionym(T basionym, Reference citation, String microcitation, String ruleConsidered);
+
+ /**
+ * Returns the set of taxon names which are the {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonyms} of <i>this</i> taxon name.
+ *
+ */
+ public Set<TaxonNameBase> getReplacedSynonyms();
+
+ /**
+ * Assigns a taxon name as {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonym} of <i>this</i> taxon name
+ * and keeps the nomenclatural rule considered for it. The replaced synonym
+ * {@link NameRelationship relationship} will be added to <i>this</i> taxon name and to the replaced synonym.
+ * The {@link HomotypicalGroup homotypical groups} of <i>this</i> taxon name and of the replaced synonym
+ * will be {@link HomotypicalGroup#merge(HomotypicalGroup) merged}.
+ *
+ * @param basionym the taxon name to be set as the basionym of <i>this</i> taxon name
+ * @param ruleConsidered the string identifying the nomenclatural rule
+ * @see #getBasionym()
+ * @see #addBasionym(TaxonNameBase)
+ */
+ //TODO: Check if true: The replaced synonym cannot have itself a replaced synonym (?).
+ public void addReplacedSynonym(T replacedSynonym, Reference citation, String microcitation, String ruleConsidered);
+
+ /**
+ * Removes the {@link NameRelationshipType#BASIONYM() basionym} {@link NameRelationship relationship} from the set of
+ * {@link #getRelationsToThisName() name relationships to} <i>this</i> taxon name. The same relationhip will be
+ * removed from the set of {@link #getRelationsFromThisName() name relationships from} the taxon name
+ * previously used as basionym.
+ *
+ * @see #getBasionym()
+ * @see #addBasionym(TaxonNameBase)
+ */
+ public void removeBasionyms();
+
+ /**
+ * Returns the taxonomic {@link Rank rank} of <i>this</i> taxon name.
+ *
+ * @see Rank
+ */
+ public Rank getRank();
+
+ /**
+ * @see #getRank()
+ */
+ public void setRank(Rank rank);
+
+ /**
+ * Returns the {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} of <i>this</i> taxon name.
+ * The nomenclatural reference is here meant to be the one publication
+ * <i>this</i> taxon name was originally published in while fulfilling the formal
+ * requirements as specified by the corresponding {@link NomenclaturalCode nomenclatural code}.
+ *
+ * @see eu.etaxonomy.cdm.model.reference.INomenclaturalReference
+ * @see eu.etaxonomy.cdm.model.reference.Reference
+ */
+ public INomenclaturalReference getNomenclaturalReference();
+
+ /**
+ * Assigns a {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} to <i>this</i> taxon name.
+ * The corresponding {@link eu.etaxonomy.cdm.model.reference.Reference.isNomenclaturallyRelevant nomenclaturally relevant flag} will be set to true
+ * as it is obviously used for nomenclatural purposes.
+ *
+ * @throws IllegalArgumentException if parameter <code>nomenclaturalReference</code> is not assignable from {@link INomenclaturalReference}
+ * @see #getNomenclaturalReference()
+ */
+ public void setNomenclaturalReference(INomenclaturalReference nomenclaturalReference);
+
+ /**
+ * Returns the appended phrase string assigned to <i>this</i> taxon name.
+ * The appended phrase is a non-atomised addition to a name. It is
+ * not ruled by a nomenclatural code.
+ */
+ public String getAppendedPhrase();
+
+ /**
+ * @see #getAppendedPhrase()
+ */
+ public void setAppendedPhrase(String appendedPhrase);
+
+ /**
+ * Returns the details string of the {@link #getNomenclaturalReference() nomenclatural reference} assigned
+ * to <i>this</i> taxon name. The details describe the exact localisation within
+ * the publication used as nomenclature reference. These are mostly
+ * (implicitly) pages but can also be figures or tables or any other
+ * element of a publication. A nomenclatural micro reference (details)
+ * requires the existence of a nomenclatural reference.
+ */
+ //Details of the nomenclatural reference (protologue).
+ public String getNomenclaturalMicroReference();
+
+ /**
+ * @see #getNomenclaturalMicroReference()
+ */
+ public void setNomenclaturalMicroReference(String nomenclaturalMicroReference);
+
+ /**
+ * @param warnings
+ */
+ public void addParsingProblems(int problems);
+
+ /**
+ * Returns the set of {@link TypeDesignationBase type designations} assigned
+ * to <i>this</i> taxon name.
+ * @see NameTypeDesignation
+ * @see SpecimenTypeDesignation
+ */
+ public Set<TypeDesignationBase> getTypeDesignations();
+
+ /**
+ * Removes one element from the set of {@link TypeDesignationBase type designations} assigned to
+ * <i>this</i> taxon name. The type designation itself will be nullified.
+ *
+ * @param typeDesignation the type designation which should be deleted
+ */
+ public void removeTypeDesignation(TypeDesignationBase typeDesignation);
+
+ /**
+ * Returns the set of {@link SpecimenTypeDesignation specimen type designations} assigned
+ * to <i>this</i> taxon name. The {@link Rank rank} of <i>this</i> taxon name is generally
+ * "species" or below. The specimen type designations include all the
+ * specimens on which the typification of this name is based (which are
+ * exclusively used to typify taxon names belonging to the same
+ * {@link HomotypicalGroup homotypical group} to which <i>this</i> taxon name
+ * belongs) and eventually the status of these designations.
+ *
+ * @see SpecimenTypeDesignation
+ * @see NameTypeDesignation
+ * @see HomotypicalGroup
+ */
+ public Set<SpecimenTypeDesignation> getSpecimenTypeDesignationsOfHomotypicalGroup();
+
+ /**
+ * Returns the set of {@link NameTypeDesignation name type designations} assigned
+ * to <i>this</i> taxon name the rank of which must be above "species".
+ * The name type designations include all the taxon names used to typify
+ * <i>this</i> taxon name and eventually the rejected or conserved status
+ * of these designations.
+ *
+ * @see NameTypeDesignation
+ * @see SpecimenTypeDesignation
+ */
+ public Set<NameTypeDesignation> getNameTypeDesignations();
+
+ /**
+ * Creates and adds a new {@link NameTypeDesignation name type designation}
+ * to <i>this</i> taxon name's set of type designations.
+ *
+ * @param typeSpecies the taxon name to be used as type of <i>this</i> taxon name
+ * @param citation the reference for this new designation
+ * @param citationMicroReference the string with the details (generally pages) within the reference
+ * @param originalNameString the taxon name string used in the reference to assert this designation
+ * @param isRejectedType the boolean status for a rejected name type designation
+ * @param isConservedType the boolean status for a conserved name type designation
+ * @param isLectoType the boolean status for a lectotype name type designation
+ * @param isNotDesignated the boolean status for a name type designation without name type
+ * @param addToAllHomotypicNames the boolean indicating whether the name type designation should be
+ * added to all taxon names of the homotypical group this taxon name belongs to
+ * @return
+ * @see #getNameTypeDesignations()
+ * @see NameTypeDesignation
+ * @see TypeDesignationBase#isNotDesignated()
+ */
+ public NameTypeDesignation addNameTypeDesignation(TaxonNameBase typeSpecies, Reference citation,
+ String citationMicroReference, String originalNameString, NameTypeDesignationStatus status,
+ boolean isRejectedType, boolean isConservedType,
+ /*boolean isLectoType, */
+ boolean isNotDesignated, boolean addToAllHomotypicNames);
+
+ /**
+ * Creates and adds a new {@link NameTypeDesignation name type designation}
+ * to <i>this</i> taxon name's set of type designations.
+ *
+ * @param typeSpecies the taxon name to be used as type of <i>this</i> taxon name
+ * @param citation the reference for this new designation
+ * @param citationMicroReference the string with the details (generally pages) within the reference
+ * @param originalNameString the taxon name string used in the reference to assert this designation
+ * @param status the name type designation status
+ * @param addToAllHomotypicNames the boolean indicating whether the name type designation should be
+ * added to all taxon names of the homotypical group this taxon name belongs to
+ * @return
+ * @see #getNameTypeDesignations()
+ * @see NameTypeDesignation
+ * @see TypeDesignationBase#isNotDesignated()
+ */
+ public NameTypeDesignation addNameTypeDesignation(TaxonNameBase typeSpecies, Reference citation,
+ String citationMicroReference, String originalNameString, NameTypeDesignationStatus status,
+ boolean addToAllHomotypicNames);
+
+ /**
+ * Returns the set of {@link SpecimenTypeDesignation specimen type designations}
+ * that typify <i>this</i> taxon name.
+ */
+ public Set<SpecimenTypeDesignation> getSpecimenTypeDesignations();
+
+ /**
+ * Creates and adds a new {@link SpecimenTypeDesignation specimen type designation}
+ * to <i>this</i> taxon name's set of type designations.
+ *
+ * @param typeSpecimen the specimen to be used as a type for <i>this</i> taxon name
+ * @param status the specimen type designation status
+ * @param citation the reference for this new specimen type designation
+ * @param citationMicroReference the string with the details (generally pages) within the reference
+ * @param originalNameString the taxon name used in the reference to assert this designation
+ * @param isNotDesignated the boolean status for a specimen type designation without specimen type
+ * @param addToAllHomotypicNames the boolean indicating whether the specimen type designation should be
+ * added to all taxon names of the homotypical group the typified
+ * taxon name belongs to
+ * @return
+ * @see #getSpecimenTypeDesignations()
+ * @see SpecimenTypeDesignationStatus
+ * @see SpecimenTypeDesignation
+ * @see TypeDesignationBase#isNotDesignated()
+ */
+ public SpecimenTypeDesignation addSpecimenTypeDesignation(DerivedUnit typeSpecimen, SpecimenTypeDesignationStatus status,
+ Reference citation, String citationMicroReference, String originalNameString, boolean isNotDesignated,
+ boolean addToAllHomotypicNames);
+
+ /**
+ * Adds a {@link TypeDesignationBase type designation} to <code>this</code> taxon name's set of type designations
+ *
+ * @param typeDesignation the typeDesignation to be added to <code>this</code> taxon name
+ * @param addToAllNames the boolean indicating whether the type designation should be
+ * added to all taxon names of the homotypical group the typified
+ * taxon name belongs to
+ * @return true if the operation was succesful
+ *
+ * @throws IllegalArgumentException if the type designation already has typified names, an {@link IllegalArgumentException exception}
+ * is thrown. We do this to prevent a type designation to be used for multiple taxon names.
+ *
+ */
+ public boolean addTypeDesignation(TypeDesignationBase typeDesignation, boolean addToAllNames);
+
+ /**
+ * Returns the {@link HomotypicalGroup homotypical group} to which
+ * <i>this</i> taxon name belongs. A homotypical group represents all taxon names
+ * that share the same types.
+ *
+ * @see HomotypicalGroup
+ */
+
+ public HomotypicalGroup getHomotypicalGroup();
+
+ /**
+ * @see #getHomotypicalGroup()
+ */
+ public void setHomotypicalGroup(HomotypicalGroup homotypicalGroup);
+
+ /**
+ * Returns the complete string containing the
+ * {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference#getNomenclaturalCitation() nomenclatural reference citation}
+ * and the {@link #getNomenclaturalMicroReference() details} assigned to <i>this</i> taxon name.
+ *
+ * @return the string containing the nomenclatural reference of <i>this</i> taxon name
+ * @see eu.etaxonomy.cdm.model.reference.INomenclaturalReference#getNomenclaturalCitation()
+ * @see #getNomenclaturalReference()
+ * @see #getNomenclaturalMicroReference()
+ */
+ public String getCitationString();
+
+ /**
+ * Returns the string containing the publication date (generally only year)
+ * of the {@link #getNomenclaturalReference() nomenclatural reference} for <i>this</i> taxon name, null if there is
+ * no nomenclatural reference.
+ *
+ * @return the string containing the publication date of <i>this</i> taxon name
+ * @see eu.etaxonomy.cdm.model.reference.INomenclaturalReference#getYear()
+ */
+ public String getReferenceYear();
+
+ /**
+ * Returns the set of {@link eu.etaxonomy.cdm.model.taxon.TaxonBase taxon bases} that refer to <i>this</i> taxon name.
+ * In this context a taxon base means the use of a taxon name by a reference
+ * either as a {@link eu.etaxonomy.cdm.model.taxon.Taxon taxon} ("accepted/correct" name) or
+ * as a (junior) {@link eu.etaxonomy.cdm.model.taxon.Synonym synonym}.
+ * A taxon name can be used by several distinct {@link eu.etaxonomy.cdm.model.reference.Reference references} but only once
+ * within a taxonomic treatment (identified by one reference).
+ *
+ * @see #getTaxa()
+ * @see #getSynonyms()
+ */
+ public Set<TaxonBase> getTaxonBases();
+
+ /**
+ * Adds a new {@link eu.etaxonomy.cdm.model.taxon.TaxonBase taxon base}
+ * to the set of taxon bases using <i>this</i> taxon name.
+ *
+ * @param taxonBase the taxon base to be added
+ * @see #getTaxonBases()
+ * @see #removeTaxonBase(TaxonBase)
+ */
+ //TODO protected
+ public void addTaxonBase(TaxonBase taxonBase);
+
+ /**
+ * Removes one element from the set of {@link eu.etaxonomy.cdm.model.taxon.TaxonBase taxon bases} that refer to <i>this</i> taxon name.
+ *
+ * @param taxonBase the taxon base which should be removed from the corresponding set
+ * @see #getTaxonBases()
+ * @see #addTaxonBase(TaxonBase)
+ */
+ public void removeTaxonBase(TaxonBase taxonBase);
+
+ /**
+ * Returns the set of {@link eu.etaxonomy.cdm.model.taxon.Taxon taxa} ("accepted/correct" names according to any
+ * reference) that are based on <i>this</i> taxon name. This set is a subset of
+ * the set returned by getTaxonBases().
+ *
+ * @see eu.etaxonomy.cdm.model.taxon.Taxon
+ * @see #getTaxonBases()
+ * @see #getSynonyms()
+ */
+ public Set<Taxon> getTaxa();
+
+ /**
+ * Returns the set of {@link eu.etaxonomy.cdm.model.taxon.Synonym (junior) synonyms} (according to any
+ * reference) that are based on <i>this</i> taxon name. This set is a subset of
+ * the set returned by getTaxonBases().
+ *
+ * @see eu.etaxonomy.cdm.model.taxon.Synonym
+ * @see #getTaxonBases()
+ * @see #getTaxa()
+ */
+ public Set<Synonym> getSynonyms();
+
+ /**
+ * Returns the set of {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription taxon name descriptions} assigned
+ * to <i>this</i> taxon name. A taxon name description is a piece of information
+ * concerning the taxon name like for instance the content of its first
+ * publication (protolog) or a picture of this publication.
+ *
+ * @see #addDescription(TaxonNameDescription)
+ * @see #removeDescription(TaxonNameDescription)
+ * @see eu.etaxonomy.cdm.model.description.TaxonNameDescription
+ */
+ public Set<TaxonNameDescription> getDescriptions();
+
+ /**
+ * Adds a new {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription taxon name description}
+ * to the set of taxon name descriptions assigned to <i>this</i> taxon name. The
+ * content of the {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription#getTaxonName() taxonName attribute} of the
+ * taxon name description itself will be replaced with <i>this</i> taxon name.
+ *
+ * @param description the taxon name description to be added
+ * @see #getDescriptions()
+ * @see #removeDescription(TaxonNameDescription)
+ */
+ public void addDescription(TaxonNameDescription description);
+
+ /**
+ * Removes one element from the set of {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription taxon name descriptions} assigned
+ * to <i>this</i> taxon name. The content of the {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription#getTaxonName() taxonName attribute}
+ * of the description itself will be set to "null".
+ *
+ * @param description the taxon name description which should be removed
+ * @see #getDescriptions()
+ * @see #addDescription(TaxonNameDescription)
+ * @see eu.etaxonomy.cdm.model.description.TaxonNameDescription#getTaxonName()
+ */
+ public void removeDescription(TaxonNameDescription description);
+
+ public void mergeHomotypicGroups(TaxonNameBase name);
+
+ /**
+ * Returns the boolean value indicating whether a given taxon name belongs
+ * to the same {@link HomotypicalGroup homotypical group} as <i>this</i> taxon name (true)
+ * or not (false). Returns "true" only if the homotypical groups of both
+ * taxon names exist and if they are identical.
+ *
+ * @param homoTypicName the taxon name the homotypical group of which is to be checked
+ * @return the boolean value of the check
+ * @see HomotypicalGroup
+ */
+ public boolean isHomotypic(TaxonNameBase homoTypicName);
+
+ /**
+ * Checks whether name is a basionym for ALL names
+ * in its homotypical group.
+ * Returns <code>false</code> if there are no other names in the group
+ * @param name
+ * @return
+ */
+ public boolean isGroupsBasionym();
+
+ /**
+ * Checks whether a basionym relationship exists between fromName and toName.
+ *
+ * @param fromName
+ * @param toName
+ * @return
+ */
+ public boolean isBasionymFor(TaxonNameBase newCombinationName);
+
+ /**
+ * Creates a basionym relationship to all other names in this names homotypical
+ * group.
+ *
+ * @see HomotypicalGroup.setGroupBasionym(TaxonNameBase basionymName)
+ */
+ public void makeGroupsBasionym();
+
+ //********* Rank comparison shortcuts ********************//
+ /**
+ * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
+ * taxon name is higher than the genus rank (true) or not (false).
+ * Suprageneric non viral names are monomials.
+ * Returns false if rank is null.
+ *
+ * @see #isGenus()
+ * @see #isInfraGeneric()
+ * @see #isSpecies()
+ * @see #isInfraSpecific()
+ */
+ public boolean isSupraGeneric();
+
+ /**
+ * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
+ * taxon name is the genus rank (true) or not (false). Non viral names with
+ * genus rank are monomials. Returns false if rank is null.
+ *
+ * @see #isSupraGeneric()
+ * @see #isInfraGeneric()
+ * @see #isSpecies()
+ * @see #isInfraSpecific()
+ */
+ public boolean isGenus();
+
+ /**
+ * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
+ * taxon name is higher than the species rank and lower than the
+ * genus rank (true) or not (false). Infrageneric non viral names are
+ * binomials. Returns false if rank is null.
+ *
+ * @see #isSupraGeneric()
+ * @see #isGenus()
+ * @see #isSpecies()
+ * @see #isInfraSpecific()
+ */
+ public boolean isInfraGeneric();
+
+ /**
+ * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
+ * taxon name is higher than the species rank (true) or not (false).
+ * Returns false if rank is null.
+ *
+ * @see #isGenus()
+ * @see #isInfraGeneric()
+ * @see #isSpecies()
+ * @see #isInfraSpecific()
+ */
+ public boolean isSupraSpecific();
+
+ /**
+ * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
+ * taxon name is the species rank (true) or not (false). Non viral names
+ * with species rank are binomials.
+ * Returns false if rank is null.
+ *
+ * @see #isSupraGeneric()
+ * @see #isGenus()
+ * @see #isInfraGeneric()
+ * @see #isInfraSpecific()
+ */
+ public boolean isSpecies();
+
+ /**
+ * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
+ * taxon name is lower than the species rank (true) or not (false).
+ * Infraspecific non viral names are trinomials.
+ * Returns false if rank is null.
+ *
+ * @see #isSupraGeneric()
+ * @see #isGenus()
+ * @see #isInfraGeneric()
+ * @see #isSpecies()
+ */
+ public boolean isInfraSpecific();
+
+ /**
+ * Returns true if this name's rank indicates a rank that aggregates species like species
+ * aggregates or species groups, false otherwise. This methods currently returns false
+ * for all user defined ranks.
+ *
+ *@see Rank#isSpeciesAggregate()
+ *
+ * @return
+ */
+ public boolean isSpeciesAggregate();
+
+ /**
+ * Creates a basionym relationship between this name and
+ * each name in its homotypic group.
+ *
+ * @param basionymName
+ */
+ public void setAsGroupsBasionym();
+
+ /**
+ * Removes basionym relationship between this name and
+ * each name in its homotypic group.
+ *
+ * @param basionymName
+ */
+ public void removeAsGroupsBasionym();
+
+
+}
@CorrectEpithetsForRank(groups = Level2.class)
@NameMustHaveAuthority(groups = Level2.class)
@NoDuplicateNames(groups = Level3.class)
-public class NonViralName<T extends NonViralName> extends TaxonNameBase<T, INonViralNameCacheStrategy> implements Cloneable{
+public class NonViralName<T extends NonViralName>
+ extends TaxonNameBase<T, INonViralNameCacheStrategy>
+ implements INonViralName<T>{
+
private static final long serialVersionUID = 4441110073881088033L;
@Table(appliesTo="TaxonNameBase", indexes = { @org.hibernate.annotations.Index(name = "taxonNameBaseTitleCacheIndex", columnNames = { "titleCache" }), @org.hibernate.annotations.Index(name = "taxonNameBaseNameCacheIndex", columnNames = { "nameCache" }) })
public abstract class TaxonNameBase<T extends TaxonNameBase<?,?>, S extends INameCacheStrategy>
extends IdentifiableEntity<S>
- implements IParsable, IRelated, IMatchable, Cloneable {
+ implements ITaxonNameBase<T>, IParsable, IRelated, IMatchable, Cloneable {
private static final long serialVersionUID = -4530368639601532116L;
private static final Logger logger = Logger.getLogger(TaxonNameBase.class);
this.hybridChildRelations = hybridChildRelations;
}
+ @Override
public boolean isProtectedFullTitleCache() {
return protectedFullTitleCache;
}
+ @Override
public void setProtectedFullTitleCache(boolean protectedFullTitleCache) {
this.protectedFullTitleCache = protectedFullTitleCache;
}
//********* METHODS **************************************/
+ @Override
public String generateFullTitle(){
if (cacheStrategy == null){
logger.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
}
+ @Override
public void setFullTitleCache(String fullTitleCache){
setFullTitleCache(fullTitleCache, PROTECTED);
}
+ @Override
public void setFullTitleCache(String fullTitleCache, boolean protectCache){
fullTitleCache = getTruncatedCache(fullTitleCache);
this.fullTitleCache = fullTitleCache;
*
* @return false
*/
+ @Override
@Transient
public boolean isCodeCompliant() {
//FIXME
return false;
}
+ @Override
@Transient
public List<TaggedText> getTaggedName(){
return getCacheStrategy().getTaggedTitle(this);
}
+ @Override
@Transient
public String getFullTitleCache(){
if (protectedFullTitleCache){
* @see #addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
* @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
*/
+ @Override
@Transient
public Set<NameRelationship> getNameRelations() {
Set<NameRelationship> rels = new HashSet<NameRelationship>();
* @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
* @see #addNameRelationship(NameRelationship)
*/
+ @Override
public void addRelationshipToName(TaxonNameBase toName, NameRelationshipType type, String ruleConsidered){
addRelationshipToName(toName, type, null, null, ruleConsidered);
// NameRelationship rel = new NameRelationship(toName, this, type, ruleConsidered);
* @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
* @see #addNameRelationship(NameRelationship)
*/
+ @Override
public NameRelationship addRelationshipToName(TaxonNameBase toName, NameRelationshipType type, Reference citation, String microCitation, String ruleConsidered){
if (toName == null){
throw new NullPointerException("Null is not allowed as name for a name relationship");
* @see #addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
* @see #addNameRelationship(NameRelationship)
*/
+ @Override
public NameRelationship addRelationshipFromName(TaxonNameBase fromName, NameRelationshipType type, String ruleConsidered){
//fromName.addRelationshipToName(this, type, null, null, ruleConsidered);
return this.addRelationshipFromName(fromName, type, null, null, ruleConsidered);
* @see #addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
* @see #addNameRelationship(NameRelationship)
*/
+ @Override
public NameRelationship addRelationshipFromName(TaxonNameBase fromName, NameRelationshipType type, Reference citation, String microCitation, String ruleConsidered){
return fromName.addRelationshipToName(this, type, citation, microCitation, ruleConsidered);
}
* @param nameRelation the name relationship which should be deleted from one of both sets
* @see #getNameRelations()
*/
+ @Override
public void removeNameRelationship(NameRelationship nameRelation) {
TaxonNameBase fromName = nameRelation.getFromName();
this.relationsFromThisName.remove(nameRelation);
}
+ @Override
public void removeRelationToTaxonName(TaxonNameBase toTaxonName) {
Set<NameRelationship> nameRelationships = new HashSet<NameRelationship>();
// nameRelationships.addAll(this.getNameRelations());
* @see #getRelationsToThisName()
* @see #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
*/
+ @Override
public Set<NameRelationship> getRelationsFromThisName() {
if(relationsFromThisName == null) {
this.relationsFromThisName = new HashSet<>();
* @see #getRelationsFromThisName()
* @see #addRelationshipToName(TaxonNameBase, NameRelationshipType, String)
*/
+ @Override
public Set<NameRelationship> getRelationsToThisName() {
if(relationsToThisName == null) {
this.relationsToThisName = new HashSet<>();
* @see NomenclaturalStatus
* @see NomenclaturalStatusType
*/
+ @Override
public Set<NomenclaturalStatus> getStatus() {
if(status == null) {
this.status = new HashSet<>();
* @param nomStatus the nomenclatural status to be added
* @see #getStatus()
*/
+ @Override
public void addStatus(NomenclaturalStatus nomStatus) {
this.status.add(nomStatus);
}
+ @Override
public NomenclaturalStatus addStatus(NomenclaturalStatusType statusType, Reference citation, String microCitation) {
NomenclaturalStatus newStatus = NomenclaturalStatus.NewInstance(statusType, citation, microCitation);
this.status.add(newStatus);
* @param nomStatus the nomenclatural status of <i>this</i> taxon name which should be deleted
* @see #getStatus()
*/
+ @Override
public void removeStatus(NomenclaturalStatus nomStatus) {
//TODO to be implemented?
logger.warn("not yet fully implemented?");
* false otherwise (also in case <i>this</i> taxon name is the only one in the
* homotypical group).
*/
+ @Override
@Transient
public boolean isOriginalCombination(){
Set<NameRelationship> relationsFromThisName = this.getRelationsFromThisName();
* false otherwise (also in case <i>this</i> taxon name is the only one in the
* homotypical group).
*/
+ @Override
@Transient
public boolean isReplacedSynonym(){
Set<NameRelationship> relationsFromThisName = this.getRelationsFromThisName();
*
* If no basionym exists null is returned.
*/
+ @Override
@Transient
public TaxonNameBase getBasionym(){
Set<TaxonNameBase> basionyms = getBasionyms();
* Karsten transferred later <i>this</i> taxon to the genus Picea. Therefore,
* <i>Pinus abies</i> L. is the basionym of the new combination <i>Picea abies</i> (L.) H. Karst.
*/
+ @Override
@Transient
public Set<TaxonNameBase> getBasionyms(){
Set<TaxonNameBase> result = new HashSet<TaxonNameBase>();
* @see #getBasionym()
* @see #addBasionym(TaxonNameBase, String)
*/
+ @Override
public void addBasionym(T basionym){
addBasionym(basionym, null, null, null);
}
* @see #getBasionym()
* @see #addBasionym(TaxonNameBase)
*/
+ @Override
public NameRelationship addBasionym(T basionym, Reference citation, String microcitation, String ruleConsidered){
if (basionym != null){
return basionym.addRelationshipToName(this, NameRelationshipType.BASIONYM(), citation, microcitation, ruleConsidered);
* Returns the set of taxon names which are the {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonyms} of <i>this</i> taxon name.
*
*/
+ @Override
@Transient
public Set<TaxonNameBase> getReplacedSynonyms(){
Set<TaxonNameBase> result = new HashSet<TaxonNameBase>();
* @see #addBasionym(TaxonNameBase)
*/
//TODO: Check if true: The replaced synonym cannot have itself a replaced synonym (?).
+ @Override
public void addReplacedSynonym(T replacedSynonym, Reference citation, String microcitation, String ruleConsidered){
if (replacedSynonym != null){
replacedSynonym.addRelationshipToName(this, NameRelationshipType.REPLACED_SYNONYM(), citation, microcitation, ruleConsidered);
* @see #getBasionym()
* @see #addBasionym(TaxonNameBase)
*/
+ @Override
public void removeBasionyms(){
Set<NameRelationship> removeRelations = new HashSet<NameRelationship>();
for (NameRelationship nameRelation : this.getRelationsToThisName()){
*
* @see Rank
*/
+ @Override
public Rank getRank(){
return this.rank;
}
/**
* @see #getRank()
*/
+ @Override
public void setRank(Rank rank){
this.rank = rank;
}
* @see eu.etaxonomy.cdm.model.reference.INomenclaturalReference
* @see eu.etaxonomy.cdm.model.reference.Reference
*/
+ @Override
public INomenclaturalReference getNomenclaturalReference(){
return this.nomenclaturalReference;
}
* @throws IllegalArgumentException if parameter <code>nomenclaturalReference</code> is not assignable from {@link INomenclaturalReference}
* @see #getNomenclaturalReference()
*/
+ @Override
public void setNomenclaturalReference(INomenclaturalReference nomenclaturalReference){
if(nomenclaturalReference != null){
if(!INomenclaturalReference.class.isAssignableFrom(nomenclaturalReference.getClass())){
* The appended phrase is a non-atomised addition to a name. It is
* not ruled by a nomenclatural code.
*/
+ @Override
public String getAppendedPhrase(){
return this.appendedPhrase;
}
/**
* @see #getAppendedPhrase()
*/
+ @Override
public void setAppendedPhrase(String appendedPhrase){
this.appendedPhrase = StringUtils.isBlank(appendedPhrase)? null : appendedPhrase;
}
* requires the existence of a nomenclatural reference.
*/
//Details of the nomenclatural reference (protologue).
+ @Override
public String getNomenclaturalMicroReference(){
return this.nomenclaturalMicroReference;
}
/**
* @see #getNomenclaturalMicroReference()
*/
+ @Override
public void setNomenclaturalMicroReference(String nomenclaturalMicroReference){
this.nomenclaturalMicroReference = StringUtils.isBlank(nomenclaturalMicroReference)? null : nomenclaturalMicroReference;
}
/**
* @param warnings
*/
+ @Override
public void addParsingProblems(int problems){
parsingProblem = ParserProblem.addProblems(parsingProblem, problems);
}
* @see NameTypeDesignation
* @see SpecimenTypeDesignation
*/
+ @Override
public Set<TypeDesignationBase> getTypeDesignations() {
if(typeDesignations == null) {
this.typeDesignations = new HashSet<TypeDesignationBase>();
*
* @param typeDesignation the type designation which should be deleted
*/
+ @Override
@SuppressWarnings("deprecation")
public void removeTypeDesignation(TypeDesignationBase typeDesignation) {
this.typeDesignations.remove(typeDesignation);
* @see NameTypeDesignation
* @see HomotypicalGroup
*/
+ @Override
@Transient
public Set<SpecimenTypeDesignation> getSpecimenTypeDesignationsOfHomotypicalGroup() {
return this.getHomotypicalGroup().getSpecimenTypeDesignations();
* @see NameTypeDesignation
* @see SpecimenTypeDesignation
*/
+ @Override
@Transient
public Set<NameTypeDesignation> getNameTypeDesignations() {
Set<NameTypeDesignation> result = new HashSet<NameTypeDesignation>();
* @see NameTypeDesignation
* @see TypeDesignationBase#isNotDesignated()
*/
+ @Override
public NameTypeDesignation addNameTypeDesignation(TaxonNameBase typeSpecies,
Reference citation,
String citationMicroReference,
* @see NameTypeDesignation
* @see TypeDesignationBase#isNotDesignated()
*/
+ @Override
public NameTypeDesignation addNameTypeDesignation(TaxonNameBase typeSpecies,
Reference citation,
String citationMicroReference,
* Returns the set of {@link SpecimenTypeDesignation specimen type designations}
* that typify <i>this</i> taxon name.
*/
+ @Override
@Transient
public Set<SpecimenTypeDesignation> getSpecimenTypeDesignations() {
Set<SpecimenTypeDesignation> result = new HashSet<SpecimenTypeDesignation>();
* @see SpecimenTypeDesignation
* @see TypeDesignationBase#isNotDesignated()
*/
+ @Override
public SpecimenTypeDesignation addSpecimenTypeDesignation(DerivedUnit typeSpecimen,
SpecimenTypeDesignationStatus status,
Reference citation,
* is thrown. We do this to prevent a type designation to be used for multiple taxon names.
*
*/
+ @Override
public boolean addTypeDesignation(TypeDesignationBase typeDesignation, boolean addToAllNames){
//currently typeDesignations are not persisted with the homotypical group
//so explicit adding to the homotypical group is not necessary.
* @see HomotypicalGroup
*/
+ @Override
public HomotypicalGroup getHomotypicalGroup() {
if (homotypicalGroup == null){
homotypicalGroup = new HomotypicalGroup();
/**
* @see #getHomotypicalGroup()
*/
+ @Override
public void setHomotypicalGroup(HomotypicalGroup homotypicalGroup) {
if (homotypicalGroup == null){
throw new IllegalArgumentException("HomotypicalGroup of name should never be null but was set to 'null'");
* @see #getNomenclaturalReference()
* @see #getNomenclaturalMicroReference()
*/
+ @Override
@Transient
public String getCitationString(){
return getNomenclaturalReference().getNomenclaturalCitation(getNomenclaturalMicroReference());
* @return the string containing the publication date of <i>this</i> taxon name
* @see eu.etaxonomy.cdm.model.reference.INomenclaturalReference#getYear()
*/
+ @Override
@Transient
@ValidTaxonomicYear(groups=Level3.class)
public String getReferenceYear(){
* @see #getTaxa()
* @see #getSynonyms()
*/
+ @Override
public Set<TaxonBase> getTaxonBases() {
if(taxonBases == null) {
this.taxonBases = new HashSet<TaxonBase>();
* @see #removeTaxonBase(TaxonBase)
*/
//TODO protected
+ @Override
public void addTaxonBase(TaxonBase taxonBase){
Method method = ReflectionUtils.findMethod(TaxonBase.class, "setName", new Class[] {TaxonNameBase.class});
ReflectionUtils.makeAccessible(method);
* @see #getTaxonBases()
* @see #addTaxonBase(TaxonBase)
*/
+ @Override
public void removeTaxonBase(TaxonBase taxonBase){
Method method = ReflectionUtils.findMethod(TaxonBase.class, "setName", new Class[] {TaxonNameBase.class});
ReflectionUtils.makeAccessible(method);
* @see #getTaxonBases()
* @see #getSynonyms()
*/
+ @Override
@Transient
public Set<Taxon> getTaxa(){
Set<Taxon> result = new HashSet<Taxon>();
* @see #getTaxonBases()
* @see #getTaxa()
*/
+ @Override
@Transient
public Set<Synonym> getSynonyms() {
Set<Synonym> result = new HashSet<Synonym>();
* @see #removeDescription(TaxonNameDescription)
* @see eu.etaxonomy.cdm.model.description.TaxonNameDescription
*/
+ @Override
public Set<TaxonNameDescription> getDescriptions() {
return descriptions;
}
* @see #getDescriptions()
* @see #removeDescription(TaxonNameDescription)
*/
+ @Override
public void addDescription(TaxonNameDescription description) {
java.lang.reflect.Field field = ReflectionUtils.findField(TaxonNameDescription.class, "taxonName", TaxonNameBase.class);
ReflectionUtils.makeAccessible(field);
* @see #addDescription(TaxonNameDescription)
* @see eu.etaxonomy.cdm.model.description.TaxonNameDescription#getTaxonName()
*/
+ @Override
public void removeDescription(TaxonNameDescription description) {
java.lang.reflect.Field field = ReflectionUtils.findField(TaxonNameDescription.class, "taxonName", TaxonNameBase.class);
ReflectionUtils.makeAccessible(field);
// *********** HOMOTYPIC GROUP METHODS **************************************************
+ @Override
@Transient
public void mergeHomotypicGroups(TaxonNameBase name){
this.getHomotypicalGroup().merge(name.getHomotypicalGroup());
* @return the boolean value of the check
* @see HomotypicalGroup
*/
+ @Override
@Transient
public boolean isHomotypic(TaxonNameBase homoTypicName) {
if (homoTypicName == null) {
* @param name
* @return
*/
+ @Override
@Transient
public boolean isGroupsBasionym() {
if (homotypicalGroup == null){
* @param toName
* @return
*/
+ @Override
@Transient
public boolean isBasionymFor(TaxonNameBase newCombinationName) {
Set<NameRelationship> relations = newCombinationName.getRelationsToThisName();
*
* @see HomotypicalGroup.setGroupBasionym(TaxonNameBase basionymName)
*/
+ @Override
@Transient
public void makeGroupsBasionym() {
this.homotypicalGroup.setGroupBasionym(this);
* @see #isSpecies()
* @see #isInfraSpecific()
*/
+ @Override
@Transient
public boolean isSupraGeneric() {
if (rank == null){
* @see #isSpecies()
* @see #isInfraSpecific()
*/
+ @Override
@Transient
public boolean isGenus() {
if (rank == null){
* @see #isSpecies()
* @see #isInfraSpecific()
*/
+ @Override
@Transient
public boolean isInfraGeneric() {
if (rank == null){
* @see #isSpecies()
* @see #isInfraSpecific()
*/
+ @Override
@Transient
public boolean isSupraSpecific(){
if (rank == null) {
* @see #isInfraGeneric()
* @see #isInfraSpecific()
*/
+ @Override
@Transient
public boolean isSpecies() {
if (rank == null){
* @see #isInfraGeneric()
* @see #isSpecies()
*/
+ @Override
@Transient
public boolean isInfraSpecific() {
if (rank == null){
*
* @return
*/
+ @Override
@Transient
public boolean isSpeciesAggregate() {
if (rank == null){
* @see #isCodeCompliant()
* @see #getHasProblem()
*/
+ @Override
public NomenclaturalCode getNomenclaturalCode() {
logger.warn("TaxonNameBase has no specific Code defined. Use subclasses");
return null;
*
* @param basionymName
*/
+ @Override
@Transient
public void setAsGroupsBasionym() {
*
* @param basionymName
*/
+ @Override
@Transient
public void removeAsGroupsBasionym() {