public static ViewDistance forIndex(int viewDistanceLevel) { ViewDistance result = indexLookup.get(viewDistanceLevel); if (result == null) { return LEGALLY_BLIND; } return result; }
/** * @param id The previously set id of the field * @return The field identified by the given id, or null if there is no such field */ public FIELD getField(int id) { return fieldsById.get(id); }
public MethodLocation getLocation(int address) { return addressToLocation.get(address); }
public TagValuePair decodeType(int type) { return decodingRules.get(type); }
public V get( int key ) { synchronized( mutex ) { return m.get( key ); } }
public FontDataBuilder setCharacterPage(int value) { this.characterPage = value; if (pages.get(value) == null) { throw new IllegalArgumentException("Invalid font - character on missing page '" + value + "'"); } return this; }
private @Nullable List<ExecutionNode> getNodePileByAddress(int address) { MethodLocation location = addressToLocation.get(address); return locationToNodePile.get(location); }
public boolean containsTask (int taskId) { AnalystClusterRequest req = tasksById.get(taskId); if (req != null) { if (!req.jobId.equals(this.jobId)) { LOG.error("Task {} has a job ID that does not match the job in which it was discovered."); } return true; } return false; }
private List<MethodLocation> getTargets(int branchFromAddress, TIntIntMap targetKeyToOffset) { int[] offsets = targetKeyToOffset.values(); List<MethodLocation> targets = new LinkedList<>(); for (int offset : offsets) { int targetOffset = branchFromAddress + offset; targets.add(addressToLocation.get(targetOffset)); } return targets; } }
public FontDataBuilder endCharacter() { Texture page = pages.get(characterPage); FontCharacter character = new FontCharacter(((float) characterX / page.getWidth()), ((float) characterY / page.getHeight()), characterWidth, characterHeight, characterXOffset, characterYOffset, characterXAdvance, page, pageMats.get(characterPage)); characters.put(currentCharacterId, character); return this; }
/** * Returns a key based on the provided key Id. * @param id The id of the key. * @return The key with this id. */ public static Input find(int id) { Input result = lookupById.get(id); if (result == null) { result = new UnknownInput(InputType.KEY, id); lookupById.put(id, result); lookupByName.put(result.getName(), result); } return result; } }
public static MethodLocation getNextLocation(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation) { int address = location.getCodeAddress(); int nextAddress = address + location.getInstruction().getCodeUnits(); return addressToLocation.get(nextAddress); }
@Bench public void timeLookupTrove() { Object value = null; for (int i = 0; i < data.length; i++) { value = myTrove.get(i); } value.toString(); } }
@Override public Op create(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation, VirtualMachine vm) { BuilderInstruction instruction = (BuilderInstruction) location.getInstruction(); Label target = ((BuilderOffsetInstruction) instruction).getTarget(); int targetAddress = target.getCodeAddress(); MethodLocation child = addressToLocation.get(targetAddress); return new GotoOp(location, child); } }
@Override public void bindTextures() { if (isDisposed()) { return; } enable(); for (int slot : textureMap.keys()) { Texture texture = textureMap.get(slot); if (texture.isDisposed()) { logger.error("Attempted to bind disposed texture {}", texture); } else { shaderManager.bindTexture(slot, texture); } } }
@Override public Op create(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation, VirtualMachine vm) { BuilderInstruction instruction = (BuilderInstruction) location.getInstruction(); int address = instruction.getLocation().getCodeAddress(); int returnAddress = address + instruction.getCodeUnits(); MethodLocation returnLocation = addressToLocation.get(returnAddress); int branchOffset = ((OffsetInstruction) instruction).getCodeOffset(); int childAddress = address + branchOffset; MethodLocation child = addressToLocation.get(childAddress); Instruction31t instr = (Instruction31t) location.getInstruction(); int register = instr.getRegisterA(); return new FillArrayDataOp(location, child, returnLocation, register); } }
@Bench public void timeInsertAndLookupTrove() { TIntObjectMap<Object> trove = new TIntObjectHashMap<Object>(); Object value = null; for (int i = 0; i < data.length; i++) { trove.put(i, data[i]); value = trove.get(i); } value.toString(); }
@Override public Op create(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation, VirtualMachine vm) { MethodLocation child = Utils.getNextLocation(location, addressToLocation); int address = location.getCodeAddress(); int branchOffset = ((OffsetInstruction) location.getInstruction()).getCodeOffset(); int targetAddress = address + branchOffset; MethodLocation target = addressToLocation.get(targetAddress); Instruction31t instr = (Instruction31t) location.getInstruction(); int register = instr.getRegisterA(); return new SwitchOp(location, child, target, register); }
@Test public void shiftIntegerMapKeysShiftsUpAsExpected() { TIntObjectMap<String> intToObject = new TIntObjectHashMap<String>(); intToObject.put(1, "one"); intToObject.put(2, "two"); intToObject.put(3, "three"); Utils.shiftIntegerMapKeys(1, 2, intToObject); assertEquals(3, intToObject.size()); assertEquals("one", intToObject.get(1)); assertEquals("two", intToObject.get(4)); assertEquals("three", intToObject.get(5)); }
@Test public void shiftIntegerMapKeysRemovesWhenShiftingDown() { TIntObjectMap<String> intToObject = new TIntObjectHashMap<String>(); intToObject.put(1, "one"); intToObject.put(2, "two"); intToObject.put(3, "three"); Utils.shiftIntegerMapKeys(1, -1, intToObject); assertEquals(2, intToObject.size()); assertEquals("two", intToObject.get(1)); assertEquals("three", intToObject.get(2)); }