本文整理汇总了Java中org.gbif.api.model.occurrence.Occurrence.getCountry方法的典型用法代码示例。如果您正苦于以下问题:Java Occurrence.getCountry方法的具体用法?Java Occurrence.getCountry怎么用?Java Occurrence.getCountry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gbif.api.model.occurrence.Occurrence
的用法示例。
在下文中一共展示了Occurrence.getCountry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
@Override
protected void map(ImmutableBytesWritable key, Result row, Context context) throws IOException, InterruptedException {
try {
Occurrence o = OccurrenceBuilder.buildOccurrence(row);
Preconditions.checkNotNull(o, "Unable to generate an Occurrence from the HBase using the OccurrenceBuilder");
if (o.getDatasetKey() != null && o.getCountry() != null) {
Key k = new Key(o.getDatasetKey(), o.getCountry());
context.setStatus(k.toString());
context.write(k, ONE);
} else {
context.getCounter("GBIF", "Missing dataset key or country (skipped record)").increment(1);
}
} catch (Exception e) {
throw new IOException(e);
}
}
示例2: countryGetter
import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
/**
* Function that return the country value from an occurrence object.
*/
private Function<Occurrence, Country> countryGetter() {
return new Function<Occurrence, Country>() {
@Override
public Country apply(Occurrence occurrence) {
return occurrence.getCountry();
}
};
}
示例3: OccurrenceWritable
import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
public OccurrenceWritable(Occurrence occ, Integer cnt) {
taxonKey = occ.getTaxonKey();
ClassificationUtils.copyLinneanClassificationKeys(occ, this);
year = occ.getYear();
count = cnt;
pubOrgKey = occ.getPublishingOrgKey();
datasetKey = occ.getDatasetKey();
latitude = occ.getDecimalLatitude();
longitude = occ.getDecimalLongitude();
country = occ.getCountry();
publishingCountry = occ.getPublishingCountry();
basisOfRecord = occ.getBasisOfRecord();
protocol = occ.getProtocol();
issues = occ.getIssues();
}
示例4: interpretCountry
import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
private Country interpretCountry(VerbatimOccurrence verbatim, Occurrence occ) {
OccurrenceParseResult<Country>
inter = interpretCountry(verbatim.getVerbatimField(DwcTerm.countryCode),
verbatim.getVerbatimField(DwcTerm.country));
occ.setCountry(inter.getPayload());
occ.getIssues().addAll(inter.getIssues());
return occ.getCountry();
}
示例5: isRepatriated
import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
/**
* Determines if the occurrence record has been repatriated.
*/
private static Optional<Boolean> isRepatriated(Occurrence occurrence) {
if (occurrence.getPublishingCountry() != null && occurrence.getCountry() != null) {
return Optional.of(!occurrence.getPublishingCountry().equals(occurrence.getCountry()));
}
return Optional.absent();
}
示例6: cubeMutations
import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
/**
* For the given occurrence, determines the mutations (addresses and operations) that need
* to be applied.
*
* @param o The denormalized representation
* @param op That is going to be applied to the cube
* @return The batch of updates to apply
*/
public static Batch<DensityTile> cubeMutations(Occurrence o, Op op, int zoom, int pixelsPerCluster) {
Double latitude = o.getDecimalLatitude();
Double longitude = o.getDecimalLongitude();
Batch<DensityTile> batch = new Batch<DensityTile>();
if (!o.hasSpatialIssue() && MercatorProjectionUtil.isPlottable(latitude, longitude)) {
Set<Integer> taxa =
Sets.newHashSet(o.getKingdomKey(), o.getPhylumKey(), o.getClassKey(), o.getOrderKey(), o.getFamilyKey(),
o.getGenusKey(), o.getSpeciesKey(), o.getTaxonKey());
// locate the tile
int tileX = MercatorProjectionUtil.toTileX(o.getDecimalLongitude(), zoom);
int tileY = MercatorProjectionUtil.toTileY(o.getDecimalLatitude(), zoom);
for (Integer id : taxa) {
if (id != null) {
addMutations(batch, TileContentType.TAXON, String.valueOf(id), tileX, tileY, zoom, pixelsPerCluster, op, o);
}
}
if (o.getPublishingOrgKey() != null) {
addMutations(batch, TileContentType.PUBLISHER, String.valueOf(o.getPublishingOrgKey()), tileX, tileY, zoom,
pixelsPerCluster, op, o);
}
if (o.getDatasetKey() != null) {
addMutations(batch, TileContentType.DATASET, String.valueOf(o.getDatasetKey()), tileX, tileY, zoom,
pixelsPerCluster, op, o);
}
if (o.getCountry() != null) {
addMutations(batch, TileContentType.COUNTRY, o.getCountry().getIso2LetterCode(), tileX, tileY, zoom,
pixelsPerCluster, op, o);
}
if (o.getPublishingCountry() != null) {
addMutations(batch, TileContentType.PUBLISHING_COUNTRY, o.getPublishingCountry().getIso2LetterCode(), tileX,
tileY, zoom,
pixelsPerCluster, op, o);
}
}
return batch;
}