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); } } }
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; }
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; providers.get( STRING ), providers.get( NUMBER ), providers.get( SPATIAL ), providers.get( TEMPORAL ), providers.get( LUCENE ), fusionVersion.slotSelector(), DESCRIPTOR, NONE, mock( FileSystemAbstraction.class ), false ); instanceSelector = new InstanceSelector<>( providers );
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); List<ICommentProcessor> processorsForTemplateMode = commentProcessorListsByTemplateMode.get(templateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<ICommentProcessor>(5); List<IDocTypeProcessor> processorsForTemplateMode = docTypeProcessorListsByTemplateMode.get(templateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<IDocTypeProcessor>(5); List<IProcessingInstructionProcessor> processorsForTemplateMode = processingInstructionProcessorListsByTemplateMode.get(templateMode); if (processorsForTemplateMode == null) { processorsForTemplateMode = new ArrayList<IProcessingInstructionProcessor>(5); List<ITextProcessor> processorsForTemplateMode = textProcessorListsByTemplateMode.get(templateMode); if (processorsForTemplateMode == null) {
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 loadCapabilitiesCommon() { extensions = loadExtensions(); 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 { if (!limits.containsKey(Limits.FrameBufferSamples)) { limits.put(Limits.FrameBufferSamples, limits.get(Limits.ColorTextureSamples)); limits.put(Limits.FrameBufferMrtAttachments, getInteger(GLExt.GL_MAX_DRAW_BUFFERS_ARB)); if (limits.get(Limits.FrameBufferMrtAttachments) > 1) { caps.add(Caps.FrameBufferMRT); Integer value = limits.get(limit); if (value == null) { value = 0;
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()); else assertEquals(4, txMsgCounter.get(LogTxStatus.SECONDARY_SUCCESS).get()); } else { assertEquals(4, userLogMsgCounter.get()); assertEquals(7, userChangeCounter.get(Change.ADDED).get()); assertEquals(4, userChangeCounter.get(Change.REMOVED).get());
@Test public void convertNodeToDense() { Node node = getGraphDb().createNode(); EnumMap<MyRelTypes,Set<Relationship>> rels = new EnumMap<>( MyRelTypes.class ); for ( MyRelTypes type : MyRelTypes.values() ) { rels.put( type, new HashSet<>() ); } int expectedRelCount = 0; for ( int i = 0; i < 6; i++, expectedRelCount++ ) { MyRelTypes type = MyRelTypes.values()[i % MyRelTypes.values().length]; Relationship rel = node.createRelationshipTo( getGraphDb().createNode(), type ); rels.get( type ).add( rel ); } newTransaction(); for ( int i = 0; i < 1000; i++, expectedRelCount++ ) { node.createRelationshipTo( getGraphDb().createNode(), MyRelTypes.TEST ); } assertEquals( expectedRelCount, node.getDegree() ); assertEquals( expectedRelCount, node.getDegree( Direction.BOTH ) ); assertEquals( expectedRelCount, node.getDegree( Direction.OUTGOING ) ); assertEquals( 0, node.getDegree( Direction.INCOMING ) ); assertEquals( rels.get( MyRelTypes.TEST2 ), Iterables.asSet( node.getRelationships( MyRelTypes.TEST2 ) ) ); assertEquals( join( rels.get( MyRelTypes.TEST_TRAVERSAL ), rels.get( MyRelTypes.TEST2 ) ), Iterables.asSet( node.getRelationships( MyRelTypes.TEST_TRAVERSAL, MyRelTypes.TEST2 ) ) ); }
final Log userLog = openUserLog(userLogName); final EnumMap<LogTxStatus, AtomicInteger> txMsgCounter = new EnumMap<>(LogTxStatus.class); for (final LogTxStatus status : LogTxStatus.values()) txMsgCounter.put(status, new AtomicInteger(0)); final AtomicInteger userLogMeta = new AtomicInteger(0); transactionLog.registerReader(startMarker, new MessageReader() { }); final EnumMap<Change, AtomicInteger> userChangeCounter = new EnumMap<>(Change.class); for (final Change change : Change.values()) userChangeCounter.put(change, new AtomicInteger(0)); final AtomicInteger userLogMsgCounter = new AtomicInteger(0); userLog.registerReader(startMarker, new MessageReader() { }); Thread.sleep(4000); 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()); else assertEquals(4, txMsgCounter.get(LogTxStatus.SECONDARY_SUCCESS).get()); } else { assertEquals(4, userLogMsgCounter.get()); assertEquals(7, userChangeCounter.get(Change.ADDED).get()); assertEquals(4, userChangeCounter.get(Change.REMOVED).get());