public GLBufferPool(boolean traceBufferUsage) { this.traceBufferUsage = traceBufferUsage; if (traceBufferUsage) { usageTracker = new TIntObjectHashMap<>(); } }
public LabelAlphabet() { data = new TObjectIntHashMap<String>(DEFAULT_CAPACITY,DEFAULT_LOAD_FACTOR,noEntryValue); frozen = false; index = new TIntObjectHashMap<String>(); }
public TIntObjectHashMap<TransportRoute> getTransportRoutes(int[] filePointers) throws IOException { TIntObjectHashMap<TransportRoute> result = new TIntObjectHashMap<TransportRoute>(); loadTransportRoutes(filePointers, result); return result; } /**
public RouteDataObject(RouteRegion region, int[] nameIds, String[] nameValues) { this.region = region; this.nameIds = nameIds; if (nameIds.length > 0) { names = new TIntObjectHashMap<String>(); } for (int i = 0; i < nameIds.length; i++) { names.put(nameIds[i], nameValues[i]); } }
public static SearchRequest<TransportStop> buildSearchTransportRequest(int sleft, int sright, int stop, int sbottom, int limit, List<TransportStop> stops) { SearchRequest<TransportStop> request = new SearchRequest<TransportStop>(); if (stops != null) { request.searchResults = stops; } request.stringTable = new TIntObjectHashMap<String>(); request.left = sleft >> (31 - TRANSPORT_STOP_ZOOM); request.right = sright >> (31 - TRANSPORT_STOP_ZOOM); request.top = stop >> (31 - TRANSPORT_STOP_ZOOM); request.bottom = sbottom >> (31 - TRANSPORT_STOP_ZOOM); request.limit = limit; return request; }
public TransportRoutingContext(TransportRoutingConfiguration cfg, BinaryMapIndexReader... readers) { this.cfg = cfg; walkRadiusIn31 = (int) (cfg.walkRadius / MapUtils.getTileDistanceWidth(31)); walkChangeRadiusIn31 = (int) (cfg.walkChangeRadius / MapUtils.getTileDistanceWidth(31)); quadTree = new TLongObjectHashMap<List<TransportRouteSegment>>(); for (BinaryMapIndexReader r : readers) { routeMap.put(r, new TIntObjectHashMap<TransportRoute>()); } }
protected static TIntObjectMap<MethodLocation> buildAddressToLocation(MutableMethodImplementation implementation) { List<BuilderInstruction> instructions = implementation.getInstructions(); TIntObjectMap<MethodLocation> addressToLocation = new TIntObjectHashMap<>(instructions.size()); for (BuilderInstruction instruction : instructions) { MethodLocation location = instruction.getLocation(); int address = location.getCodeAddress(); addressToLocation.put(address, location); } return addressToLocation; }
public void putObjectName(int type, String name){ if(objectNames == null){ objectNames = new TIntObjectHashMap<String>(); namesOrder = new TIntArrayList(); } objectNames.put(type, name); namesOrder.add(type); }
@Before public void setUp() { vm = mock(VirtualMachine.class); mState = mock(MethodState.class); node = mock(ExecutionNode.class); location = mock(MethodLocation.class); when(location.getCodeAddress()).thenReturn(ADDRESS); addressToLocation = new TIntObjectHashMap<MethodLocation>(); addressToLocation.put(ADDRESS, location); opFactory = new IfOpFactory(); }
@Before public void setUp() { vm = mock(VirtualMachine.class); mState = mock(MethodState.class); node = mock(ExecutionNode.class); location = mock(MethodLocation.class); when(location.getCodeAddress()).thenReturn(ADDRESS); ExceptionFactory exceptionFactory = mock(ExceptionFactory.class); when(vm.getExceptionFactory()).thenReturn(exceptionFactory); addressToLocation = new TIntObjectHashMap<MethodLocation>(); addressToLocation.put(ADDRESS, location); opFactory = new BinaryMathOpFactory(); }
@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(); }
@Before public void setUp() { vm = mock(VirtualMachine.class); classManager = mock(ClassManager.class); when(vm.getClassManager()).thenReturn(classManager); location = mock(MethodLocation.class); instruction = mock(BuilderInstruction.class, withSettings().extraInterfaces(SwitchPayload.class)); when(location.getInstruction()).thenReturn(instruction); when(location.getCodeAddress()).thenReturn(ADDRESS); when(instruction.getLocation()).thenReturn(location); when(instruction.getCodeUnits()).thenReturn(0); addressToLocation = new TIntObjectHashMap<MethodLocation>(); addressToLocation.put(ADDRESS, location); opFactory = new SwitchPayloadOpFactory(); }
@Before public void setUp() { vm = mock(VirtualMachine.class); mState = mock(MethodState.class); node = mock(ExecutionNode.class); item = mock(HeapItem.class); when(mState.readRegister(REGISTER_B)).thenReturn(item); location = mock(MethodLocation.class); instruction = mock(BuilderInstruction.class, withSettings().extraInterfaces(Instruction12x.class)); when(location.getInstruction()).thenReturn(instruction); when(location.getCodeAddress()).thenReturn(ADDRESS); when(instruction.getLocation()).thenReturn(location); when(instruction.getCodeUnits()).thenReturn(0); when(((Instruction12x) instruction).getRegisterA()).thenReturn(REGISTER_A); when(((Instruction12x) instruction).getRegisterB()).thenReturn(REGISTER_B); addressToLocation = new TIntObjectHashMap<MethodLocation>(); addressToLocation.put(ADDRESS, location); opFactory = new UnaryMathOpFactory(); }
@Override public TIntObjectHashMap<String> toInverseIndexMap() { TIntObjectHashMap<String> index = new TIntObjectHashMap<String>(); TObjectIntIterator<String> it = data.iterator(); while (it.hasNext()) { it.advance(); String value = it.key(); int key = it.value(); index.put(key, value); } return index; }
@Override public TIntObjectHashMap<String> toInverseIndexMap() { TIntObjectHashMap<String> index = new TIntObjectHashMap<String>(); TObjectIntIterator<String> it = data.iterator(); while (it.hasNext()) { it.advance(); String value = it.key(); int key = it.value(); index.put(key, value); } return index; }
@Before public void setUp() { vm = mock(VirtualMachine.class); node = mock(ExecutionNode.class); mState = mock(MethodState.class); location = mock(MethodLocation.class); instruction = mock(BuilderInstruction.class, withSettings().extraInterfaces(Instruction3rc.class, VariableRegisterInstruction.class, ReferenceInstruction.class, RegisterRangeInstruction.class)); when(location.getInstruction()).thenReturn(instruction); when(location.getCodeAddress()).thenReturn(ADDRESS); when(instruction.getLocation()).thenReturn(location); when(instruction.getCodeUnits()).thenReturn(0); Reference ref = new ImmutableTypeReference("[I"); when(((ReferenceInstruction) instruction).getReference()).thenReturn(ref); addressToLocation = new TIntObjectHashMap<MethodLocation>(); addressToLocation.put(ADDRESS, location); opFactory = new FilledNewArrayOpFactory(); }
@Before public void setUp() { vm = mock(VirtualMachine.class); mState = mock(MethodState.class); node = mock(ExecutionNode.class); setItem = ArgumentCaptor.forClass(HeapItem.class); itemB = mock(HeapItem.class); when(itemB.isUnknown()).thenReturn(false); when(mState.readRegister(REGISTER_B)).thenReturn(itemB); itemC = mock(HeapItem.class); when(itemC.isUnknown()).thenReturn(false); when(mState.readRegister(REGISTER_C)).thenReturn(itemC); location = mock(MethodLocation.class); instruction = mock(BuilderInstruction.class, withSettings().extraInterfaces(Instruction23x.class)); when(location.getInstruction()).thenReturn(instruction); when(location.getCodeAddress()).thenReturn(ADDRESS); when(instruction.getLocation()).thenReturn(location); when(instruction.getCodeUnits()).thenReturn(0); when(((Instruction23x) instruction).getRegisterA()).thenReturn(REGISTER_A); when(((Instruction23x) instruction).getRegisterB()).thenReturn(REGISTER_B); when(((Instruction23x) instruction).getRegisterC()).thenReturn(REGISTER_C); addressToLocation = new TIntObjectHashMap<MethodLocation>(); addressToLocation.put(ADDRESS, location); opFactory = new CmpOpFactory(); }
@Before public void setUp() { vm = mock(VirtualMachine.class); ectx = mock(ExecutionContext.class); mState = mock(MethodState.class); when(ectx.getMethodState()).thenReturn(mState); node = mock(ExecutionNode.class); itemB = mock(HeapItem.class); when(mState.readRegister(REGISTER_B)).thenReturn(itemB); setItem = ArgumentCaptor.forClass(HeapItem.class); location = mock(MethodLocation.class); instruction = mock(BuilderInstruction.class, withSettings().extraInterfaces(Instruction22c.class)); when(location.getInstruction()).thenReturn(instruction); when(location.getCodeAddress()).thenReturn(ADDRESS); when(instruction.getLocation()).thenReturn(location); when(instruction.getCodeUnits()).thenReturn(0); when(((Instruction22c) instruction).getRegisterA()).thenReturn(REGISTER_A); when(((Instruction22c) instruction).getRegisterB()).thenReturn(REGISTER_B); FieldReference fieldRef = new ImmutableFieldReference("Lsome/class;", "someMethod", "I"); when(((Instruction22c) instruction).getReference()).thenReturn(fieldRef); addressToLocation = new TIntObjectHashMap<MethodLocation>(); addressToLocation.put(ADDRESS, location); opFactory = new IGetOpFactory(); }
@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)); }
@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)); }