Project

General

Profile

Download (45.5 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.model.name;
10

    
11
import java.util.List;
12
import java.util.Set;
13

    
14
import javax.persistence.Transient;
15

    
16
import eu.etaxonomy.cdm.compare.name.TaxonNameComparator;
17
import eu.etaxonomy.cdm.compare.taxon.TaxonComparator;
18
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
19
import eu.etaxonomy.cdm.model.common.IParsable;
20
import eu.etaxonomy.cdm.model.common.IRelated;
21
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
22
import eu.etaxonomy.cdm.model.common.Language;
23
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
24
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
25
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
26
import eu.etaxonomy.cdm.model.reference.Reference;
27
import eu.etaxonomy.cdm.model.taxon.Synonym;
28
import eu.etaxonomy.cdm.model.taxon.Taxon;
29
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
30
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
31
import eu.etaxonomy.cdm.strategy.match.IMatchable;
32

    
33
/**
34
 *
35
 * The upmost interface for taxon names.
36
 * <P>
37
 * This class corresponds partially to: <ul>
38
 * <li> TaxonName according to the TDWG ontology
39
 * <li> ScientificName and CanonicalName according to the TCS
40
 * <li> ScientificName according to the ABCD schema
41
 * </ul>
42
 *
43
 * ITaxonNameBase and it's extensions should only be used for type safety
44
 * of {@link TaxonName} instances. It should not be used to interface
45
 * instances of any other class
46
 *
47
 * @author a.mueller
48
 * @since 21.01.2017
49
 *
50
 */
51
public interface ITaxonNameBase
52
        extends IIdentifiableEntity, IParsable, IRelated, IMatchable, Cloneable{
53

    
54

    
55
    public NomenclaturalCode getNameType();
56
    public void setNameType(NomenclaturalCode nameType);
57

    
58
    public String generateFullTitle();
59

    
60
    @Transient
61
    public String getFullTitleCache();
62

    
63
    public List<TaggedText> getTaggedName();
64

    
65
    public List<TaggedText> getTaggedFullTitle();
66

    
67
    public void setFullTitleCache(String fullTitleCache);
68

    
69
    public void setFullTitleCache(String fullTitleCache, boolean protectCache);
70

    
71
    public boolean isProtectedFullTitleCache();
72

    
73
    void setProtectedFullTitleCache(boolean protectedFullTitleCache);
74

    
75
    /**
76
     * Returns the set of all {@link NameRelationship name relationships}
77
     * in which <i>this</i> taxon name is involved. A taxon name can be both source
78
     * in some name relationships or target in some others.
79
     *
80
     * @see    #getRelationsToThisName()
81
     * @see    #getRelationsFromThisName()
82
     * @see    #addNameRelationship(NameRelationship)
83
     * @see    #addRelationshipToName(TaxonName, NameRelationshipType, String)
84
     * @see    #addRelationshipFromName(TaxonName, NameRelationshipType, String)
85
     */
86
    public Set<NameRelationship> getNameRelations();
87

    
88
    /**
89
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship} from <i>this</i> taxon name to another taxon name
90
     * and adds it both to the set of {@link #getRelationsFromThisName() relations from <i>this</i> taxon name} and
91
     * to the set of {@link #getRelationsToThisName() relations to the other taxon name}.
92
     *
93
     * @param toName          the taxon name of the target for this new name relationship
94
     * @param type            the type of this new name relationship
95
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
96
     * @returnthe             created relationship
97
     * @see                   #getRelationsToThisName()
98
     * @see                   #getNameRelations()
99
     * @see                   #addRelationshipFromName(TaxonName, NameRelationshipType, String)
100
     * @see                   #addNameRelationship(NameRelationship)
101
     */
102
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
103

    
104
    /**
105
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship} from <i>this</i> taxon name to another taxon name
106
     * and adds it both to the set of {@link #getRelationsFromThisName() relations from <i>this</i> taxon name} and
107
     * to the set of {@link #getRelationsToThisName() relations to the other taxon name}.
108
     *
109
     * @param toName          the taxon name of the target for this new name relationship
110
     * @param type            the type of this new name relationship
111
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
112
     * @param codeEdition     the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
113
     * @return                the created relationship
114
     * @see                   #getRelationsToThisName()
115
     * @see                   #getNameRelations()
116
     * @see                   #addRelationshipFromName(TaxonName, NameRelationshipType, String)
117
     * @see                   #addNameRelationship(NameRelationship)
118
     */
119
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type);
120

    
121
    /**
122
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship} from <i>this</i> taxon name to another taxon name
123
     * and adds it both to the set of {@link #getRelationsFromThisName() relations from <i>this</i> taxon name} and
124
     * to the set of {@link #getRelationsToThisName() relations to the other taxon name}.
125
     *
126
     * @param toName          the taxon name of the target for this new name relationship
127
     * @param type            the type of this new name relationship
128
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
129
     * @return                the created relationship
130
     * @see                   #getRelationsToThisName()
131
     * @see                   #getNameRelations()
132
     * @see                   #addRelationshipFromName(TaxonName, NameRelationshipType, String)
133
     * @see                   #addNameRelationship(NameRelationship)
134
     */
135
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, Reference citation,
136
            String microCitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
137

    
138
    /**
139
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship} from another taxon name to <i>this</i> taxon name
140
     * and adds it both to the set of {@link #getRelationsToThisName() relations to <i>this</i> taxon name} and
141
     * to the set of {@link #getRelationsFromThisName() relations from the other taxon name}.
142
     *
143
     * @param fromName        the taxon name of the source for this new name relationship
144
     * @param type            the type of this new name relationship
145
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
146
     * @param citation        the reference in which this relation was described
147
     * @param microCitation   the reference detail for this relation (e.g. page)
148
     * @see                   #getRelationsFromThisName()
149
     * @see                   #getNameRelations()
150
     * @see                   #addRelationshipToName(TaxonName, NameRelationshipType, String)
151
     * @see                   #addNameRelationship(NameRelationship)
152
     */
153
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
154

    
155
    /**
156
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship}
157
     * from another taxon name to <i>this</i> taxon name
158
     * and adds it both to the set of {@link #getRelationsToThisName() relations to <i>this</i> taxon name} and
159
     * to the set of {@link #getRelationsFromThisName() relations from the other taxon name}.
160
     *
161
     * @param fromName        the taxon name of the source for this new name relationship
162
     * @param type            the type of this new name relationship
163
     * @see                   #getRelationsFromThisName()
164
     * @see                   #getNameRelations()
165
     * @see                   #addRelationshipToName(TaxonName, NameRelationshipType, String)
166
     * @see                   #addNameRelationship(NameRelationship)
167
     */
168
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type);
169

    
170
    /**
171
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship}
172
     * from another taxon name to <i>this</i> taxon name
173
     * and adds it both to the set of {@link #getRelationsToThisName() relations to <i>this</i> taxon name} and
174
     * to the set of {@link #getRelationsFromThisName() relations from the other taxon name}.
175
     *
176
     * @param fromName        the taxon name of the source for this new name relationship
177
     * @param type            the type of this new name relationship
178
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
179
     * @param citation        the reference in which this relation was described
180
     * @param microCitation   the reference detail for this relation (e.g. page)
181
     * @param codeEdition     the nomenclatural code used for the considered rule
182
     * @see                   #getRelationsFromThisName()
183
     * @see                   #getNameRelations()
184
     * @see                   #addRelationshipToName(TaxonName, NameRelationshipType, String)
185
     * @see                   #addNameRelationship(NameRelationship)
186
     */
187
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, Reference citation,
188
            String microCitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
189

    
190
    /**
191
     * Removes one {@link NameRelationship name relationship} from one of both sets of
192
     * {@link #getNameRelations() name relationships} in which <i>this</i> taxon name is involved.
193
     * The name relationship will also be removed from one of both sets belonging
194
     * to the second taxon name involved. Furthermore the fromName and toName
195
     * attributes of the name relationship object will be nullified.
196
     *
197
     * @param  nameRelation  the name relationship which should be deleted from one of both sets
198
     * @see                  #getNameRelations()
199
     */
200
    public void removeNameRelationship(NameRelationship nameRelation);
201

    
202
    public void removeRelationToTaxonName(TaxonName toTaxonName);
203

    
204
    /**
205
     * Returns the set of all {@link NameRelationship name relationships}
206
     * in which <i>this</i> taxon name is involved as a source ("from"-side).
207
     *
208
     * @see    #getNameRelations()
209
     * @see    #getRelationsToThisName()
210
     * @see    #addRelationshipFromName(TaxonName, NameRelationshipType, String)
211
     */
212
    public Set<NameRelationship> getRelationsFromThisName();
213

    
214
    /**
215
     * Returns the set of all {@link NameRelationship name relationships}
216
     * in which <i>this</i> taxon name is involved as a target ("to"-side).
217
     *
218
     * @see    #getNameRelations()
219
     * @see    #getRelationsFromThisName()
220
     * @see    #addRelationshipToName(TaxonName, NameRelationshipType, String)
221
     */
222
    public Set<NameRelationship> getRelationsToThisName();
223

    
224
    /**
225
     * Returns the set of {@link NomenclaturalStatus nomenclatural status} assigned
226
     * to <i>this</i> taxon name according to its corresponding nomenclature code.
227
     * This includes the {@link NomenclaturalStatusType type} of the nomenclatural status
228
     * and the nomenclatural code rule considered.
229
     *
230
     * @see     NomenclaturalStatus
231
     * @see     NomenclaturalStatusType
232
     */
233
    public Set<NomenclaturalStatus> getStatus();
234

    
235
    /**
236
     * Adds a new {@link NomenclaturalStatus nomenclatural status}
237
     * to <i>this</i> taxon name's set of nomenclatural status.
238
     *
239
     * @param  nomStatus  the nomenclatural status to be added
240
     * @see               #getStatus()
241
     */
242
    public void addStatus(NomenclaturalStatus nomStatus);
243

    
244
    public NomenclaturalStatus addStatus(NomenclaturalStatusType statusType, Reference citation, String microCitation);
245

    
246
    /**
247
     * Removes one element from the set of nomenclatural status of <i>this</i> taxon name.
248
     * Type and ruleConsidered attributes of the nomenclatural status object
249
     * will be nullified.
250
     *
251
     * @param  nomStatus  the nomenclatural status of <i>this</i> taxon name which should be deleted
252
     * @see               #getStatus()
253
     */
254
    public void removeStatus(NomenclaturalStatus nomStatus);
255

    
256
    /**
257
     * Indicates whether <i>this</i> taxon name is a {@link NameRelationshipType#BASIONYM() basionym}
258
     * or a {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonym}
259
     * of any other taxon name. Returns "true", if a basionym or a replaced
260
     * synonym {@link NameRelationship relationship} from <i>this</i> taxon name to another taxon name exists,
261
     * false otherwise (also in case <i>this</i> taxon name is the only one in the
262
     * homotypical group).
263
     */
264
    public boolean isOriginalCombination();
265

    
266
    /**
267
     * Indicates <i>this</i> taxon name is a {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonym}
268
     * of any other taxon name. Returns "true", if a replaced
269
     * synonym {@link NameRelationship relationship} from <i>this</i> taxon name to another taxon name exists,
270
     * false otherwise (also in case <i>this</i> taxon name is the only one in the
271
     * homotypical group).
272
     */
273
    public boolean isReplacedSynonym();
274

    
275
    /**
276
     * Returns the taxon name which is the {@link NameRelationshipType#BASIONYM() basionym} of <i>this</i> taxon name.
277
     * The basionym of a taxon name is its epithet-bringing synonym.
278
     * For instance <i>Pinus abies</i> L. was published by Linnaeus and the botanist
279
     * Karsten transferred later <i>this</i> taxon to the genus Picea. Therefore,
280
     * <i>Pinus abies</i> L. is the basionym of the new combination <i>Picea abies</i> (L.) H. Karst.
281
     *
282
     * If more than one basionym exists one is choosen at radom.
283
     *
284
     * If no basionym exists null is returned.
285
     */
286
    public TaxonName getBasionym();
287

    
288
    /**
289
     * Returns the set of taxon names which are the {@link NameRelationshipType#BASIONYM() basionyms} of <i>this</i> taxon name.
290
     * The basionym of a taxon name is its epithet-bringing synonym.
291
     * For instance <i>Pinus abies</i> L. was published by Linnaeus and the botanist
292
     * Karsten transferred later <i>this</i> taxon to the genus Picea. Therefore,
293
     * <i>Pinus abies</i> L. is the basionym of the new combination <i>Picea abies</i> (L.) H. Karst.
294
     */
295
    public Set<TaxonName> getBasionyms();
296

    
297
    /**
298
     * Assigns a taxon name as {@link NameRelationshipType#BASIONYM() basionym} of <i>this</i> taxon name.
299
     * The basionym {@link NameRelationship relationship} will be added to <i>this</i> taxon name
300
     * and to the basionym. The basionym cannot have itself a basionym.
301
     * The {@link HomotypicalGroup homotypical groups} of <i>this</i> taxon name and of the basionym
302
     * will be {@link HomotypicalGroup#merge(HomotypicalGroup) merged}.
303
     *
304
     * @param  basionym     the taxon name to be set as the basionym of <i>this</i> taxon name
305
     * @return
306
     * @see                 #getBasionym()
307
     * @see                 #addBasionym(TaxonName, String)
308
     */
309
    public NameRelationship addBasionym(TaxonName basionym);
310

    
311
    /**
312
     * Assigns a taxon name as {@link NameRelationshipType#BASIONYM() basionym} of <i>this</i> taxon name
313
     * and keeps the nomenclatural rule considered for it. The basionym
314
     * {@link NameRelationship relationship} will be added to <i>this</i> taxon name and to the basionym.
315
     * The basionym cannot have itself a basionym.
316
     * The {@link HomotypicalGroup homotypical groups} of <i>this</i> taxon name and of the basionym
317
     * will be {@link HomotypicalGroup#merge(HomotypicalGroup) merged}.
318
     *
319
     * @param  basionym         the taxon name to be set as the basionym of <i>this</i> taxon name
320
     * @param  ruleConsidered   the string identifying the nomenclatural rule
321
     * @return
322
     * @see                     #getBasionym()
323
     * @see                     #addBasionym(TaxonName)
324
     */
325
    public NameRelationship addBasionym(TaxonName basionym, Reference citation, String microcitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
326

    
327
    /**
328
     * Removes the {@link NameRelationshipType#BASIONYM() basionym} {@link NameRelationship relationship} from the set of
329
     * {@link #getRelationsToThisName() name relationships to} <i>this</i> taxon name. The same relationhip will be
330
     * removed from the set of {@link #getRelationsFromThisName() name relationships from} the taxon name
331
     * previously used as basionym.
332
     *
333
     * @see   #getBasionym()
334
     * @see   #addBasionym(TaxonName)
335
     */
336
    public void removeBasionyms();
337

    
338
    /**
339
     * Returns the set of taxon names which are the {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonyms} of <i>this</i> taxon name.
340
     *
341
     */
342
    public Set<TaxonName> getReplacedSynonyms();
343

    
344
    /**
345
     * Assigns a taxon name as {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonym} of <i>this</i> taxon name
346
     * and keeps the nomenclatural rule considered for it. The replaced synonym
347
     * {@link NameRelationship relationship} will be added to <i>this</i> taxon name and to the replaced synonym.
348
     * The {@link HomotypicalGroup homotypical groups} of <i>this</i> taxon name and of the replaced synonym
349
     * will be {@link HomotypicalGroup#merge(HomotypicalGroup) merged}.
350
     *
351
     * @param  basionym         the taxon name to be set as the basionym of <i>this</i> taxon name
352
     * @param  ruleConsidered   the string identifying the nomenclatural rule
353
     * @see                     #getBasionym()
354
     * @see                     #addBasionym(TaxonName)
355
     */
356
    //TODO: Check if true: The replaced synonym cannot have itself a replaced synonym (?).
357
    public void addReplacedSynonym(TaxonName replacedSynonym, Reference citation, String microcitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
358

    
359

    
360
    /**
361
     * Returns the original spelling (taxon name used in nomenclatural source).
362
     */
363
    @Transient
364
    public TaxonName getOriginalSpelling();
365

    
366
    /**
367
     * Sets the original spelling in the nomenclatural source.
368
     * Creates the source if it does not exist yet.
369
     */
370
    public void setOriginalSpelling(TaxonName originalSpelling);
371

    
372
    /**
373
     * Sets the original info in the nomenclatural source.
374
     * Creates the source if it does not exist.
375
     */
376
    public void setOriginalInfo(String originalInfo);
377

    
378
    /**
379
     * Returns the taxonomic {@link Rank rank} of <i>this</i> taxon name.
380
     *
381
     * @see     Rank
382
     */
383
    public Rank getRank();
384

    
385
    /**
386
     * @see  #getRank()
387
     */
388
    public void setRank(Rank rank);
389

    
390
    /**
391
     * Returns the {@link eu.etaxonomy.cdm.model.reference.Reference nomenclatural reference} of <i>this</i> taxon name.
392
     * The nomenclatural reference is here meant to be the one publication
393
     * <i>this</i> taxon name was originally published in while fulfilling the formal
394
     * requirements as specified by the corresponding {@link NomenclaturalCode nomenclatural code}.
395
     *
396
     * @see     eu.etaxonomy.cdm.model.reference.Reference
397
     * @see #getNomenclaturalSource()
398
     */
399
    public Reference getNomenclaturalReference();
400

    
401
    /**
402
     * Assigns a {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} to <i>this</i> taxon name.
403
     * The corresponding {@link eu.etaxonomy.cdm.model.reference.Reference.isNomenclaturallyRelevant nomenclaturally relevant flag} will be set to true
404
     * as it is obviously used for nomenclatural purposes.
405
     *
406
     * @see  #getNomenclaturalReference()
407
     */
408
    public void setNomenclaturalReference(Reference nomenclaturalReference);
409

    
410
    /**
411
     * Same as setNomenclaturalReferences, to also allow interfaces to be used.
412
     * @see #setNomenclaturalReference(Reference)
413
     * @param nomenclaturalReference
414
     */
415
    public void setNomenclaturalReference(INomenclaturalReference nomenclaturalReference);
416

    
417
    /**
418
     * Returns the details string of the {@link #getNomenclaturalReference() nomenclatural reference} assigned
419
     * to <i>this</i> taxon name. The details describe the exact localisation within
420
     * the publication used as nomenclature reference. These are mostly
421
     * (implicitly) pages but can also be figures or tables or any other
422
     * element of a publication. A nomenclatural micro reference (details)
423
     * requires the existence of a nomenclatural reference.
424
     *
425
     * @see #getNomenclaturalReference()
426
     * @see #getNomenclaturalSource()
427
     */
428
    public String getNomenclaturalMicroReference();
429

    
430
    /**
431
     * @see  #getNomenclaturalMicroReference()
432
     */
433
    public void setNomenclaturalMicroReference(String nomenclaturalMicroReference);
434

    
435
    /**
436
     * Sets the nomenclatural source which is a combination of the nomenclatural reference
437
     * and the detail information (exact page, table, figure, ...) where to find this name
438
     * for the first time.
439
     *
440
     * @see #getNomenclaturalReference()
441
     * @see #getNomenclaturalMicroReference()
442
     */
443
    public NomenclaturalSource getNomenclaturalSource();
444

    
445
    /**
446
     * Sets the nomenclatural source
447
     * @param nomenclaturalSource
448
     */
449
    public void setNomenclaturalSource(NomenclaturalSource nomenclaturalSource);
450

    
451

    
452
    /**
453
     * Returns the appended phrase string assigned to <i>this</i> taxon name.
454
     * The appended phrase is a non-atomised addition to a name. It is
455
     * not ruled by a nomenclatural code.
456
     */
457
    public String getAppendedPhrase();
458

    
459
    /**
460
     * @see  #getAppendedPhrase()
461
     */
462
    public void setAppendedPhrase(String appendedPhrase);
463

    
464

    
465
    /**
466
     * @param warnings
467
     */
468
    public void addParsingProblems(int problems);
469

    
470
    /**
471
     * Returns the set of {@link TypeDesignationBase type designations} assigned
472
     * to <i>this</i> taxon name.
473
     * @see     NameTypeDesignation
474
     * @see     SpecimenTypeDesignation
475
     */
476
    public Set<TypeDesignationBase> getTypeDesignations();
477

    
478
    /**
479
     * Removes one element from the set of {@link TypeDesignationBase type designations} assigned to
480
     * <i>this</i> taxon name. The type designation itself will be nullified.
481
     *
482
     * @param  typeDesignation  the type designation which should be deleted
483
     */
484
    public void removeTypeDesignation(TypeDesignationBase<? >typeDesignation);
485

    
486
    /**
487
     * Returns the set of {@link SpecimenTypeDesignation specimen type designations} assigned
488
     * to <i>this</i> taxon name. The {@link Rank rank} of <i>this</i> taxon name is generally
489
     * "species" or below. The specimen type designations include all the
490
     * specimens on which the typification of this name is based (which are
491
     * exclusively used to typify taxon names belonging to the same
492
     * {@link HomotypicalGroup homotypical group} to which <i>this</i> taxon name
493
     * belongs) and eventually the status of these designations.
494
     *
495
     * @see     SpecimenTypeDesignation
496
     * @see     NameTypeDesignation
497
     * @see     HomotypicalGroup
498
     */
499
    public Set<SpecimenTypeDesignation> getSpecimenTypeDesignationsOfHomotypicalGroup();
500

    
501
    /**
502
     * Returns the set of {@link NameTypeDesignation name type designations} assigned
503
     * to <i>this</i> taxon name the rank of which must be above "species".
504
     * The name type designations include all the taxon names used to typify
505
     * <i>this</i> taxon name and eventually the rejected or conserved status
506
     * of these designations.
507
     *
508
     * @see     NameTypeDesignation
509
     * @see     SpecimenTypeDesignation
510
     */
511
    public Set<NameTypeDesignation> getNameTypeDesignations();
512

    
513
    /**
514
     * Creates and adds a new {@link NameTypeDesignation name type designation}
515
     * to <i>this</i> taxon name's set of type designations.
516
     *
517
     * @param  typeSpecies              the taxon name to be used as type of <i>this</i> taxon name
518
     * @param  citation                 the reference for this new designation
519
     * @param  citationMicroReference   the string with the details (generally pages) within the reference
520
     * @param  originalInfo             any information from the original source, might be the name as written in the source (#10097)
521
     * @param  isRejectedType           the boolean status for a rejected name type designation
522
     * @param  isConservedType          the boolean status for a conserved name type designation
523
     * @param  isLectoType              the boolean status for a lectotype name type designation
524
     * @param  isNotDesignated          the boolean status for a name type designation without name type
525
     * @param  addToAllHomotypicNames   the boolean indicating whether the name type designation should be
526
     *                                  added to all taxon names of the homotypical group this taxon name belongs to
527
     * @return
528
     * @see                             #getNameTypeDesignations()
529
     * @see                             NameTypeDesignation
530
     * @see                             TypeDesignationBase#isNotDesignated()
531
     */
532
    public NameTypeDesignation addNameTypeDesignation(TaxonName typeSpecies, Reference citation,
533
            String citationMicroReference, String originalInfo, NameTypeDesignationStatus status,
534
            boolean isRejectedType, boolean isConservedType,
535
            /*boolean isLectoType, */
536
            boolean isNotDesignated, boolean addToAllHomotypicNames);
537

    
538
    /**
539
     * Creates and adds a new {@link NameTypeDesignation name type designation}
540
     * to <i>this</i> taxon name's set of type designations.
541
     *
542
     * @param  typeSpecies              the taxon name to be used as type of <i>this</i> taxon name
543
     * @param  citation                 the reference for this new designation
544
     * @param  citationMicroReference   the string with the details (generally pages) within the reference
545
     * @param  originalInfo             any information from the original source, might be the name as written in the source (#10097)
546
     * @param  status                   the name type designation status
547
     * @param  addToAllHomotypicNames   the boolean indicating whether the name type designation should be
548
     *                                  added to all taxon names of the homotypical group this taxon name belongs to
549
     * @return
550
     * @see                             #getNameTypeDesignations()
551
     * @see                             NameTypeDesignation
552
     * @see                             TypeDesignationBase#isNotDesignated()
553
     */
554
    public NameTypeDesignation addNameTypeDesignation(TaxonName typeSpecies, Reference citation,
555
            String citationMicroReference, String originalInfo, NameTypeDesignationStatus status,
556
            boolean addToAllHomotypicNames);
557

    
558
    /**
559
     * Returns the set of {@link SpecimenTypeDesignation specimen type designations}
560
     * that typify <i>this</i> taxon name.
561
     */
562
    public Set<SpecimenTypeDesignation> getSpecimenTypeDesignations();
563

    
564
    /**
565
     * Creates and adds a new {@link SpecimenTypeDesignation specimen type designation}
566
     * to <i>this</i> taxon name's set of type designations.
567
     *
568
     * @param  typeSpecimen             the specimen to be used as a type for <i>this</i> taxon name
569
     * @param  status                   the specimen type designation status
570
     * @param  citation                 the reference for this new specimen type designation
571
     * @param  citationMicroReference   the string with the details (generally pages) within the reference
572
     * @param  originalInfo             any information from the original source, might be the name as written in the source (#10097)
573
     * @param  isNotDesignated          the boolean status for a specimen type designation without specimen type
574
     * @param  addToAllHomotypicNames   the boolean indicating whether the specimen type designation should be
575
     *                                  added to all taxon names of the homotypical group the typified
576
     *                                  taxon name belongs to
577
     * @return
578
     * @see                             #getSpecimenTypeDesignations()
579
     * @see                             SpecimenTypeDesignationStatus
580
     * @see                             SpecimenTypeDesignation
581
     * @see                             TypeDesignationBase#isNotDesignated()
582
     */
583
    public SpecimenTypeDesignation addSpecimenTypeDesignation(DerivedUnit typeSpecimen, SpecimenTypeDesignationStatus status,
584
            Reference citation, String citationMicroReference, String originalInfo, boolean isNotDesignated,
585
            boolean addToAllHomotypicNames);
586

    
587
    /**
588
     * Creates and adds a new {@link TextualTypeDesignation textual type designation}
589
     * to <i>this</i> taxon name's set of type designations.
590
     *
591
     * @param text                      the text
592
     * @param language                  the language of the text, if no language is defined {@link Language#UNDETERMINED()} is used
593
     * @param isVerbatim                whether or not this the text is a verbatim text from a reference
594
     * @param citation                  the reference for this new specimen type designation
595
     * @param citationMicroReference    the string with the details (generally pages) within the reference
596
     * @param originalInfo              any information from the original source, might be the name as written in the source (#10097)
597
     * @param addToAllHomotypicNames    the boolean indicating whether the specimen type designation should be
598
     * @return
599
     */
600
    TextualTypeDesignation addTextualTypeDesignation(String text, Language language, boolean isVerbatim,
601
            Reference citation, String citationMicroReference, String originalInfo,
602
            boolean addToAllHomotypicNames);
603

    
604

    
605
    /**
606
     * Adds a {@link TypeDesignationBase type designation} to <code>this</code> taxon name's set of type designations
607
     *
608
     * @param typeDesignation           the typeDesignation to be added to <code>this</code> taxon name
609
     * @param addToAllNames             the boolean indicating whether the type designation should be
610
     *                                  added to all taxon names of the homotypical group the typified
611
     *                                  taxon name belongs to
612
     * @return                          true if the operation was successful
613
     *
614
     * @throws IllegalArgumentException if the type designation already has typified names, an {@link IllegalArgumentException exception}
615
     *                                  is thrown. We do this to prevent a type designation to be used for multiple taxon names.
616
     *
617
     */
618
    public boolean addTypeDesignation(TypeDesignationBase<?> typeDesignation, boolean addToAllNames);
619

    
620
    /**
621
     * Returns the {@link HomotypicalGroup homotypical group} to which
622
     * <i>this</i> taxon name belongs. A homotypical group represents all taxon names
623
     * that share the same types.
624
     *
625
     * @see     HomotypicalGroup
626
     */
627

    
628
    public HomotypicalGroup getHomotypicalGroup();
629

    
630
    /**
631
     * @see #getHomotypicalGroup()
632
     */
633
    public void setHomotypicalGroup(HomotypicalGroup homotypicalGroup);
634

    
635
    /**
636
     * Returns the complete string containing the
637
     * {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference#getNomenclaturalCitation() nomenclatural reference citation}
638
     * and the {@link #getNomenclaturalMicroReference() details} assigned to <i>this</i> taxon name.
639
     *
640
     * @return  the string containing the nomenclatural reference of <i>this</i> taxon name
641
     * @see     eu.etaxonomy.cdm.model.reference.INomenclaturalReference#getNomenclaturalCitation()
642
     * @see     #getNomenclaturalReference()
643
     * @see     #getNomenclaturalMicroReference()
644
     */
645
    public String getCitationString();
646

    
647
    /**
648
     * Returns the string containing the publication date (generally only year)
649
     * of the {@link #getNomenclaturalReference() nomenclatural reference} for <i>this</i> taxon name, null if there is
650
     * no nomenclatural reference.
651
     *
652
     * @return  the string containing the publication date of <i>this</i> taxon name
653
     * @see     eu.etaxonomy.cdm.model.reference.INomenclaturalReference#getYear()
654
     */
655
    public String getReferenceYear();
656

    
657
    /**
658
     * Returns the set of {@link eu.etaxonomy.cdm.model.taxon.TaxonBase taxon bases} that refer to <i>this</i> taxon name.
659
     * In this context a taxon base means the use of a taxon name by a reference
660
     * either as a {@link eu.etaxonomy.cdm.model.taxon.Taxon taxon} ("accepted/correct" name) or
661
     * as a (junior) {@link eu.etaxonomy.cdm.model.taxon.Synonym synonym}.
662
     * A taxon name can be used by several distinct {@link eu.etaxonomy.cdm.model.reference.Reference references} but only once
663
     * within a taxonomic treatment (identified by one reference).
664
     *
665
     * @see #getTaxa()
666
     * @see #getSynonyms()
667
     */
668
    public Set<TaxonBase> getTaxonBases();
669

    
670
    /**
671
     * Adds a new {@link eu.etaxonomy.cdm.model.taxon.TaxonBase taxon base}
672
     * to the set of taxon bases using <i>this</i> taxon name.
673
     *
674
     * @param  taxonBase  the taxon base to be added
675
     * @see               #getTaxonBases()
676
     * @see               #removeTaxonBase(TaxonBase)
677
     */
678
    //TODO protected
679
    public void addTaxonBase(TaxonBase taxonBase);
680

    
681
    /**
682
     * Removes one element from the set of {@link eu.etaxonomy.cdm.model.taxon.TaxonBase taxon bases} that refer to <i>this</i> taxon name.
683
     *
684
     * @param  taxonBase    the taxon base which should be removed from the corresponding set
685
     * @see                 #getTaxonBases()
686
     * @see                 #addTaxonBase(TaxonBase)
687
     */
688
    public void removeTaxonBase(TaxonBase taxonBase);
689

    
690
    /**
691
     * Returns the set of {@link eu.etaxonomy.cdm.model.taxon.Taxon taxa} ("accepted/correct" names according to any
692
     * reference) that are based on <i>this</i> taxon name. This set is a subset of
693
     * the set returned by getTaxonBases().
694
     *
695
     * @see eu.etaxonomy.cdm.model.taxon.Taxon
696
     * @see #getTaxonBases()
697
     * @see #getSynonyms()
698
     */
699
    public Set<Taxon> getTaxa();
700

    
701
    /**
702
     * Returns the set of {@link eu.etaxonomy.cdm.model.taxon.Synonym (junior) synonyms} (according to any
703
     * reference) that are based on <i>this</i> taxon name. This set is a subset of
704
     * the set returned by getTaxonBases().
705
     *
706
     * @see eu.etaxonomy.cdm.model.taxon.Synonym
707
     * @see #getTaxonBases()
708
     * @see #getTaxa()
709
     */
710
    public Set<Synonym> getSynonyms();
711

    
712
    /**
713
     * Returns the set of {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription taxon name descriptions} assigned
714
     * to <i>this</i> taxon name. A taxon name description is a piece of information
715
     * concerning the taxon name like for instance the content of its first
716
     * publication (protolog) or a picture of this publication.
717
     *
718
     * @see #addDescription(TaxonNameDescription)
719
     * @see #removeDescription(TaxonNameDescription)
720
     * @see eu.etaxonomy.cdm.model.description.TaxonNameDescription
721
     */
722
    public Set<TaxonNameDescription> getDescriptions();
723

    
724
    /**
725
     * Adds a new {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription taxon name description}
726
     * to the set of taxon name descriptions assigned to <i>this</i> taxon name. The
727
     * content of the {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription#getTaxonName() taxonName attribute} of the
728
     * taxon name description itself will be replaced with <i>this</i> taxon name.
729
     *
730
     * @param  description  the taxon name description to be added
731
     * @see                 #getDescriptions()
732
     * @see                 #removeDescription(TaxonNameDescription)
733
     */
734
    public void addDescription(TaxonNameDescription description);
735

    
736
    /**
737
     * Removes one element from the set of {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription taxon name descriptions} assigned
738
     * to <i>this</i> taxon name. The content of the {@link eu.etaxonomy.cdm.model.description.TaxonNameDescription#getTaxonName() taxonName attribute}
739
     * of the description itself will be set to "null".
740
     *
741
     * @param  description  the taxon name description which should be removed
742
     * @see                 #getDescriptions()
743
     * @see                 #addDescription(TaxonNameDescription)
744
     * @see                 eu.etaxonomy.cdm.model.description.TaxonNameDescription#getTaxonName()
745
     */
746
    public void removeDescription(TaxonNameDescription description);
747

    
748
    public void mergeHomotypicGroups(TaxonName name);
749

    
750
    /**
751
     * Returns the boolean value indicating whether a given taxon name belongs
752
     * to the same {@link HomotypicalGroup homotypical group} as <i>this</i> taxon name (true)
753
     * or not (false). Returns "true" only if the homotypical groups of both
754
     * taxon names exist and if they are identical.
755
     *
756
     * @param   homoTypicName  the taxon name the homotypical group of which is to be checked
757
     * @return                 the boolean value of the check
758
     * @see                    HomotypicalGroup
759
     */
760
    public boolean isHomotypic(TaxonName homoTypicName);
761

    
762
    /**
763
     * Checks whether name is a basionym for ALL names
764
     * in its homotypical group.
765
     * Returns <code>false</code> if there are no other names in the group
766
     * @param name
767
     * @return
768
     */
769
    public boolean isGroupsBasionym();
770

    
771
    /**
772
     * Checks whether a basionym relationship exists between fromName and toName.
773
     *
774
     * @param fromName
775
     * @param toName
776
     * @return
777
     */
778
    public boolean isBasionymFor(TaxonName newCombinationName);
779

    
780
    /**
781
     * Creates a basionym relationship to all other names in this names homotypical
782
     * group.
783
     *
784
     * @see HomotypicalGroup.setGroupBasionym(TaxonName basionymName)
785
     */
786
    public void makeGroupsBasionym();
787

    
788
    //*********  Rank comparison shortcuts   ********************//
789
    /**
790
     * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
791
     * taxon name is higher than the genus rank (true) or not (false).
792
     * Suprageneric non viral names are monomials.
793
     * Returns false if rank is null.
794
     *
795
     * @see  #isGenus()
796
     * @see  #isInfraGeneric()
797
     * @see  #isSpecies()
798
     * @see  #isInfraSpecific()
799
     * @see  #isGenusOrSupraGeneric()
800
     */
801
    public boolean isSupraGeneric();
802

    
803
    /**
804
     * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
805
     * taxon name is the genus rank (true) or not (false). Non viral names with
806
     * genus rank are monomials. Returns false if rank is null.
807
     *
808
     * @see  #isSupraGeneric()
809
     * @see  #isInfraGeneric()
810
     * @see  #isSpecies()
811
     * @see  #isInfraSpecific()
812
     * @see  #isGenusOrSupraGeneric()
813
     */
814
    public boolean isGenus();
815

    
816

    
817
    /**
818
     * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
819
     * taxon name is the genus rank or higher (<code>true</code>) or not (<code>false</code>).
820
     * Non viral names with
821
     * genus rank or higher are monomials. Returns false if rank is null.<BR>
822
     * This is a shortcut for {@link #isGenus()} || {@link #isSupraGeneric()}
823
     *
824
     * @see  #isGenus()
825
     * @see  #isSupraGeneric()
826
     * @see  #isInfraGeneric()
827
     * @see  #isSpecies()
828
     * @see  #isInfraSpecific()
829
     */
830
    boolean isGenusOrSupraGeneric();
831

    
832
    /**
833
     * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
834
     * taxon name is higher than the species rank and lower than the
835
     * genus rank (true) or not (false). Infrageneric non viral names are
836
     * binomials. Returns false if rank is null.
837
     *
838
     * @see  #isSupraGeneric()
839
     * @see  #isGenus()
840
     * @see  #isSpecies()
841
     * @see  #isInfraSpecific()
842
     */
843
    public boolean isInfraGeneric();
844

    
845
    /**
846
     * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
847
     * taxon name is higher than the species rank (true) or not (false).
848
     * Returns false if rank is null.
849
     *
850
     * @see  #isGenus()
851
     * @see  #isInfraGeneric()
852
     * @see  #isSpecies()
853
     * @see  #isInfraSpecific()
854
     */
855
    public boolean isSupraSpecific();
856

    
857
    /**
858
     * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
859
     * taxon name is the species rank (true) or not (false). Non viral names
860
     * with species rank are binomials.
861
     * Returns false if rank is null.
862
     *
863
     * @see  #isSupraGeneric()
864
     * @see  #isGenus()
865
     * @see  #isInfraGeneric()
866
     * @see  #isInfraSpecific()
867
     */
868
    public boolean isSpecies();
869

    
870
    /**
871
     * Returns the boolean value indicating whether the taxonomic {@link Rank rank} of <i>this</i>
872
     * taxon name is lower than the species rank (true) or not (false).
873
     * Infraspecific non viral names are trinomials.
874
     * Returns false if rank is null.
875
     *
876
     * @see  #isSupraGeneric()
877
     * @see  #isGenus()
878
     * @see  #isInfraGeneric()
879
     * @see  #isSpecies()
880
     */
881
    public boolean isInfraSpecific();
882

    
883
    /**
884
     * Returns true if this name's rank indicates a rank that aggregates species like species
885
     * aggregates or species groups, false otherwise. This methods currently returns false
886
     * for all user defined ranks.
887
     *
888
     *@see Rank#isSpeciesAggregate()
889
     *
890
     * @return
891
     */
892
    public boolean isSpeciesAggregate();
893

    
894
    /**
895
     * Creates a basionym relationship between this name and
896
     *  each name in its homotypic group.
897
     *
898
     * @param basionymName
899
     */
900
    public void setAsGroupsBasionym();
901

    
902
    /**
903
     * Removes basionym relationship between this name and
904
     *  each name in its homotypic group.
905
     *
906
     * @param basionymName
907
     */
908
    public void removeAsGroupsBasionym();
909

    
910
    /**
911
     * This method compares 2 taxon names on it's name titles and caches.
912
     * Maybe in future more parts will be added.
913
     * It is not fully clear/defined how this method relates to
914
     * explicit comparators like {@link TaxonNameComparator}.
915
     * Historically it was a compareTo method in {@link IdentifiableEntity}
916
     * but did not fulfill the {@link Comparable} contract.
917
     * <BR><BR>
918
     * {@link  https://dev.e-taxonomy.eu/redmine/issues/922}<BR>
919
     * {@link https://dev.e-taxonomy.eu/redmine/issues/6311}
920
     *
921
     * @see TaxonName#compareToName(TaxonName)
922
     * @see TaxonNameComparator
923
     * @see TaxonComparator
924
     * @param otherTaxon
925
     * @return the compareTo result similar to {@link Comparable#compareTo(Object)}
926
     * @throws NullPointerException if otherTaxon is <code>null</code>
927
     */
928
    public int compareToName(TaxonName otherName);
929

    
930
    /**
931
     * This method returns als {@link Registration registrations} for the given name.
932
     * @return
933
     */
934
    public Set<Registration> getRegistrations();
935

    
936

    
937
    /**
938
     * Returns <code>true</code> if this name is of type {@link NomenclaturalCode#ICZN} or
939
     * any sub type and is supposed to be handled via {@link IZoologicalName}
940
     */
941
    public boolean isZoological();
942

    
943
    /**
944
     * Returns <code>true</code> if this name is of type {@link NomenclaturalCode#NonViral} or
945
     * any sub type and is supposed to be handled via {@link INonViralName}
946
     */
947
    public boolean isNonViral();
948

    
949
    /**
950
     * Returns <code>true</code> if this name is of type {@link NomenclaturalCode#ICNAFP} or
951
     * any sub type and is supposed to be handled via {@link IBotanicalName}
952
     */
953
    public boolean isBotanical();
954

    
955
    /**
956
     * Returns <code>true</code> if this name is of type {@link NomenclaturalCode#ICNCP} or
957
     * any sub type and is supposed to be handled via {@link ICultivarPlantName}
958
     */
959
    boolean isCultivar();
960

    
961
    /**
962
     * Returns <code>true</code> if this name is of type {@link NomenclaturalCode#ICNP} or
963
     * any sub type and is supposed to be handled via {@link IBacterialName}
964
     */
965
    boolean isBacterial();
966

    
967
    /**
968
     * Returns <code>true</code> if this name is of type {@link NomenclaturalCode#ICVCN} or
969
     * any sub type and is supposed to be handled via {@link IViralName}
970
     */
971
    boolean isViral();
972

    
973
    /**
974
     * Clones <i>this</i> taxon name. This is a shortcut that enables to create
975
     * a new instance that differs only slightly from <i>this</i> taxon name by
976
     * modifying only some of the attributes.<BR>
977
     * <BR>
978
     * Usages of this name in a {@link TaxonBase taxa} are <b>not</b> cloned.<BR>
979
     * The <b>homotypical group</b> is created <b>anew</b> and not reused (if this
980
     * is not wanted
981
     * use {@link #clone(boolean)} instead).<BR><BR>
982
     * {@link TaxonNameDescription Name descriptions} are cloned and not reused. <BR>
983
     * {@link TypeDesignationBase Type designations} are cloned and not reused.<BR>
984
     *
985
     * {@link NameRelationship Name relationships} are cloned and not reused, <B>but the
986
     * related names are not cloned but reused</B>. This in some cases is not correct (e.g. for basionym
987
     * relationships but the correct handling needs to be better resolved in the
988
     * calling methods).
989
     *
990
     * @see eu.etaxonomy.cdm.model.media.IdentifiableEntity#clone()
991
     * @see java.lang.Object#clone()
992
     * @see #clone(boolean)
993
     */
994
    public TaxonName clone();
995

    
996
    /**
997
     * See {@link #clone()}
998
     *
999
     * @param cloneHomotypicGroup
1000
     *          If <code>true</code> a new homotypic group is created.
1001
     *          Else the existing homotypic group is reused.
1002
     */
1003
    public TaxonName clone(boolean cloneHomotypicGroup);
1004

    
1005
}
(12-12/39)