private Map<String, Capacity> clone(Map<String, Capacity> capacityMap) { if (capacityMap == null) return null; Map<String,Capacity> clone = new HashMap<String,Capacity>(capacityMap.size()); for (Map.Entry<String, Capacity> e : capacityMap.entrySet()) clone.put(e.getKey(), clone(e.getValue())); return clone; }
private Map<String, Capacity> add(Map<String, Capacity> from, Map<String, Capacity> to) { if (to == null) return clone(from); if (from != null) { for (Map.Entry<String, Capacity> entryFrom : from.entrySet()) { final String key = entryFrom.getKey(); final Capacity tocap = to.get(key); final Capacity fromcap = entryFrom.getValue(); if (tocap == null) { to.put(key, clone(fromcap)); } else { to.put(key, new Capacity().withCapacityUnits( doubleOf(tocap) + doubleOf(fromcap))); } } } return to; }
accumulatedConsumedCapacity.setCapacityUnits(consumedCapacity.getCapacityUnits()); accumulatedConsumedCapacity.setGlobalSecondaryIndexes( clone(consumedCapacity.getGlobalSecondaryIndexes())); accumulatedConsumedCapacity.setLocalSecondaryIndexes( clone(consumedCapacity.getLocalSecondaryIndexes())); accumulatedConsumedCapacity.setTable(clone(consumedCapacity.getTable())); accumulatedConsumedCapacity.setTableName(consumedCapacity.getTableName()); } else { if (gsi == null) { accumulatedConsumedCapacity.setGlobalSecondaryIndexes( clone(consumedCapacity.getGlobalSecondaryIndexes())); } else { accumulatedConsumedCapacity.setGlobalSecondaryIndexes(add( if (lsi == null) { accumulatedConsumedCapacity.setLocalSecondaryIndexes( clone(consumedCapacity.getLocalSecondaryIndexes())); } else { accumulatedConsumedCapacity.setLocalSecondaryIndexes(add( accumulatedConsumedCapacity.setTable(clone(consumedCapacity.getTable())); } else { accumulatedConsumedCapacity.setTable(add(consumedCapacity.getTable(),
private Map<String, Capacity> clone(Map<String, Capacity> capacityMap) { if (capacityMap == null) return null; Map<String,Capacity> clone = new HashMap<String,Capacity>(capacityMap.size()); for (Map.Entry<String, Capacity> e : capacityMap.entrySet()) clone.put(e.getKey(), clone(e.getValue())); return clone; }
private Map<String, Capacity> add(Map<String, Capacity> from, Map<String, Capacity> to) { if (to == null) return clone(from); if (from != null) { for (Map.Entry<String, Capacity> entryFrom : from.entrySet()) { final String key = entryFrom.getKey(); final Capacity tocap = to.get(key); final Capacity fromcap = entryFrom.getValue(); if (tocap == null) { to.put(key, clone(fromcap)); } else { to.put(key, new Capacity().withCapacityUnits( doubleOf(tocap) + doubleOf(fromcap))); } } } return to; }
accumulatedConsumedCapacity.setCapacityUnits(consumedCapacity.getCapacityUnits()); accumulatedConsumedCapacity.setGlobalSecondaryIndexes( clone(consumedCapacity.getGlobalSecondaryIndexes())); accumulatedConsumedCapacity.setLocalSecondaryIndexes( clone(consumedCapacity.getLocalSecondaryIndexes())); accumulatedConsumedCapacity.setTable(clone(consumedCapacity.getTable())); accumulatedConsumedCapacity.setTableName(consumedCapacity.getTableName()); } else { if (gsi == null) { accumulatedConsumedCapacity.setGlobalSecondaryIndexes( clone(consumedCapacity.getGlobalSecondaryIndexes())); } else { accumulatedConsumedCapacity.setGlobalSecondaryIndexes(add( if (lsi == null) { accumulatedConsumedCapacity.setLocalSecondaryIndexes( clone(consumedCapacity.getLocalSecondaryIndexes())); } else { accumulatedConsumedCapacity.setLocalSecondaryIndexes(add( accumulatedConsumedCapacity.setTable(clone(consumedCapacity.getTable())); } else { accumulatedConsumedCapacity.setTable(add(consumedCapacity.getTable(),