Project

General

Profile

Download (6.62 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 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

    
10
package eu.etaxonomy.cdm.strategy.parser;
11

    
12
import eu.etaxonomy.cdm.model.name.INonViralName;
13
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
14
import eu.etaxonomy.cdm.model.name.Rank;
15
import eu.etaxonomy.cdm.strategy.IStrategy;
16
import eu.etaxonomy.cdm.strategy.exceptions.StringNotParsableException;
17

    
18

    
19
/**
20
 * Supplies several parser methods for non viral taxon name strings and for nomenclatural
21
 * reference strings. If the parser method for taxon names is not successful
22
 * the {@link eu.etaxonomy.cdm.model.name.TaxonName#getHasProblem() hasProblem} flag
23
 * of the {@link eu.etaxonomy.cdm.model.name.TaxonName taxon name} instance will be set.
24
 * Some of the parser methods for taxon names create also a TaxonName
25
 * instance while other ones only fill the result into an existing
26
 * TaxonName instance.
27
 *
28
 * @author a.mueller
29
 *
30
 */
31
public interface INonViralNameParser<T extends INonViralName> extends IStrategy {
32

    
33
	/**
34
	 * Parses the taxon name String and returns a TaxonName.
35
	 * If the String is not parseable the "hasProblem" bit is set to true.
36
 	 * Returns null if fullName == null.
37
	 *
38
	 * @param simpleName the scientific name string without authorship, year, reference etc.
39
	 * @param rank
40
	 * @return TaxonName, with rank = Rank.GENUS for all Uninomials
41
	 */
42
	public T parseSimpleName(String simpleName, NomenclaturalCode code, Rank rank);
43

    
44
	/**
45
	 * Parses the taxon name String and returns a TaxonName.
46
	 * If the String is not parseable the "hasProblem" bit is set to true.
47
 	 * Returns null if fullName == null.
48
	 *
49
	 * @param simpleName the scientific name string without authorship, year, reference etc.
50
	 * @return TaxonName name, with name.rank = rank for all Uninomials and name.rank = Rank.GENUS for rank = null
51
	 */
52
	public T parseSimpleName(String simpleName);
53

    
54

    
55

    
56
	/**
57
	 * Parses the taxon name String and returns a TaxonName.
58
	 * If the String is not parseable the "hasProblem" bit is set to true.
59
 	 * Returns null if fullName == null.
60
	 *
61
	 * @param fullName the string containing the scientific name with authorship but without year, reference etc.
62
	 * @return TaxonName, with rank = Rank.GENUS for all Uninomials.
63
	 */
64
	public T parseFullName(String fullName);
65

    
66
	/**
67
	 * Parses the taxon name String and returns a TaxonName.
68
	 * If the String is not parseable the "hasProblem" bit is set to true.
69
 	 * Returns null if fullName == null.
70
 	 *
71
	 * @param fullName the string containing the scientific name with authorship but without year, reference etc.
72
	 * @param rank
73
	 * @return TaxonName name, with name.rank = rank for all Uninomials and name.rank = Rank.GENUS for rank = null
74
	 */
75
	public T parseFullName(String fullName, NomenclaturalCode nomCode, Rank rank);
76

    
77
	/**
78
 	 * Parses the taxon name String and fills the result into the existing TaxonName nameToBeFilled.
79
	 * Name related fields are set to default (null for Strings and other objects like Authors and References and false for booleans).
80
	 * NameRelations are not changed.
81
	 * If the String is not parseable the "hasProblem" bit is set to true.
82
 	 * No change is done to nameToBeFilled if fullName == null.
83
 	 *
84
	 * @param fullName the string containing the scientific name with authorship but without year, reference etc.
85
	 * @param rank
86
	 * @param nameToBeFilled The TaxonName to be filled
87
	 */
88
	public void parseFullName(T nameToBeFilled, String fullName, Rank rank, boolean makeEmpty);
89

    
90
	/**
91
	 * @param fullReference the string containing the scientific name with authorship, year, reference etc.
92
	 * @return
93
	 */
94
	public T parseReferencedName(String fullReference);
95

    
96
	/**
97
	 * @see INonViralNameParser.parseFullReference(T nameToBeFilled, String fullReference, Rank rank, boolean makeEmpty)
98
	 * @param fullReference
99
	 * @param nomCode
100
	 * @param rank
101
	 * @return
102
	 */
103
	public T parseReferencedName(String fullReference, NomenclaturalCode nomCode, Rank rank);
104

    
105
	/**
106
	 * Parses a String (fullReference) assuming that it represents a taxonomic name, it's reference,
107
	 * and it's nomenclatural status.<BR>
108
	 * <ol>
109
	 * 		<li><strong>Status:</strong> First the last part of the string is checked if it represents a nomenclatural status (e.g. nom. inval.).
110
	 * If so, this part of the string is separated and the according status is added to the name.</li>
111
	 * 		<li><strong>Name:</strong> The starting part of the remaining string is checked if it represent a name according to the rules
112
	 * of the underlying nomenclatural code.</li>
113
	 * 		<li>
114
	 * 			<ol>
115
	 * 				<li>Non-atomized Name: If the name can not be parsed the title cache as well as the full
116
	 * title cache of the name is filled and the hasProblem flag is set to <code>true</code>. The same applies
117
	 * if the name can be parsed but is followed by a not empty String that does not start with a
118
	 * reference separator ("," of " in ").</li>
119
	 * 				<li>Atomized name: Otherwise the name part is separated and parsed. The according name attributes are set and
120
	 * the name's protectedTitleCache flag is set to <code>false</code>.</li>
121
	 * 			</ol>
122
	 *		</li>
123
	 * 		<li><strong>Reference:</strong> From the remaining string the reference separator is separated.
124
	 * The remaining string is parsed for beeing a valid (according to the parsers rules) reference String.
125
	 * 			<ol>
126
	 * 				<li>If the reference part could not be parsed, the references title cache is set by the remaining string and the
127
	 * references protected title cache is set to <code>true</code>.</li>
128
	 * 				<li>If the reference could be parsed the reference is separated and parsed. The according reference attributes are
129
	 * set and the reference's protectedTitleCache flag as well as the hasProblem flag is set to <code>false</code>.
130
	 * Then, and only then, the name's hasProblem flag is set to <code>false</code>.</li>
131
	 * 			</ol>
132
	 * 		</li>
133
	 * </ol>
134
	 *
135
	 * @param nameToBeFilled
136
	 * 				an existing name object
137
	 * @param fullReference
138
	 * 				the string containing the scientific name with authorship, year, reference etc.
139
	 * @param rank
140
	 * @param makeEmpty
141
	 * 				if this parameter is set to true, the name objects will nulled. All information
142
	 * 				formerly attached to this name will be lost.
143
	 */
144
	public void parseReferencedName(T nameToBeFilled, String fullReference, Rank rank, boolean makeEmpty);
145

    
146
	public void parseAuthors(INonViralName nonViralName, String authorString) throws StringNotParsableException;
147

    
148
}
(1-1/7)