List of usage examples for java.util.function BiConsumer BiConsumer
BiConsumer
From source file:com.qwazr.search.index.IndexInstance.java
void fillFields(final Map<String, FieldDefinition> fields) { if (fields == null) return;//from ww w .j a v a 2s . co m this.fieldMap.forEach(new BiConsumer<String, FieldDefinition>() { @Override public void accept(String name, FieldDefinition fieldDefinition) { if (!fields.containsKey(name)) fields.put(name, fieldDefinition); } }); }
From source file:com.qwazr.search.index.IndexInstance.java
void fillAnalyzers(final Map<String, AnalyzerDefinition> analyzers) { if (analyzers == null) return;// w w w .jav a 2 s .c o m this.analyzerMap.forEach(new BiConsumer<String, AnalyzerDefinition>() { @Override public void accept(String name, AnalyzerDefinition analyzerDefinition) { if (!analyzers.containsKey(name)) analyzers.put(name, analyzerDefinition); } }); }
From source file:gov.va.oia.terminology.converters.sharedUtils.EConceptUtility.java
private UUID setupWbPropertyMetadata(UUID refsetSynonymParent, UUID refsetValueParent, PropertyType pt, DataOutputStream dos) throws Exception { if (pt.getPropertyTypeReferenceSetName() == null || pt.getPropertyTypeReferenceSetUUID() == null) { throw new RuntimeException("Unhandled case!"); }//from w w w.j a va 2 s . com //Create the terminology specific refset type BiConsumer<TtkConceptChronicle, EConceptUtility> callback = new BiConsumer<TtkConceptChronicle, EConceptUtility>() { @Override public void accept(TtkConceptChronicle concept, EConceptUtility util) { try { DynamicSememeColumnInfo[] colInfo = new DynamicSememeColumnInfo[] { new DynamicSememeColumnInfo( 0, IsaacMetadataConstants.DYNAMIC_SEMEME_COLUMN_VALUE.getUUID(), DynamicSememeDataType.UUID, null, true) }; TtkUtils.configureConceptAsDynamicRefex(concept, "Carries the source description type information", colInfo, null, null, (rev -> setRevisionAttributes(rev, Status.ACTIVE, concept.getConceptAttributes().getTime()))); refexAllowedColumnTypes_.put(concept.getPrimordialUuid(), colInfo); List<TtkRefexDynamicMemberChronicle> attrs = concept.getConceptAttributes() .getAnnotationsDynamic(); if (attrs == null) { attrs = new ArrayList<>(); } attrs.add(TtkUtils.configureDynamicRefexIndexes(concept.getPrimordialUuid(), new Integer[] { 0 }, (rev -> setRevisionAttributes(rev, Status.ACTIVE, concept.getConceptAttributes().getTime())))); } catch (NoSuchAlgorithmException | PropertyVetoException | IOException e) { throw new RuntimeException("Unexpected", e); } } }; createAndStoreMetaDataConcept(pt.getPropertyTypeReferenceSetUUID(), pt.getPropertyTypeReferenceSetName(), refsetSynonymParent, callback, dos); ConverterUUID.addMapping(pt.getPropertyTypeReferenceSetName(), pt.getPropertyTypeReferenceSetUUID()); //Now create the terminology specific refset type as a child - very similar to above, but since this isn't the refset concept, just an organization //concept, I add an 's' to make it plural, and use a different UUID (calculated from the new plural) //I have a case in UMLS and RxNorm loaders where this makes a duplicate, but its ok, it should merge. return createAndStoreMetaDataConcept( ConverterUUID.createNamespaceUUIDFromString(pt.getPropertyTypeReferenceSetName() + "s", true), pt.getPropertyTypeReferenceSetName() + "s", refsetValueParent, null, dos).getPrimordialUuid(); }
From source file:org.codice.alliance.libs.stanag4609.Stanag4609TransportStreamParserTest.java
@Test public void testParseTransportStreamWithKLVCallback() throws Exception { final Stanag4609TransportStreamParser parser = getParser(); // Mockito can't spy anonymous classes. final BiConsumer<Integer, DecodedKLVMetadataPacket> callback = new BiConsumer<Integer, DecodedKLVMetadataPacket>() { @Override//from www . j a va2 s.co m public void accept(Integer integer, DecodedKLVMetadataPacket decodedKLVMetadataPacket) { } }; final BiConsumer<Integer, DecodedKLVMetadataPacket> callbackSpy = spy(callback); parser.parse(callbackSpy); final ArgumentCaptor<DecodedKLVMetadataPacket> decodedPacketCaptor = ArgumentCaptor .forClass(DecodedKLVMetadataPacket.class); // The packet ID of the metadata stream in this file is 497. verify(callbackSpy, times(1)).accept(eq(497), decodedPacketCaptor.capture()); verifyDecodedMetadataPacket(decodedPacketCaptor.getValue()); }
From source file:org.codice.ddf.libs.mpeg.transport.MpegTransportStreamMetadataExtractorTest.java
@Test public void testExtractCallback() throws Exception { final MpegTransportStreamMetadataExtractor extractor = getExtractor(); // Mockito cannot spy anonymous classes. final BiConsumer<Integer, byte[]> callback = new BiConsumer<Integer, byte[]>() { @Override/*w w w.j a va 2s . c o m*/ public void accept(Integer integer, byte[] bytes) { } }; final BiConsumer<Integer, byte[]> callbackSpy = spy(callback); extractor.getMetadata(callbackSpy); // The packet ID of the metadata stream in this file is 497. final ArgumentCaptor<byte[]> metadataCaptor = ArgumentCaptor.forClass(byte[].class); verify(callbackSpy, times(12)).accept(eq(497), metadataCaptor.capture()); verifyExtractedBytes(metadataCaptor.getAllValues()); }