Revision 04511378
Added by Andreas Müller over 13 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplRegExBase.java | ||
---|---|---|
22 | 22 |
public abstract class NonViralNameParserImplRegExBase { |
23 | 23 |
@SuppressWarnings("unused") |
24 | 24 |
private static final Logger logger = Logger.getLogger(NonViralNameParserImplRegExBase.class); |
25 |
|
|
25 |
|
|
26 | 26 |
// good intro: http://java.sun.com/docs/books/tutorial/essential/regex/index.html |
27 | 27 |
|
28 | 28 |
//splitter |
29 | 29 |
protected static String epiSplitter = "(\\s+|\\(|\\))"; //( ' '+| '(' | ')' ) |
30 | 30 |
protected static Pattern pattern = Pattern.compile(epiSplitter); |
31 |
|
|
31 |
|
|
32 |
public static final String hybridSign = "\u00D7"; |
|
33 |
|
|
32 | 34 |
//some useful non-terminals |
33 | 35 |
protected static String pStart = "^"; |
34 | 36 |
protected static String end = "$"; |
... | ... | |
231 | 233 |
//cultivars and hybrids |
232 | 234 |
protected static String cultivar = oWs + "'..+'"; //Achtung mit Hochkomma in AuthorNamen |
233 | 235 |
protected static String cultivarMarker = oWs + "(cv.|')"; |
234 |
protected static String hybrid = oWs + "((x|X)" + oWs + "|notho)";//= ( x )|( X )|( notho) |
|
236 |
protected static String hybridPart = "((x|X)" + oWs + "|"+hybridSign+"|notho)"; |
|
237 |
protected static String hybridFull = "(" +oWs +"|"+ pStart +")" + hybridPart; |
|
238 |
|
|
235 | 239 |
|
236 | 240 |
// Name String |
237 |
protected static String genusOrSupraGenus = capitalEpiWord; |
|
241 |
protected static String genusOrSupraGenus = "("+hybridFull+")?" + capitalEpiWord;
|
|
238 | 242 |
protected static String infraGenus = capitalEpiWord + oWs + InfraGenusMarker + oWs + capitalEpiWord; |
239 | 243 |
protected static String aggrOrGroup = capitalEpiWord + oWs + nonCapitalEpiWord + oWs + aggrOrGroupMarker; |
240 |
protected static String species = capitalEpiWord + oWs + nonCapitalEpiWord;
|
|
241 |
protected static String infraSpecies = capitalEpiWord + oWs + nonCapitalEpiWord + oWs + infraSpeciesMarker + oWs + nonCapitalEpiWord;
|
|
244 |
protected static String species = genusOrSupraGenus + oWs + "("+hybridPart+")?" + nonCapitalEpiWord;
|
|
245 |
protected static String infraSpecies = species + oWs + infraSpeciesMarker + oWs + "("+hybridPart+")?" + nonCapitalEpiWord;
|
|
242 | 246 |
protected static String oldInfraSpecies = capitalEpiWord + oWs + nonCapitalEpiWord + oWs + oldInfraSpeciesMarker + oWs + nonCapitalEpiWord; |
243 | 247 |
protected static String autonym = capitalEpiWord + oWs + "(" + nonCapitalEpiWord +")" + oWs + fullBotanicAuthorString + oWs + infraSpeciesMarker + oWs + "\\1"; //2-nd word and last word are the same |
244 | 248 |
//autonym pattern used within anyBotanicalFullName pattern |
... | ... | |
257 | 261 |
protected static Pattern teamSplitterPattern = Pattern.compile(teamSplitter); |
258 | 262 |
protected static Pattern cultivarPattern = Pattern.compile(cultivar); |
259 | 263 |
protected static Pattern cultivarMarkerPattern = Pattern.compile(cultivarMarker); |
260 |
protected static Pattern hybridPattern = Pattern.compile(hybrid); |
|
264 |
protected static Pattern hybridPattern = Pattern.compile(hybridFull);
|
|
261 | 265 |
|
262 | 266 |
protected static Pattern genusOrSupraGenusPattern = Pattern.compile(pStart + genusOrSupraGenus + facultFullAuthorString2 + end); |
263 | 267 |
protected static Pattern infraGenusPattern = Pattern.compile(pStart + infraGenus + facultFullAuthorString2 + end); |
Also available in: Unified diff
hybrid parsing and caching for monom, binom and trinom flags implemented