public void put(K key, V value) { V oldValue = _map.put(key, value); if (oldValue != null && _map.removalPolicy != null) _map.removalPolicy.onElementRemoved(key, oldValue); }
public void remove(K key) { V value = _map.remove(key); if (_map.removalPolicy != null) _map.removalPolicy.onElementRemoved(key, value); }
@Override public TypeDescriptor getAcceptedTypeDescriptor () { return new TypeDescriptor(List.class, new TypeDescriptor(Pair.class, new TypeDescriptor(String.class), new TypeDescriptor(Double.class))); }
public void clear() { if (_map.removalPolicy != null) { for (Entry<K, V> entry : _map.entrySet()) { _map.removalPolicy.onElementRemoved(entry.getKey(), entry.getValue()); } } _map.clear(); }
public static void assertJsonEqual (JSONArray expected, JSONArray actual) { List<Object> listE = JsonUtilities.jsonArrayToList(expected); List<Object> listA = JsonUtilities.jsonArrayToList(actual); assertEquals(listE, listA); }
public static void assertJsonEqual (JSONObject expected, JSONObject actual) { Map<String, Object> mapE = JsonUtilities.jsonObjToMap(expected); Map<String, Object> mapA = JsonUtilities.jsonObjToMap(actual); assertEquals(mapE, mapA); }
@Override protected CopyParameters create() throws ConfigurationException { return new CopyParameters( getPropertyValue(SOURCE_ID), getPropertyValue(DESTINATION_ID), getPropertyValue(INDICES), getPropertyValue(WIDTH), getPropertyValue(HEIGHT), getPropertyValue(MIN_LEVEL), getPropertyValue(MAX_LEVEL), getPropertyValue(BLOCK_SIZE) ); } }
public LRUCache(int size) { _size = size; _map = new LruRemovalHashMap(_size, 0.75f, true); }
/** * Uses the class member operator to perform the calculation. More operations can * be added here as needed. * * @param operand1 the first value to use in the calculation * @param operand2 the second value to use in the calculation * @return Number represents the result of the calculation */ public Number calculate(Number operand1, Number operand2) { return calculate(operand1, operand2, null); } }
public UnaryOperationTileView(UnaryOperator.OPERATOR_TYPE operation, TileData<List<T>> tileData, Number errorValue) { _op = new UnaryOperator(operation); _tileData = tileData; _errorValue = errorValue; }
/** * Apply the unary operation. * @param operand The unary operand. * @return The calculated value or the error value. */ public Number calculate(Number operand) { return calculate(operand, null); } }
@Override public synchronized void remove(K key) { super.remove(key); }
@Override public synchronized boolean containsKey(Object key) { return super.containsKey(key); }
@Override public synchronized void put(K key, V value) { super.put(key, value); }
@Override public synchronized int getCurrentSize() { return super.getCurrentSize(); }
@Override public synchronized void clear() { super.clear(); }
public V get (Object key) { return _map.get(key); }
public static TypeDescriptor getRuntimeTypeDescriptor () { return new TypeDescriptor(Map.class, new TypeDescriptor(String.class), new TypeDescriptor(List.class, new TypeDescriptor(Pair.class, new TypeDescriptor(String.class), new TypeDescriptor(Long.class)))); }
public LRUCache(int size, RemovalPolicy<K, V> removalPolicy) { _size = size; _map = new LruRemovalHashMap(_size, 0.75f, true, removalPolicy); }
public LRUCache() { _size = 250; _map = new LruRemovalHashMap(_size, 0.75f, true); }