当前位置: 首页>>代码示例>>Java>>正文


Java Occurrence.setElevation方法代码示例

本文整理汇总了Java中org.gbif.api.model.occurrence.Occurrence.setElevation方法的典型用法代码示例。如果您正苦于以下问题:Java Occurrence.setElevation方法的具体用法?Java Occurrence.setElevation怎么用?Java Occurrence.setElevation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.gbif.api.model.occurrence.Occurrence的用法示例。


在下文中一共展示了Occurrence.setElevation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
@Override
public Occurrence get(Integer key) {
  if (key == null || key < 1 || key >= 1000000) {
    return null;
  }

  Occurrence occ = new Occurrence();
  occ.setKey(key);
  occ.setDatasetKey(DATASETS.get(key % 10));

  int ord = key % BasisOfRecord.values().length;
  occ.setBasisOfRecord(BasisOfRecord.values()[ord]);
  occ.setYear(1800 + (key % 200));
  occ.setElevation(key % 2000d);
  Map<Term, String> fields = occ.getVerbatimFields();
  fields.put(DwcTerm.catalogNumber, "cat-" + key);
  occ.setVerbatimFields(fields);
  occ.setMonth(1 + (key % 12));

  ord = key % Kingdom.values().length;
  Kingdom k = Kingdom.values()[ord];
  occ.setKingdomKey(k.nubUsageID());
  occ.setKingdom(StringUtils.capitalize(k.name().toLowerCase()));

  return occ;
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:27,代码来源:OccurrencePersistenceMockService.java

示例2: interpretElevation

import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
public void interpretElevation(VerbatimOccurrence verbatim, Occurrence occ) {
  OccurrenceParseResult<DoubleAccuracy> result = MeterRangeParser
    .parseElevation(verbatim.getVerbatimField(DwcTerm.minimumElevationInMeters),
      verbatim.getVerbatimField(DwcTerm.maximumElevationInMeters), null);
  if (result.isSuccessful() && result.getPayload().getValue() != null) {
    occ.setElevation(result.getPayload().getValue());
    occ.setElevationAccuracy(result.getPayload().getAccuracy());
    occ.getIssues().addAll(result.getIssues());
  }

  //TODO: use continent information to get finer unlikely values:
  // http://en.wikipedia.org/wiki/Extremes_on_Earth#Extreme_elevations_and_temperatures_per_continent
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:14,代码来源:LocationInterpreter.java

示例3: testCubeMutation

import org.gbif.api.model.occurrence.Occurrence; //导入方法依赖的package包/类
@Test
public void testCubeMutation() throws Exception {
  final UUID datasetKey = UUID.randomUUID();
  Occurrence occ = new Occurrence();
  occ.setTypeStatus(TypeStatus.HOLOTYPE);
  occ.setDatasetKey(datasetKey);
  occ.setKey(1);
  occ.setElevation(110d);
  occ.setDepth(10d);
  occ.setBasisOfRecord(BasisOfRecord.PRESERVED_SPECIMEN);
  occ.setTaxonKey(1000);
  occ.setKingdomKey(6);
  occ.setPhylumKey(66);
  occ.setClassKey(666);
  occ.setOrderKey(6666);
  occ.setFamilyKey(66666);
  occ.setGenusKey(666666);
  occ.setSubgenusKey(6666666);
  occ.setSpeciesKey(66666666);
  occ.setContinent(Continent.EUROPE);
  occ.setCountry(Country.ALBANIA);
  occ.setProtocol(EndpointType.DWC_ARCHIVE);
  occ.setPublishingCountry(Country.ITALY);
  occ.setYear(1992);
  occ.setMonth(1);
  occ.setDay(31);
  occ.getIssues().add(OccurrenceIssue.TYPE_STATUS_INVALID);
  occ.getIssues().add(OccurrenceIssue.ELEVATION_NON_NUMERIC);

  Batch<LongOp> updates = OccurrenceAddressUtil.cubeMutation(occ, new LongOp(1));

  // make sure we have a single dimension rollup for each dimension
  Set<Dimension<?>> addressed = Sets.newHashSet();
  int nubCounter = 0;
  for (Address a : updates.getMap().keySet()) {
    Dimension<?> singleDim = singleDimensionAddress(a);
    if (singleDim != null) {
      if (OccurrenceCube.TAXON_KEY.equals(singleDim)) {
        nubCounter++;
      } else if (addressed.contains(singleDim)) {
        System.out.println("Warning, single dimension " + singleDim + " used multiple times");
        System.out.println(a);
      }
      addressed.add(singleDim);
    }
  }

  System.out.println(OccurrenceCube.API_MAPPING.values());
  System.out.println(addressed);
  assertEquals("Not all higher taxa are mutated", 9, nubCounter);
  assertEquals("Not all cube dimensions are mutated", OccurrenceCube.API_MAPPING.size(), addressed.size());

}
 
开发者ID:gbif,项目名称:metrics,代码行数:54,代码来源:OccurrenceAddressUtilTest.java


注:本文中的org.gbif.api.model.occurrence.Occurrence.setElevation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。