/** Returns an iterator for the entries in the map. Remove is supported. Note that the same iterator instance is returned each * time this method is called. Use the {@link OrderedMapEntries} constructor for nested or multithreaded iteration. */ public Entries<K, V> entries () { if (entries1 == null) { entries1 = new OrderedMapEntries(this); entries2 = new OrderedMapEntries(this); } if (!entries1.valid) { entries1.reset(); entries1.valid = true; entries2.valid = false; return entries1; } entries2.reset(); entries2.valid = true; entries1.valid = false; return entries2; }
@SuppressWarnings("unchecked") public void readJsonObject(JsonObject element, OrderedMap<String, Object> jsonData) { Entries<String, Object> entries = jsonData.entries(); for (Entry<String, Object> entry : entries) { if (entry.value instanceof OrderedMap) { JsonObject obj = new JsonObject(); element.elements.put(entry.key, obj); // unchecked, but safe: readJsonObject(obj, (OrderedMap<String, Object>) entry.value); } else if (entry.value instanceof Array) { JsonArray arr = new JsonArray(); element.elements.put(entry.key, arr); // unchecked, but safe: readJsonArray(arr, (Array<OrderedMap<String, Object>>) entry.value); } else { element.values.put(entry.key, entry.value.toString()); } } }
private void checkRequiredAttributes (StackedTask<E> stackedTask) { // Check the minimum number of children Entries<String, AttrInfo> entries = stackedTask.metadata.attributes.iterator(); while (entries.hasNext()) { Entry<String, AttrInfo> entry = entries.next(); if (entry.value.required && !encounteredAttributes.contains(entry.key)) throw stackedTaskException(stackedTask, "missing required attribute '" + entry.key + "'"); } }
@Override public void update(float deltaTime) { super.update(deltaTime); if (getMap() != null) { float gameSeconds = deltaTime * getMap().getGameTimeMultiplier(); float effectDurationDelta = gameSeconds / Configuration.getCombatTurnDurationInGameSeconds(); Array<GameCharacter> pcs = group.getPlayerCharacters(); for (int i = 0; i < pcs.size; ++i) { GameCharacter character = pcs.get(i); if (character.isActive()) { character.updateSurvival(gameSeconds); } character.updatePersistentEffects(effectDurationDelta); } Entries<GameCharacter, Array<Action>> entries = pcActionsToUpdate.entries(); for (Entry<GameCharacter, Array<Action>> entry : entries) { Iterator<Action> actions = entry.value.iterator(); while (actions.hasNext()) { Action action = actions.next(); if (action.isPaused()) { continue; } action.update(deltaTime); if (action.isFinished()) { actions.remove(); entry.key.removeAction(action); } } if (entry.value.size < 1) { entries.remove(); } } } }
@Override public void read (Json json, JsonValue jsonData) { this.name = jsonData.getString("name"); if (jsonData.has("vertexShader")) { this.individualShaders = true; this.vertexShader = jsonData.getString("vertexShader"); this.fragmentShader = jsonData.getString("fragmentShader"); Gdx.app.postRunnable(new Runnable() { @Override public void run () { Debug.log("load", Shader.this.fragmentShader); Shader.this.manager.add(Shader.this.name, RavTech.files.getAssetHandle(vertexShader), RavTech.files.getAssetHandle(fragmentShader)); } }); } String textureString = jsonData.get("textures").toString(); textureString = textureString.substring(textureString.indexOf('{')); this.textures = json.fromJson(ObjectMap.class, String.class, textureString); Gdx.app.postRunnable(new Runnable() { @Override public void run () { Entries<String, String> entries = Shader.this.textures.iterator(); while (entries.hasNext) { Entry<String, String> entry = entries.next(); if (!entry.value.endsWith(".framebuffer") && !RavTech.files.isLoaded(entry.value)) { RavTech.files.loadAsset(entry.value, Texture.class, true); ((Texture)RavTech.files.getAsset(entry.value, Texture.class)).setFilter(TextureFilter.Linear, TextureFilter.Linear); } Shader.this.textures.put(entry.key, entry.value); } } }); }
public void apply () { int textureId = 1; Entries<String, String> entries = Shader.this.textures.iterator(); while (entries.hasNext) { Entry<String, String> entry = entries.next(); if (!entry.value.endsWith(".framebuffer")) { if (!RavTech.files.isLoaded(entry.value)) continue; ((Texture)RavTech.files.getAsset(entry.value, Texture.class)).bind(textureId); } else { String trimmedName = entry.value.substring(0, entry.value.length() - ".framebuffer".length()); if (!RavTech.sceneHandler.shaderManager.containsFB(trimmedName)) continue; RavTech.sceneHandler.shaderManager.getFBTexture(trimmedName).bind(textureId); } if (RavTech.sceneHandler.shaderManager.contains(this.name)) RavTech.sceneHandler.shaderManager.get(this.name).setUniformi(entry.key, textureId); textureId++; } Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0); }
@Override public String toString () { String returnString = String.valueOf(connectionInformation) + "--LobbyDetails--\n"; Entries<String, Object> entries = values.iterator(); while (entries.hasNext) { Entry<String, Object> entry = entries.next(); returnString = returnString + entry.key + "|" + String.valueOf(entry.value) + "\n"; } return returnString; }
@Override public void connected (Connection connection) { Debug.logDebug(LOG_TAG, connection.getRemoteAddressTCP() + " is trying to conntect!"); connection.updateReturnTripTime(); // Return lobby data Packet.LobbyData lobbyDataPacket = new Packet.LobbyData(); lobbyDataPacket.values = new ObjectMap<String, Object>(); Entries<String, Object> entries = layer.net.lobby.values.iterator(); while (entries.hasNext) { Entry<String, Object> entry = entries.next(); lobbyDataPacket.values.put(entry.key, entry.value); } }
public void initEnvironment(Globals globals) { ObjectMap<String, Object> environment = this.getEnvironment(); Entries<String, Object> entries = environment.iterator(); while (entries.hasNext) { Entry<String, Object> entry = entries.next(); globals.set(entry.key, entry.value instanceof LuaValue ? (LuaValue)entry.value : CoerceJavaToLua.coerce(entry.value)); } }
public void removeComponent (GameComponent component) { Animator animator = (Animator)getComponentByType(ComponentType.Animator); if (component instanceof GameObject) if (animator != null) { Entries<String, Animation> iter = animator.animations.iterator(); while (iter.hasNext()) { Entry<String, Animation> next = iter.next(); next.value.removeComponent(component); } } component.dispose(); components.removeValue(component, true); }
public String[] getFrameBuffers () { String[] frameBufferNames = new String[frameBuffers.size]; Entries<String, FrameBuffer> entries = frameBuffers.iterator(); int i = 0; while (entries.hasNext) { Entry<String, FrameBuffer> entry = entries.next(); frameBufferNames[i] = entry.key; i++; } return frameBufferNames; }
public String getRecursively (FileHandle dir) { String relativePath = fileAccess.relativizeToAssetsFolder(dir); for (Entry<String, String> entry : new Entries<>(metadata)) { if (relativePath.startsWith(entry.key)) { return entry.value; } } return AssetType.UNKNOWN; }
public static Entries<Upgrade, ItemStack[]> getAllRecipes(){ return recipes.entries(); }
public Entries<K, V> iterator () { return entries(); }