本文整理汇总了Java中org.gbif.api.model.checklistbank.ParsedName.setYear方法的典型用法代码示例。如果您正苦于以下问题:Java ParsedName.setYear方法的具体用法?Java ParsedName.setYear怎么用?Java ParsedName.setYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gbif.api.model.checklistbank.ParsedName
的用法示例。
在下文中一共展示了ParsedName.setYear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUnparsedAuthors
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testUnparsedAuthors() throws Exception {
ParsedName p3 = new ParsedName();
p3.setParsed(false);
p3.setScientificName("Blattaria Voet, ?, 1806");
p3.setGenusOrAbove("Blattaria");
ParsedName p4 = new ParsedName();
p4.setScientificName("Blattaria Weyenbergh, 1874");
p4.setAuthorship("Weyenbergh");
p4.setYear("1874");
assertEquals(Equality.DIFFERENT, comp.compare(p3, p4));
p4.setYear("1806");
assertEquals(Equality.EQUAL, comp.compare(p3, p4));
}
示例2: parseAuthorship
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
/**
* Extract authorship from the name itself as best as we can to at least do some common string comparison
*/
private void parseAuthorship(ParsedName pn) {
// try to use full sciname minus the epithets
String lastEpithet = ObjectUtils.coalesce(pn.getInfraSpecificEpithet(), pn.getSpecificEpithet(), pn.getGenusOrAbove());
if (lastEpithet != null && pn.getScientificName() != null) {
int idx = pn.getScientificName().lastIndexOf(lastEpithet);
if (idx >= 0) {
pn.setAuthorship(pn.getScientificName().substring(idx + lastEpithet.length()));
}
}
// copy full name to year, will be extracted/normalized in year comparison
pn.setYear(pn.getScientificName());
pn.setParsedPartially(false);
}
示例3: testBlattariaAuthors
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testBlattariaAuthors() throws Exception {
ParsedName p1 = new ParsedName();
p1.setAuthorship("P. Miller");
p1.setYear("1754");
ParsedName p2 = new ParsedName();
p2.setAuthorship("O. Kuntze");
p2.setYear("1891");
ParsedName p3 = new ParsedName();
p3.setAuthorship("Voet, ?");
p3.setYear("1806");
ParsedName p4 = new ParsedName();
p4.setAuthorship("Weyenbergh");
p4.setYear("1874");
List<ParsedName> names = Lists.newArrayList(p1, p2, p3, p4);
for (ParsedName p : names) {
if (!p1.equals(p)) {
assertEquals(Equality.DIFFERENT, comp.compare(p1, p));
}
if (!p2.equals(p)) {
assertEquals(Equality.DIFFERENT, comp.compare(p2, p));
}
if (!p3.equals(p)) {
assertEquals(Equality.DIFFERENT, comp.compare(p3, p));
}
if (!p4.equals(p)) {
assertEquals(Equality.DIFFERENT, comp.compare(p4, p));
}
}
}
示例4: assertAuth
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
private void assertAuth(String a1, String y1, String a1b, String y1b, Equality eq, String a2, String y2, String a2b, String y2b) {
ParsedName p1 = new ParsedName();
p1.setAuthorship(a1);
p1.setYear(y1);
p1.setBracketAuthorship(a1b);
p1.setBracketYear(y1b);
ParsedName p2 = new ParsedName();
p2.setAuthorship(a2);
p2.setYear(y2);
p2.setBracketAuthorship(a2b);
p2.setBracketYear(y2b);
assertEquals(eq, comp.compare(p1, p2));
}
示例5: roundtrip
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void roundtrip() throws Exception {
ParsedName pn = new ParsedName();
pn.setType(NameType.SCIENTIFIC);
pn.setParsedPartially(true);
pn.setGenusOrAbove("Abies");
pn.setSpecificEpithet("alba");
pn.setInfraSpecificEpithet("alpina");
pn.setRank(Rank.INFRASUBSPECIFIC_NAME);
pn.setBracketYear("123");
pn.setYear("1987");
pn.setAuthorship("Markus");
pn.setBracketAuthorship("Peter");
pn.setNotho(NamePart.SPECIFIC);
pn.setRemarks("no remarks");
pn.setNomStatus("nom.illeg.");
pn.setInfraGeneric("Pineta");
pn.setCultivarEpithet("Green Hell");
pn.setSensu("Berendsohn 1999");
pn.setStrain("train");
pn.setScientificName(pn.fullName());
mapper.create(pn);
ParsedName pn2 = mapper.getByName(pn.getScientificName(), pn.getRank());
assertEquals(pn, pn2);
}
示例6: scientificName
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void scientificName() throws Exception {
final String UNPARSED_NAME = "A real unparsed name X73a";
ParsedName n = new ParsedName();
n.setType(NameType.SCIENTIFIC);
n.setScientificName(UNPARSED_NAME);
n.setGenusOrAbove("Abies");
n.setAuthorship("L.");
n.setYear("1888");
n.setBracketAuthorship("Carl.");
n.setRank(Rank.GENUS);
assertAllButVirus("Abies (Carl.) L., 1888", n);
n.setRank(Rank.SPECIES);
assertAllButVirus("Abies spec.", n);
n.setSpecificEpithet("alba");
assertAllButVirus("Abies alba (Carl.) L., 1888", n);
n.setRank(Rank.SUBSPECIES);
assertAllButVirus("Abies alba subsp.", n);
n.setInfraSpecificEpithet("alpina");
final String expectedWithRank = "Abies alba subsp. alpina (Carl.) L., 1888";
assertAllAndZoo("Abies alba alpina (Carl.) L., 1888", expectedWithRank, n);
assertEquals("Abies alba alpina (Carl.) L., 1888", NameFormatter.scientificName(n, Kingdom.ANIMALIA));
assertEquals(expectedWithRank, NameFormatter.scientificName(n, Kingdom.PLANTAE));
n.setType(NameType.HYBRID);
assertEquals(expectedWithRank, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));
n.setType(NameType.VIRUS);
assertEquals(expectedWithRank, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));
n.setParsed(false);
assertEquals(UNPARSED_NAME, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));
n.setParsed(true);
n.setRank(Rank.INFRASPECIFIC_NAME);
assertAllButVirus("Abies alba alpina (Carl.) L., 1888", n);
assertEquals(UNPARSED_NAME, NameFormatter.scientificName(n, Kingdom.VIRUSES));
}