@Test public void interpretRelativeOrganismQuantityTest() { Map<String, String> coreMap = new HashMap<>(); coreMap.put(DwcTerm.sampleSizeValue.qualifiedName(), "2"); coreMap.put(DwcTerm.sampleSizeUnit.qualifiedName(), "some type "); coreMap.put(DwcTerm.organismQuantity.qualifiedName(), "10"); coreMap.put(DwcTerm.organismQuantityType.qualifiedName(), " Some Type"); ExtendedRecord er = ExtendedRecord.newBuilder().setId(ID).setCoreTerms(coreMap).build(); BasicRecord br = BasicRecord.newBuilder().setId(ID).build(); BasicInterpreter.interpretOrganismQuantityType(er, br); BasicInterpreter.interpretOrganismQuantity(er, br); BasicInterpreter.interpretSampleSizeUnit(er, br); BasicInterpreter.interpretSampleSizeValue(er, br); BasicInterpreter.interpretRelativeOrganismQuantity(br); Assert.assertEquals(Double.valueOf(5d), br.getRelativeOrganismQuantity()); }
public static void interpretRelativeOrganismQuantity(BasicRecord br) { if (!Strings.isNullOrEmpty(br.getOrganismQuantityType()) && !Strings.isNullOrEmpty(br.getSampleSizeUnit()) && br.getOrganismQuantityType().equalsIgnoreCase(br.getSampleSizeUnit())) { Double organismQuantity = br.getOrganismQuantity(); Double sampleSizeValue = br.getSampleSizeValue(); if (organismQuantity != null && sampleSizeValue != null) { double result = organismQuantity / sampleSizeValue; if (!Double.isNaN(result) && !Double.isInfinite(result)) { br.setRelativeOrganismQuantity(organismQuantity / sampleSizeValue); } } } }
BasicInterpreter { public static void interpretRelativeOrganismQuantity(BasicRecord br) { if (!Strings.isNullOrEmpty(br.getOrganismQuantityType()) && !Strings.isNullOrEmpty(br.getSampleSizeUnit()) && br.getOrganismQuantityType().equalsIgnoreCase(br.getSampleSizeUnit())) { Double organismQuantity = br.getOrganismQuantity(); Double sampleSizeValue = br.getSampleSizeValue(); if (organismQuantity != null && sampleSizeValue != null) { double result = organismQuantity / sampleSizeValue; if (!Double.isNaN(result) && !Double.isInfinite(result)) { br.setRelativeOrganismQuantity(organismQuantity / sampleSizeValue); } } } } }
BasicInterpreter { public static void interpretRelativeOrganismQuantity(BasicRecord br) { if (!Strings.isNullOrEmpty(br.getOrganismQuantityType()) && !Strings.isNullOrEmpty(br.getSampleSizeUnit()) && br.getOrganismQuantityType().equalsIgnoreCase(br.getSampleSizeUnit())) { Double organismQuantity = br.getOrganismQuantity(); Double sampleSizeValue = br.getSampleSizeValue(); if (organismQuantity != null && sampleSizeValue != null) { double result = organismQuantity / sampleSizeValue; if (!Double.isNaN(result) && !Double.isInfinite(result)) { br.setRelativeOrganismQuantity(organismQuantity / sampleSizeValue); } } } }  }
BasicInterpreter { public static void interpretRelativeOrganismQuantity(BasicRecord br) { if (!Strings.isNullOrEmpty(br.getOrganismQuantityType()) && !Strings.isNullOrEmpty(br.getSampleSizeUnit()) && br.getOrganismQuantityType().equalsIgnoreCase(br.getSampleSizeUnit())) { Double organismQuantity = br.getOrganismQuantity(); Double sampleSizeValue = br.getSampleSizeValue(); if (organismQuantity != null && sampleSizeValue != null) { double result = organismQuantity / sampleSizeValue; if (!Double.isNaN(result) && !Double.isInfinite(result)) { br.setRelativeOrganismQuantity(organismQuantity / sampleSizeValue); } } } }  static BiConsumer<ExtendedRecord, BasicRecord> interpretGbifId(
      HBaseLockingKeyService keygenService,
      boolean isTripletValid,
      boolean isOccurrenceIdValid,
      boolean useExtendedRecordId,
      BiConsumer<ExtendedRecord, BasicRecord> gbifIdFn); static BiConsumer<ExtendedRecord, BasicRecord> interpretGbifId(
      HBaseLockingKeyService keygenService, boolean isTripletValid, boolean isOccurrenceIdValid); static BiConsumer<ExtendedRecord, BasicRecord> interpretCopyGbifId(); static void interpretIndividualCount(ExtendedRecord er, BasicRecord br); static void interpretTypeStatus(ExtendedRecord er, BasicRecord br); static void interpretLifeStage(ExtendedRecord er, BasicRecord br); static void interpretEstablishmentMeans(ExtendedRecord er, BasicRecord br); static void interpretSex(ExtendedRecord er, BasicRecord br); static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br); static void interpretReferences(ExtendedRecord er, BasicRecord br); static void interpretTypifiedName(ExtendedRecord er, BasicRecord br); static void interpretSampleSizeValue(ExtendedRecord er, BasicRecord br); static void interpretSampleSizeUnit(ExtendedRecord er, BasicRecord br); static void interpretOrganismQuantity(ExtendedRecord er, BasicRecord br); static void interpretOrganismQuantityType(ExtendedRecord er, BasicRecord br); static void interpretRelativeOrganismQuantity(BasicRecord br); static void interpretLicense(ExtendedRecord er, BasicRecord br); static void interpretIdentifiedByIds(ExtendedRecord er, BasicRecord br); static void interpretRecordedByIds(ExtendedRecord er, BasicRecord br); static BiConsumer<ExtendedRecord, BasicRecord> interpretOccurrenceStatus(
      KeyValueStore<String, OccurrenceStatus> occStatusKvStore); }
BasicInterpreter { public static void interpretRelativeOrganismQuantity(BasicRecord br) { if (!Strings.isNullOrEmpty(br.getOrganismQuantityType()) && !Strings.isNullOrEmpty(br.getSampleSizeUnit()) && br.getOrganismQuantityType().equalsIgnoreCase(br.getSampleSizeUnit())) { Double organismQuantity = br.getOrganismQuantity(); Double sampleSizeValue = br.getSampleSizeValue(); if (organismQuantity != null && sampleSizeValue != null) { double result = organismQuantity / sampleSizeValue; if (!Double.isNaN(result) && !Double.isInfinite(result)) { br.setRelativeOrganismQuantity(organismQuantity / sampleSizeValue); } } } }  static BiConsumer<ExtendedRecord, BasicRecord> interpretGbifId(
      HBaseLockingKeyService keygenService,
      boolean isTripletValid,
      boolean isOccurrenceIdValid,
      boolean useExtendedRecordId,
      BiConsumer<ExtendedRecord, BasicRecord> gbifIdFn); static BiConsumer<ExtendedRecord, BasicRecord> interpretGbifId(
      HBaseLockingKeyService keygenService, boolean isTripletValid, boolean isOccurrenceIdValid); static BiConsumer<ExtendedRecord, BasicRecord> interpretCopyGbifId(); static void interpretIndividualCount(ExtendedRecord er, BasicRecord br); static void interpretTypeStatus(ExtendedRecord er, BasicRecord br); static void interpretLifeStage(ExtendedRecord er, BasicRecord br); static void interpretEstablishmentMeans(ExtendedRecord er, BasicRecord br); static void interpretSex(ExtendedRecord er, BasicRecord br); static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br); static void interpretReferences(ExtendedRecord er, BasicRecord br); static void interpretTypifiedName(ExtendedRecord er, BasicRecord br); static void interpretSampleSizeValue(ExtendedRecord er, BasicRecord br); static void interpretSampleSizeUnit(ExtendedRecord er, BasicRecord br); static void interpretOrganismQuantity(ExtendedRecord er, BasicRecord br); static void interpretOrganismQuantityType(ExtendedRecord er, BasicRecord br); static void interpretRelativeOrganismQuantity(BasicRecord br); static void interpretLicense(ExtendedRecord er, BasicRecord br); static void interpretIdentifiedByIds(ExtendedRecord er, BasicRecord br); static void interpretRecordedByIds(ExtendedRecord er, BasicRecord br); static BiConsumer<ExtendedRecord, BasicRecord> interpretOccurrenceStatus(
      KeyValueStore<String, OccurrenceStatus> occStatusKvStore); static final String GBIF_ID_INVALID; }