@Override public Iterable<Map.Entry> getWeights() { synchronized (this) { Object weightValue = attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX]; if (weightValue instanceof Double) { throw new IllegalStateException("The weight is static, call getWeight() instead"); } TimeMap dynamicValue = (TimeMap) weightValue; Object[] values = dynamicValue.toValuesArray(); if (dynamicValue instanceof TimestampMap) { return new TimeAttributeIterable(((TimestampMap) dynamicValue).getTimestamps(), values); } else if (dynamicValue instanceof IntervalMap) { return new TimeAttributeIterable(((IntervalMap) dynamicValue).toKeysArray(), values); } } return TimeAttributeIterable.EMPTY_ITERABLE; }
@Override public Iterable<Map.Entry> getWeights() { synchronized (this) { Object weightValue = attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX]; if (weightValue instanceof Double) { throw new IllegalStateException("The weight is static, call getWeight() instead"); } TimeMap dynamicValue = (TimeMap) weightValue; Object[] values = dynamicValue.toValuesArray(); if (dynamicValue instanceof TimestampMap) { return new TimeAttributeIterable(((TimestampMap) dynamicValue).getTimestamps(), values); } else if (dynamicValue instanceof IntervalMap) { return new TimeAttributeIterable(((IntervalMap) dynamicValue).toKeysArray(), values); } } return TimeAttributeIterable.EMPTY_ITERABLE; }
private void serializeTimestampMap(final DataOutput out, final TimestampMap timestampMap) throws IOException { serialize(out, timestampMap.getTimestamps()); Class mapClass = timestampMap.getClass(); if (mapClass.equals(TimestampBooleanMap.class)) { serialize(out, ((TimestampBooleanMap) timestampMap).toBooleanArray()); } else if (mapClass.equals(TimestampByteMap.class)) { serialize(out, ((TimestampByteMap) timestampMap).toByteArray()); } else if (mapClass.equals(TimestampCharMap.class)) { serialize(out, ((TimestampCharMap) timestampMap).toCharacterArray()); } else if (mapClass.equals(TimestampDoubleMap.class)) { serialize(out, ((TimestampDoubleMap) timestampMap).toDoubleArray()); } else if (mapClass.equals(TimestampFloatMap.class)) { serialize(out, ((TimestampFloatMap) timestampMap).toFloatArray()); } else if (mapClass.equals(TimestampIntegerMap.class)) { serialize(out, ((TimestampIntegerMap) timestampMap).toIntegerArray()); } else if (mapClass.equals(TimestampLongMap.class)) { serialize(out, ((TimestampLongMap) timestampMap).toLongArray()); } else if (mapClass.equals(TimestampShortMap.class)) { serialize(out, ((TimestampShortMap) timestampMap).toShortArray()); } else if (mapClass.equals(TimestampStringMap.class)) { serialize(out, timestampMap.toValuesArray()); } else { throw new RuntimeException("Unrecognized timestamp map class"); } }
private void serializeTimestampMap(final DataOutput out, final TimestampMap timestampMap) throws IOException { serialize(out, timestampMap.getTimestamps()); Class mapClass = timestampMap.getClass(); if (mapClass.equals(TimestampBooleanMap.class)) { serialize(out, ((TimestampBooleanMap) timestampMap).toBooleanArray()); } else if (mapClass.equals(TimestampByteMap.class)) { serialize(out, ((TimestampByteMap) timestampMap).toByteArray()); } else if (mapClass.equals(TimestampCharMap.class)) { serialize(out, ((TimestampCharMap) timestampMap).toCharacterArray()); } else if (mapClass.equals(TimestampDoubleMap.class)) { serialize(out, ((TimestampDoubleMap) timestampMap).toDoubleArray()); } else if (mapClass.equals(TimestampFloatMap.class)) { serialize(out, ((TimestampFloatMap) timestampMap).toFloatArray()); } else if (mapClass.equals(TimestampIntegerMap.class)) { serialize(out, ((TimestampIntegerMap) timestampMap).toIntegerArray()); } else if (mapClass.equals(TimestampLongMap.class)) { serialize(out, ((TimestampLongMap) timestampMap).toLongArray()); } else if (mapClass.equals(TimestampShortMap.class)) { serialize(out, ((TimestampShortMap) timestampMap).toShortArray()); } else if (mapClass.equals(TimestampStringMap.class)) { serialize(out, timestampMap.toValuesArray()); } else { throw new RuntimeException("Unrecognized timestamp map class"); } }
@Override public Iterable<Map.Entry> getAttributes(Column column) { checkColumn(column); checkColumnDynamic(column); int index = column.getIndex(); TimeMap dynamicValue = null; synchronized (this) { if (index < attributes.length) { dynamicValue = (TimeMap) attributes[index]; } if (dynamicValue != null) { Object[] values = dynamicValue.toValuesArray(); if (dynamicValue instanceof TimestampMap) { return new TimeAttributeIterable(((TimestampMap) dynamicValue).getTimestamps(), values); } else if (dynamicValue instanceof IntervalMap) { return new TimeAttributeIterable(((IntervalMap) dynamicValue).toKeysArray(), values); } } } return TimeAttributeIterable.EMPTY_ITERABLE; }
@Override public Iterable<Map.Entry> getAttributes(Column column) { checkColumn(column); checkColumnDynamic(column); int index = column.getIndex(); TimeMap dynamicValue = null; synchronized (this) { if (index < attributes.length) { dynamicValue = (TimeMap) attributes[index]; } if (dynamicValue != null) { Object[] values = dynamicValue.toValuesArray(); if (dynamicValue instanceof TimestampMap) { return new TimeAttributeIterable(((TimestampMap) dynamicValue).getTimestamps(), values); } else if (dynamicValue instanceof IntervalMap) { return new TimeAttributeIterable(((IntervalMap) dynamicValue).toKeysArray(), values); } } } return TimeAttributeIterable.EMPTY_ITERABLE; }