Dddb { public Family<FlagDescriptor> getFlagDescriptors(String identifier) { if (!flagDescriptorMap.containsKey(identifier)) { InputStream inputStream = null; try { inputStream = getFlagDescriptorResource(identifier); if (inputStream != null) { final FlagDescriptors descriptors = readFlagDescriptors(inputStream); flagDescriptorMap.putIfAbsent(identifier, descriptors); } } catch (Throwable e) { throw new IllegalStateException(MessageFormat.format( "An error occurred while reading flag descriptors for identifier ''{0}''.", identifier)); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } } return flagDescriptorMap.get(identifier); } private  Dddb(); static Dddb getInstance(); DataFormat getDataFormat(File hdrFile); BandDescriptor findBandDescriptorForMember(String formatName, String memberName); Family<BandDescriptor> getBandDescriptors(String formatName); Family<FlagDescriptor> getFlagDescriptors(String identifier); Family<MemberDescriptor> getMemberDescriptors(File hdrFile);  }
@Test public void testGetFlagDescriptors_BUFR() throws Exception { final Family<FlagDescriptor> descriptors = dddb.getFlagDescriptors("BUFR_flags"); assertEquals(13, descriptors.asList().size()); }
@Test public void testGetFlagDescriptors() { final Family<FlagDescriptor> descriptors = dddb.getFlagDescriptors(DBL_SM_XXXX_AUX_ECMWF__0200 + "_flags1"); assertEquals(21, descriptors.asList().size()); FlagDescriptor descriptor; descriptor = descriptors.getMember("RR_FLAG"); assertNotNull(descriptor); assertEquals("RR_FLAG", descriptor.getFlagName()); assertEquals(0x00000080, descriptor.getMask()); assertNull(descriptor.getColor()); assertEquals(0.5, descriptor.getTransparency(), 0.0); assertFalse(descriptor.getDescription().isEmpty()); }