Refine search
/** * Evaluate this selector against the given list of JSSE supported protocols. * * @param supportedProtocols the supported protocols * @return the enabled protocols (not {@code null}) */ public final String[] evaluate(String[] supportedProtocols) { final EnumMap<Protocol, String> supported = new EnumMap<Protocol, String>(Protocol.class); for (String protocolName : supportedProtocols) { final Protocol protocol = Protocol.forName(protocolName); if (protocol != null) { supported.put(protocol, protocolName); } } final LinkedHashSet<Protocol> enabledSet = new LinkedHashSet<>(supported.size()); doEvaluate(enabledSet, supported); final ArrayList<String> list = new ArrayList<>(enabledSet.size()); for (Protocol protocol : enabledSet) { list.add(supported.get(protocol)); } return list.toArray(new String[enabledSet.size()]); }
/** * Sets the shaders that this technique definition will use. * * @param shaderNames EnumMap containing all shader names for this stage * @param shaderLanguages EnumMap containing all shader languages for this stage */ public void setShaderFile(EnumMap<Shader.ShaderType, String> shaderNames, EnumMap<Shader.ShaderType, String> shaderLanguages) { requiredCaps.clear(); weight = 0; for (Shader.ShaderType shaderType : shaderNames.keySet()) { String language = shaderLanguages.get(shaderType); String shaderFile = shaderNames.get(shaderType); this.shaderLanguages.put(shaderType, language); this.shaderNames.put(shaderType, shaderFile); Caps cap = Caps.valueOf(language); requiredCaps.add(cap); weight = Math.max(weight, cap.ordinal()); if (shaderType.equals(Shader.ShaderType.Geometry)) { requiredCaps.add(Caps.GeometryShader); } else if (shaderType.equals(Shader.ShaderType.TessellationControl)) { requiredCaps.add(Caps.TesselationShader); } } }
public void read(JmeImporter im) throws IOException{ InputCapsule ic = im.getCapsule(this); name = ic.readString("name", null); shaderNames.put(Shader.ShaderType.Vertex,ic.readString("vertName", null)); shaderNames.put(Shader.ShaderType.Fragment,ic.readString("fragName", null)); shaderNames.put(Shader.ShaderType.Geometry,ic.readString("geomName", null)); shaderNames.put(Shader.ShaderType.TessellationControl,ic.readString("tsctrlName", null)); shaderNames.put(Shader.ShaderType.TessellationEvaluation,ic.readString("tsevalName", null)); shaderPrologue = ic.readString("shaderPrologue", null); lightMode = ic.readEnum("lightMode", LightMode.class, LightMode.Disable); shadowMode = ic.readEnum("shadowMode", ShadowMode.class, ShadowMode.Disable); renderState = (RenderState) ic.readSavable("renderState", null); noRender = ic.readBoolean("noRender", false); if (ic.getSavableVersion(TechniqueDef.class) == 0) { // Old version shaderLanguages.put(Shader.ShaderType.Vertex,ic.readString("shaderLang", null)); shaderLanguages.put(Shader.ShaderType.Fragment,shaderLanguages.get(Shader.ShaderType.Vertex)); } else { // New version shaderLanguages.put(Shader.ShaderType.Vertex,ic.readString("vertLanguage", null)); shaderLanguages.put(Shader.ShaderType.Fragment,ic.readString("fragLanguage", null)); shaderLanguages.put(Shader.ShaderType.Geometry,ic.readString("geomLanguage", null)); shaderLanguages.put(Shader.ShaderType.TessellationControl,ic.readString("tsctrlLanguage", null)); shaderLanguages.put(Shader.ShaderType.TessellationEvaluation,ic.readString("tsevalLanguage", null)); } usesNodes = ic.readBoolean("usesNodes", false); shaderNodes = ic.readSavableArrayList("shaderNodes", null); shaderGenerationInfo = (ShaderGenerationInfo) ic.readSavable("shaderGenerationInfo", null); }
private void applyDefaults(ResourceUrn resourceUrn, SectionDefinitionData section) { Optional<BlockTile> defaultTile = assetManager.getAsset(resourceUrn, BlockTile.class); if (defaultTile.isPresent()) { for (BlockPart part : BlockPart.values()) { if (section.getBlockTiles().get(part) == null) { section.getBlockTiles().put(part, defaultTile.get()); } } } if (section.getSounds() == null) { section.setSounds(assetManager.getAsset(DEFAULT_SOUNDS, BlockSounds.class).get()); } }
private void reg(Material material, ItemType type) { if (material.isBlock() != type instanceof BlockType) { throw new IllegalArgumentException( "Cannot mismatch item and block: " + material + ", " + type); } if (materialToType.containsKey(material)) { throw new IllegalArgumentException( "Cannot use " + type + " for " + material + ", is already " + materialToType .get(material)); } materialToType.put(material, type); type.setMaterial(material); if (material.isBlock()) { nextBlockId = Math.max(nextBlockId, material.getId() + 1); if (type.getClass() != BlockType.class) { ((BlockType) type).setPlaceSound(Sound.BLOCK_STONE_BREAK); } } else { nextItemId = Math.max(nextItemId, material.getId() + 1); } }
private void reg(Material material, ItemType type, Sound sound) { if (material.isBlock() != type instanceof BlockType) { throw new IllegalArgumentException( "Cannot mismatch item and block: " + material + ", " + type); } if (materialToType.containsKey(material)) { throw new IllegalArgumentException( "Cannot use " + type + " for " + material + ", is already " + materialToType .get(material)); } materialToType.put(material, type); type.setMaterial(material); if (material.isBlock()) { nextBlockId = Math.max(nextBlockId, material.getId() + 1); ((BlockType) type).setPlaceSound(sound); } else { nextItemId = Math.max(nextItemId, material.getId() + 1); } }
EnumMap<SignUrlOption.Option, Object> optionMap = Maps.newEnumMap(SignUrlOption.Option.class); for (SignUrlOption option : options) { optionMap.put(option.getOption(), option.getValue()); (ServiceAccountSigner) optionMap.get(SignUrlOption.Option.SERVICE_ACCOUNT_CRED); if (credentials == null) { checkState( credentials.sign(signatureInfo.constructUnsignedPayload().getBytes(UTF_8)); StringBuilder stBuilder = new StringBuilder(); if (optionMap.get(SignUrlOption.Option.HOST_NAME) == null) { stBuilder.append(STORAGE_XML_HOST_NAME).append(path); } else { stBuilder.append(optionMap.get(SignUrlOption.Option.HOST_NAME)).append(path);
@Override public FieldExtractor get(Metadata metadata) { FieldExtractor fieldExtractor = pool.get(metadata); if (fieldExtractor == null || (fieldExtractor instanceof StaticFieldExtractor && ((StaticFieldExtractor)fieldExtractor).needsInit())) { Object value = getValue(metadata); if (value == null) { return null; } if (fieldExtractor == null) { fieldExtractor = _createExtractorFor(metadata); } if(fieldExtractor instanceof StaticFieldExtractor && ((StaticFieldExtractor)fieldExtractor).needsInit()) { ((StaticFieldExtractor)fieldExtractor).setField(value); } pool.put(metadata, fieldExtractor); } return fieldExtractor; }
limits.put(Limits.VertexTextureUnits, getInteger(GL.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)); if (limits.get(Limits.VertexTextureUnits) > 0) { caps.add(Caps.VertexTextureFetch); limits.put(Limits.FragmentTextureUnits, getInteger(GL.GL_MAX_TEXTURE_IMAGE_UNITS)); limits.put(Limits.FragmentUniformVectors, getInteger(GL.GL_MAX_FRAGMENT_UNIFORM_VECTORS)); limits.put(Limits.VertexUniformVectors, getInteger(GL.GL_MAX_VERTEX_UNIFORM_VECTORS)); } else { limits.put(Limits.FragmentUniformVectors, getInteger(GL.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS) / 4); limits.put(Limits.VertexUniformVectors, getInteger(GL.GL_MAX_VERTEX_UNIFORM_COMPONENTS) / 4); limits.put(Limits.VertexAttributes, getInteger(GL.GL_MAX_VERTEX_ATTRIBS)); limits.put(Limits.TextureSize, getInteger(GL.GL_MAX_TEXTURE_SIZE)); limits.put(Limits.CubemapSize, getInteger(GL.GL_MAX_CUBE_MAP_TEXTURE_SIZE)); limits.put(Limits.TextureAnisotropy, getInteger(GLExt.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)); limits.put(Limits.RenderBufferSize, getInteger(GLFbo.GL_MAX_RENDERBUFFER_SIZE_EXT)); limits.put(Limits.FrameBufferAttachments, getInteger(GLFbo.GL_MAX_COLOR_ATTACHMENTS_EXT)); limits.put(Limits.FrameBufferSamples, getInteger(GLExt.GL_MAX_SAMPLES_EXT)); limits.put(Limits.ColorTextureSamples, getInteger(GLExt.GL_MAX_COLOR_TEXTURE_SAMPLES)); limits.put(Limits.DepthTextureSamples, getInteger(GLExt.GL_MAX_DEPTH_TEXTURE_SAMPLES)); if (!limits.containsKey(Limits.FrameBufferSamples)) { limits.put(Limits.FrameBufferSamples, limits.get(Limits.ColorTextureSamples));
providers.put( STRING, string ); aliveProviders[i] = string; break; case NUMBER: IndexProvider number = mockProvider( NumberIndexProvider.class, "number" ); providers.put( NUMBER, number ); aliveProviders[i] = number; break; case SPATIAL: IndexProvider spatial = mockProvider( SpatialIndexProvider.class, "spatial" ); providers.put( SPATIAL, spatial ); aliveProviders[i] = spatial; break; case TEMPORAL: IndexProvider temporal = mockProvider( TemporalIndexProvider.class, "temporal" ); providers.put( TEMPORAL, temporal ); aliveProviders[i] = temporal; break; case LUCENE: IndexProvider lucene = mockProvider( IndexProvider.class, "lucene" ); providers.put( LUCENE, lucene ); aliveProviders[i] = lucene; break;
List<IElementProcessor> processorsForTemplateMode = elementProcessorListsByTemplateMode.get(templateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<IElementProcessor>(5); elementProcessorListsByTemplateMode.put(templateMode, processorsForTemplateMode); List<ITemplateBoundariesProcessor> processorsForTemplateMode = templateBoundariesProcessorListsByTemplateMode.get(templateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<ITemplateBoundariesProcessor>(5); templateBoundariesProcessorListsByTemplateMode.put(templateMode, processorsForTemplateMode); List<ICDATASectionProcessor> processorsForTemplateMode = cdataSectionProcessorListsByTemplateMode.get(templateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<ICDATASectionProcessor>(5); cdataSectionProcessorListsByTemplateMode.put(templateMode, processorsForTemplateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<ICommentProcessor>(5); commentProcessorListsByTemplateMode.put(templateMode, processorsForTemplateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<IDocTypeProcessor>(5); docTypeProcessorListsByTemplateMode.put(templateMode, processorsForTemplateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<IProcessingInstructionProcessor>(5); processingInstructionProcessorListsByTemplateMode.put(templateMode, processorsForTemplateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<ITextProcessor>(5);
Log userLog = openUserLog(userlogName); final EnumMap<LogTxStatus, AtomicInteger> txMsgCounter = new EnumMap<LogTxStatus, AtomicInteger>(LogTxStatus.class); for (LogTxStatus status : LogTxStatus.values()) txMsgCounter.put(status, new AtomicInteger(0)); final AtomicInteger userlogMeta = new AtomicInteger(0); txlog.registerReader(startMarker, new MessageReader() { for (Change change : Change.values()) userChangeCounter.put(change, new AtomicInteger(0)); final AtomicInteger userLogMsgCounter = new AtomicInteger(0); userLog.registerReader(startMarker, new MessageReader() { assertEquals(5, txMsgCounter.get(LogTxStatus.PRECOMMIT).get()); assertEquals(4, txMsgCounter.get(LogTxStatus.PRIMARY_SUCCESS).get()); assertEquals(1, txMsgCounter.get(LogTxStatus.COMPLETE_SUCCESS).get()); assertEquals(4, userlogMeta.get()); if (withLogFailure) assertEquals(4, txMsgCounter.get(LogTxStatus.SECONDARY_FAILURE).get());
private EnumMap<StorageType, Integer> getRequiredStorageTypes( List<StorageType> types) { EnumMap<StorageType, Integer> map = new EnumMap<>(StorageType.class); for (StorageType type : types) { if (!map.containsKey(type)) { map.put(type, 1); } else { int num = map.get(type); map.put(type, num + 1); } } return map; }