當前位置: 首頁>>代碼示例>>Java>>正文


Java Occurrence.getCountry方法代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:gbif,項目名稱:metrics,代碼行數:17,代碼來源:TableReaderMapper.java

示例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();
    }

  };
}
 
開發者ID:gbif,項目名稱:metrics,代碼行數:14,代碼來源:Application.java

示例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();
}
 
開發者ID:gbif,項目名稱:metrics,代碼行數:16,代碼來源:OccurrenceWritable.java

示例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();
}
 
開發者ID:gbif,項目名稱:occurrence,代碼行數:9,代碼來源:LocationInterpreter.java

示例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();
}
 
開發者ID:gbif,項目名稱:occurrence,代碼行數:10,代碼來源:SolrOccurrenceWriter.java

示例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;
}
 
開發者ID:gbif,項目名稱:metrics,代碼行數:49,代碼來源:DensityCubeUtil.java


注:本文中的org.gbif.api.model.occurrence.Occurrence.getCountry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。