Project

General

Profile

Download (22.2 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 eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
12
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
13
import eu.etaxonomy.cdm.model.reference.Reference;
14
import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser;
15
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
16

    
17
/**
18
 * @author a.mueller
19
 * @date 30.01.2017
20
 *
21
 */
22
public class TaxonNameFactory {
23

    
24
    static private INonViralNameParser<?> nameParser = new NonViralNameParserImpl();
25

    
26
 // *************** FACTORY METHODS ********************************/
27

    
28

    
29
//    /**
30
//     * @param code
31
//     * @return
32
//     */
33
//    public static Class<? extends IdentifiableEntity> NewNameInstance(NomenclaturalCode code) {
34
//        code.getNewTaxonNameInstance(rank)
35
//    }
36

    
37
    /**
38
     * Creates a new non viral taxon name instance
39
     * only containing its {@link common.Rank rank} and
40
      * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
41
     *
42
     * @param  rank  the rank to be assigned to <i>this</i> non viral taxon name
43
     * @see    #NewInstance(Rank, HomotypicalGroup)
44
     * @see    #NonViralName(Rank, HomotypicalGroup)
45
     * @see    #NonViralName()
46
     * @see    #NonViralName(Rank, String, String, String, String, TeamOrPersonBase, Reference, String, HomotypicalGroup)
47
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
48
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
49
     * @see    eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
50
     */
51
    public static TaxonName NewNonViralInstance(Rank rank){
52
        return TaxonName.NewInstance(NomenclaturalCode.NonViral, rank, null);
53
    }
54

    
55
    /**
56
     * Creates a new non viral taxon name instance
57
     * only containing its {@link common.Rank rank},
58
     * its {@link HomotypicalGroup homotypical group} and
59
      * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
60
     * The new non viral taxon name instance will be also added to the set of
61
     * non viral taxon names belonging to this homotypical group.
62
     *
63
     * @param  rank  the rank to be assigned to <i>this</i> non viral taxon name
64
     * @param  homotypicalGroup  the homotypical group to which <i>this</i> non viral taxon name belongs
65
     * @see    #NewInstance(Rank)
66
     * @see    #NonViralName(Rank, HomotypicalGroup)
67
     * @see    #NonViralName()
68
     * @see    #NonViralName(Rank, String, String, String, String, TeamOrPersonBase, Reference, String, HomotypicalGroup)
69
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
70
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
71
     * @see    eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
72
     */
73
    public static TaxonName NewNonViralInstance(Rank rank, HomotypicalGroup homotypicalGroup){
74
        return TaxonName.NewInstance(NomenclaturalCode.NonViral, rank, homotypicalGroup);
75
    }
76

    
77

    
78
    /**
79
     * Creates a new viral taxon name instance only containing its {@link Rank rank}.
80
     *
81
     * @param   rank  the rank to be assigned to <i>this</i> viral taxon name
82
     * @see     #ViralName(Rank)
83
     */
84
    public static TaxonName NewViralInstance(Rank rank){
85
        return TaxonName.NewInstance(NomenclaturalCode.ICVCN, rank, null);
86
    }
87

    
88
    /**
89
     * Creates a new bacterial taxon name instance
90
     * only containing its {@link Rank rank} and
91
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
92
     *
93
     * @param  rank  the rank to be assigned to <i>this</i> bacterial taxon name
94
     * @see    #NewInstance(Rank, HomotypicalGroup)
95
     * @see    #BacterialName(Rank, HomotypicalGroup)
96
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
97
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
98
     * @see    eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
99
     */
100
    public static TaxonName NewBacterialInstance(Rank rank){
101
        return TaxonName.NewInstance(NomenclaturalCode.ICNB, rank, null);
102
    }
103

    
104
    /**
105
     * Creates a new bacterial taxon name instance
106
     * only containing its {@link Rank rank},
107
     * its {@link HomotypicalGroup homotypical group} and
108
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}.
109
     * The new bacterial taxon name instance will be also added to the set of
110
     * bacterial taxon names belonging to this homotypical group.
111
     *
112
     * @param  rank  the rank to be assigned to <i>this</i> bacterial taxon name
113
     * @param  homotypicalGroup  the homotypical group to which <i>this</i> bacterial taxon name belongs
114
     * @see    #NewInstance(Rank)
115
     * @see    #BacterialName(Rank, HomotypicalGroup)
116
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy
117
     * @see    eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
118
     * @see    eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
119
     */
120
    public static IBacterialName NewBacterialInstance(Rank rank, HomotypicalGroup homotypicalGroup){
121
        return TaxonName.NewInstance(NomenclaturalCode.ICNB, rank, homotypicalGroup);
122
    }
123

    
124

    
125
    /**
126
     * Creates a new zoological taxon name instance
127
     * only containing its {@link Rank rank} and
128
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.ZooNameDefaultCacheStrategy default cache strategy}.
129
     *
130
     * @param   rank    the rank to be assigned to <i>this</i> zoological taxon name
131
     * @see             #ZoologicalName(Rank, HomotypicalGroup)
132
     * @see             #NewInstance(Rank, HomotypicalGroup)
133
     * @see             #NewZoologicalInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
134
     * @see             eu.etaxonomy.cdm.strategy.cache.name.ZooNameDefaultCacheStrategy
135
     */
136
    public static TaxonName NewZoologicalInstance(Rank rank){
137
        return TaxonName.NewInstance(NomenclaturalCode.ICZN, rank, null);
138
    }
139

    
140
    /**
141
     * Creates a new zoological taxon name instance
142
     * only containing its {@link Rank rank},
143
     * its {@link HomotypicalGroup homotypical group} and
144
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.ZooNameDefaultCacheStrategy default cache strategy}.
145
     * The new zoological taxon name instance will be also added to the set of
146
     * zoological taxon names belonging to the given homotypical group.
147
     *
148
     * @param  rank  the rank to be assigned to <i>this</i> zoological taxon name
149
     * @param  homotypicalGroup  the homotypical group to which <i>this</i> zoological taxon name belongs
150
     * @see    #NewInstance(Rank)
151
     * @see    #NewZoologicalInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
152
     * @see    #ZoologicalName(Rank, HomotypicalGroup)
153
     * @see    eu.etaxonomy.cdm.strategy.cache.name.ZooNameDefaultCacheStrategy
154
     */
155
    public static TaxonName NewZoologicalInstance(Rank rank, HomotypicalGroup homotypicalGroup){
156
        return TaxonName.NewInstance(NomenclaturalCode.ICZN, rank, homotypicalGroup);
157
    }
158
    /**
159
     * Creates a new zoological taxon name instance
160
     * containing its {@link Rank rank},
161
     * its {@link HomotypicalGroup homotypical group},
162
     * its scientific name components, its {@link eu.etaxonomy.cdm.agent.TeamOrPersonBase author(team)},
163
     * its {@link eu.etaxonomy.cdm.reference.INomenclaturalReference nomenclatural reference} and
164
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.ZooNameDefaultCacheStrategy default cache strategy}.
165
     * The new zoological taxon name instance will be also added to the set of
166
     * zoological taxon names belonging to the given homotypical group.
167
     *
168
     * @param   rank  the rank to be assigned to <i>this</i> zoological taxon name
169
     * @param   genusOrUninomial the string for <i>this</i> zoological taxon name
170
     *          if its rank is genus or higher or for the genus part
171
     *          if its rank is lower than genus
172
     * @param   infraGenericEpithet  the string for the first epithet of
173
     *          <i>this</i> zoological taxon name if its rank is lower than genus
174
     *          and higher than species aggregate
175
     * @param   specificEpithet  the string for the first epithet of
176
     *          <i>this</i> zoological taxon name if its rank is species aggregate or lower
177
     * @param   infraSpecificEpithet  the string for the second epithet of
178
     *          <i>this</i> zoological taxon name if its rank is lower than species
179
     * @param   combinationAuthorship  the author or the team who published <i>this</i> zoological taxon name
180
     * @param   nomenclaturalReference  the nomenclatural reference where <i>this</i> zoological taxon name was published
181
     * @param   nomenclMicroRef  the string with the details for precise location within the nomenclatural reference
182
     * @param   homotypicalGroup  the homotypical group to which <i>this</i> zoological taxon name belongs
183
     * @see     #NewInstance(Rank)
184
     * @see     #NewInstance(Rank, HomotypicalGroup)
185
     * @see     #ZoologicalName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
186
     * @see     eu.etaxonomy.cdm.strategy.cache.name.ZooNameDefaultCacheStrategy
187
     */
188
    public static TaxonName NewZoologicalInstance(Rank rank,
189
            String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet,
190
            TeamOrPersonBase combinationAuthorship, Reference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) {
191
        return TaxonName.NewInstance(NomenclaturalCode.ICZN, rank,
192
            genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet,
193
            combinationAuthorship, nomenclaturalReference, nomenclMicroRef,
194
            homotypicalGroup);
195
    }
196

    
197
    /**
198
     * Creates a new botanical taxon name instance
199
     * only containing its {@link Rank rank} and
200
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
201
     *
202
     * @param   rank    the rank to be assigned to <i>this</i> botanical taxon name
203
     * @see             #BotanicalName(Rank, HomotypicalGroup)
204
     * @see             #NewInstance(Rank, HomotypicalGroup)
205
     * @see             #NewBotanicalInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
206
     * @see             eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
207
     */
208
    public static TaxonName NewBotanicalInstance(Rank rank){
209
        return TaxonName.NewInstance(NomenclaturalCode.ICNAFP, rank, null);
210
    }
211
    /**
212
     * Creates a new botanical taxon name instance
213
     * only containing its {@link Rank rank},
214
     * its {@link HomotypicalGroup homotypical group} and
215
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
216
     * The new botanical taxon name instance will be also added to the set of
217
     * botanical taxon names belonging to this homotypical group.
218
     *
219
     * @param  rank  the rank to be assigned to <i>this</i> botanical taxon name
220
     * @param  homotypicalGroup  the homotypical group to which <i>this</i> botanical taxon name belongs
221
     * @see    #NewInstance(Rank)
222
     * @see    #NewBotanicalInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
223
     * @see    #BotanicalName(Rank, HomotypicalGroup)
224
     * @see    eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
225
     */
226
    public static IBotanicalName NewBotanicalInstance(Rank rank, HomotypicalGroup homotypicalGroup){
227
        return TaxonName.NewInstance(NomenclaturalCode.ICNAFP, rank, homotypicalGroup);
228
    }
229
    /**
230
     * Creates a new botanical taxon name instance
231
     * containing its {@link Rank rank},
232
     * its {@link HomotypicalGroup homotypical group},
233
     * its scientific name components, its {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase author(team)},
234
     * its {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference} and
235
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
236
     * The new botanical taxon name instance will be also added to the set of
237
     * botanical taxon names belonging to this homotypical group.
238
     *
239
     * @param   rank  the rank to be assigned to <i>this</i> botanical taxon name
240
     * @param   genusOrUninomial the string for <i>this</i> botanical taxon name
241
     *          if its rank is genus or higher or for the genus part
242
     *          if its rank is lower than genus
243
     * @param   infraGenericEpithet  the string for the first epithet of
244
     *          <i>this</i> botanical taxon name if its rank is lower than genus
245
     *          and higher than species aggregate
246
     * @param   specificEpithet  the string for the first epithet of
247
     *          <i>this</i> botanical taxon name if its rank is species aggregate or lower
248
     * @param   infraSpecificEpithet  the string for the second epithet of
249
     *          <i>this</i> botanical taxon name if its rank is lower than species
250
     * @param   combinationAuthorship  the author or the team who published <i>this</i> botanical taxon name
251
     * @param   nomenclaturalReference  the nomenclatural reference where <i>this</i> botanical taxon name was published
252
     * @param   nomenclMicroRef  the string with the details for precise location within the nomenclatural reference
253
     * @param   homotypicalGroup  the homotypical group to which <i>this</i> botanical taxon name belongs
254
     * @see     #NewInstance(Rank)
255
     * @see     #NewInstance(Rank, HomotypicalGroup)
256
     * @see     ZoologicalName#ZoologicalName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup)
257
     * @see     eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
258
     */
259
    public static  TaxonName NewBotanicalInstance(Rank rank,
260
            String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet,
261
            TeamOrPersonBase combinationAuthorship, Reference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) {
262
        return TaxonName.NewInstance(NomenclaturalCode.ICNAFP, rank, genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet,
263
            combinationAuthorship, nomenclaturalReference, nomenclMicroRef, homotypicalGroup);
264
    }
265

    
266

    
267
    /**
268
     * Creates a new cultivar taxon name instance
269
     * only containing its {@link Rank rank} and
270
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
271
     *
272
     * @param   rank    the rank to be assigned to <i>this</i> cultivar taxon name
273
     * @see             #CultivarPlantName(Rank, HomotypicalGroup)
274
     * @see             #NewInstance(Rank, HomotypicalGroup)
275
     * @see             eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
276
     */
277
    public static TaxonName NewCultivarInstance(Rank rank){
278
        return TaxonName.NewInstance(NomenclaturalCode.ICNCP, rank, null);
279
    }
280

    
281
    /**
282
     * Creates a new cultivar taxon name instance
283
     * only containing its {@link Rank rank},
284
     * its {@link HomotypicalGroup homotypical group} and
285
     * the {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy default cache strategy}.
286
     * The new cultivar taxon name instance will be also added to the set of
287
     * cultivar taxon names belonging to this homotypical group.
288
     *
289
     * @param  rank  the rank to be assigned to <i>this</i> cultivar taxon name
290
     * @param  homotypicalGroup  the homotypical group to which <i>this</i> cultivar taxon name belongs
291
     * @see    #NewInstance(Rank)
292
     * @see    #CultivarPlantName(Rank, HomotypicalGroup)
293
     * @see    eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy
294
     */
295
    public static ICultivarPlantName NewCultivarInstance(Rank rank, HomotypicalGroup homotypicalGroup){
296
        return TaxonName.NewInstance(NomenclaturalCode.ICNCP, rank, homotypicalGroup);
297
    }
298

    
299

    
300

    
301

    
302
    /**
303
     * Returns a botanical taxon name based on parsing a string representing
304
     * all elements (according to the ICBN) of a botanical taxon name (where
305
     * the scientific name is an uninomial) including authorship but without
306
     * nomenclatural reference. If the {@link Rank rank} is not "Genus" it should be
307
     * set afterwards with the {@link TaxonName#setRank(Rank) setRank} methode.
308
     *
309
     * @param   fullNameString  the string to be parsed
310
     * @return                  the new botanical taxon name
311
     */
312
    public static TaxonName PARSED_BOTANICAL(String fullNameString){
313
        return PARSED_BOTANICAL(fullNameString, Rank.GENUS());
314
    }
315

    
316

    
317
    /**
318
     * Returns a botanical taxon name based on parsing a string representing
319
     * all elements (according to the ICBN) of a botanical taxon name including
320
     * authorship but without nomenclatural reference. The parsing result
321
     * depends on the given rank of the botanical taxon name to be created.
322
     *
323
     * @param   fullNameString  the string to be parsed
324
     * @param   rank            the rank of the taxon name
325
     * @return                  the new botanical taxon name
326
     */
327
    public static TaxonName PARSED_BOTANICAL(String fullNameString, Rank rank){
328
        if (nameParser == null){
329
            nameParser = new NonViralNameParserImpl();
330
        }
331
        return (TaxonName)nameParser.parseFullName(fullNameString, NomenclaturalCode.ICNAFP,  rank);
332
    }
333

    
334

    
335
    /**
336
     * Returns a botanical taxon name based on parsing a string representing
337
     * all elements (according to the ICBN) of a botanical taxon name (where
338
     * the scientific name is an uninomial) including authorship and
339
     * nomenclatural reference. Eventually a new {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference}
340
     * instance will also be created. If the {@link Rank rank} is not "Genus" it should be
341
     * set afterwards with the {@link TaxonName#setRank(Rank) setRank} methode.
342
     *
343
     * @param   fullNameAndReferenceString  the string to be parsed
344
     * @return                              the new botanical taxon name
345
     */
346
    public static IBotanicalName PARSED_BOTANICAL_REFERENCE(String fullNameAndReferenceString){
347
        return PARSED_BOTANICAL_REFERENCE(fullNameAndReferenceString, Rank.GENUS());
348
    }
349

    
350
    /**
351
     * Returns a botanical taxon name based on parsing a string representing
352
     * all elements (according to the ICBN) of a botanical taxon name including
353
     * authorship and nomenclatural reference. The parsing result depends on
354
     * the given rank of the botanical taxon name to be created.
355
     * Eventually a new {@link eu.etaxonomy.cdm.model.reference.INomenclaturalReference nomenclatural reference}
356
     * instance will also be created.
357
     *
358
     * @param   fullNameAndReferenceString  the string to be parsed
359
     * @param   rank                        the rank of the taxon name
360
     * @return                              the new botanical taxon name
361
     */
362
    public static IBotanicalName PARSED_BOTANICAL_REFERENCE(String fullNameAndReferenceString, Rank rank){
363
        if (nameParser == null){
364
            nameParser = new NonViralNameParserImpl();
365
        }
366
        return (IBotanicalName)nameParser.parseReferencedName(fullNameAndReferenceString, NomenclaturalCode.ICNAFP, rank);
367
    }
368

    
369

    
370

    
371

    
372

    
373
    /**
374
     * Returns a zoological taxon name based on parsing a string representing
375
     * all elements (according to the {@link NomenclaturalCode#ICZN() ICZN}) of a zoological taxon name (where
376
     * the scientific name is an uninomial) including authorship but without
377
     * nomenclatural reference.
378
     *
379
     * @param   fullNameString  the string to be parsed
380
     * @return                  the new zoological taxon name
381
     */
382
    public static TaxonName PARSED_ZOOLOGICAL(String fullNameString){
383
        return PARSED_ZOOLOGICAL(fullNameString, Rank.GENUS());
384
    }
385

    
386
    /**
387
     * Returns a zoological taxon name based on parsing a string representing
388
     * all elements (according to the {@link NomenclaturalCode#ICZN() ICZN})) of a zoological taxon name including
389
     * authorship but without nomenclatural reference. The parsing result
390
     * depends on the given rank of the zoological taxon name to be created.
391
     *
392
     * @param   fullNameString  the string to be parsed
393
     * @param   rank            the rank of the taxon name
394
     * @return                  the new zoological taxon name
395
     */
396
    public static TaxonName PARSED_ZOOLOGICAL(String fullNameString, Rank rank){
397
        if (nameParser == null){
398
            nameParser  = new NonViralNameParserImpl();
399
        }
400
        return (TaxonName)nameParser.parseFullName(fullNameString, NomenclaturalCode.ICZN, rank);
401
    }
402

    
403

    
404
    /**
405
     * @param rank
406
     * @param genusOrUninomial
407
     * @param infraGenericEpithet
408
     * @param specificEpithet
409
     * @param infraSpecificEpithet
410
     * @param combinationAuthorship
411
     * @param nomenclaturalReference
412
     * @param nomenclMicroRef
413
     * @param homotypicalGroup
414
     * @return
415
     */
416
    public static INonViralName NewNonViralInstance(Rank rank, String genusOrUninomial, String infraGenericEpithet, String specificEpithet,
417
            String infraSpecificEpithet, TeamOrPersonBase combinationAuthorship, Reference nomenclaturalReference, String nomenclMicroRef,
418
            HomotypicalGroup homotypicalGroup) {
419
        return TaxonName.NewInstance(NomenclaturalCode.NonViral, rank, genusOrUninomial, infraGenericEpithet, specificEpithet,
420
                infraSpecificEpithet, combinationAuthorship, nomenclaturalReference, nomenclMicroRef,
421
                homotypicalGroup);
422
    }
423

    
424
    /**
425
     * @param rank
426
     * @return
427
     */
428
    public static TaxonName NewFungusInstance(Rank rank) {
429
        return TaxonName.NewInstance(NomenclaturalCode.Fungi, rank, null);
430
    }
431

    
432
}
(35-35/42)