final void checkWeightStaticType() { if (graphStore != null && !Double.class.equals(graphStore.configuration.getEdgeWeightType())) { throw new IllegalArgumentException( "The weight class does not match with the expected type (" + graphStore.configuration .getEdgeWeightType().getName() + ")"); } }
@Override public boolean hasDynamicWeight() { return !Double.class.equals(graphStore.configuration.getEdgeWeightType()); }
@Override public boolean hasDynamicWeight() { return !Double.class.equals(graphStore.configuration.getEdgeWeightType()); }
final void checkWeightDynamicType() { if (graphStore != null && Double.class.equals(graphStore.configuration.getEdgeWeightType())) { throw new IllegalArgumentException( "The weight class does not match with the expected type (" + graphStore.configuration .getEdgeWeightType().getName() + ")"); } }
final void checkWeightDynamicType() { if (graphStore != null && Double.class.equals(graphStore.configuration.getEdgeWeightType())) { throw new IllegalArgumentException( "The weight class does not match with the expected type (" + graphStore.configuration .getEdgeWeightType().getName() + ")"); } }
final void checkWeightStaticType() { if (graphStore != null && !Double.class.equals(graphStore.configuration.getEdgeWeightType())) { throw new IllegalArgumentException( "The weight class does not match with the expected type (" + graphStore.configuration .getEdgeWeightType().getName() + ")"); } }
private void checkValidConfiguration(Configuration config) { Class edgeWeightType = config.getEdgeWeightType(); if (edgeWeightType.equals(Double.class)) { return;// Double is always allowed } switch (config.getTimeRepresentation()) { case INTERVAL: if (!edgeWeightType.equals(IntervalDoubleMap.class)) { throw new IllegalArgumentException( "Edge weight type should be Double or IntervalDoubleMap for INTERVAL TimeRepresentation"); } break; case TIMESTAMP: if (!edgeWeightType.equals(TimestampDoubleMap.class)) { throw new IllegalArgumentException( "Edge weight type should be Double or TimestampDoubleMap for TIMESTAMP TimeRepresentation"); } break; } } }
private void checkValidConfiguration(Configuration config) { Class edgeWeightType = config.getEdgeWeightType(); if (edgeWeightType.equals(Double.class)) { return;// Double is always allowed } switch (config.getTimeRepresentation()) { case INTERVAL: if (!edgeWeightType.equals(IntervalDoubleMap.class)) { throw new IllegalArgumentException( "Edge weight type should be Double or IntervalDoubleMap for INTERVAL TimeRepresentation"); } break; case TIMESTAMP: if (!edgeWeightType.equals(TimestampDoubleMap.class)) { throw new IllegalArgumentException( "Edge weight type should be Double or TimestampDoubleMap for TIMESTAMP TimeRepresentation"); } break; } } }
public EdgeImpl(Object id, GraphStore graphStore, NodeImpl source, NodeImpl target, int type, double weight, boolean directed) { super(id, graphStore); checkIdType(id); this.source = source; this.target = target; this.flags = (byte) (directed ? 1 : 0); this.type = type; this.properties = GraphStoreConfiguration.ENABLE_EDGE_PROPERTIES ? new EdgePropertiesImpl() : null; this.attributes = new Object[GraphStoreConfiguration.EDGE_WEIGHT_INDEX + 1]; this.attributes[GraphStoreConfiguration.ELEMENT_ID_INDEX] = id; if (graphStore == null || graphStore.configuration.getEdgeWeightType().equals(Double.class)) { this.attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX] = weight; } }
public EdgeImpl(Object id, GraphStore graphStore, NodeImpl source, NodeImpl target, int type, double weight, boolean directed) { super(id, graphStore); checkIdType(id); this.source = source; this.target = target; this.flags = (byte) (directed ? 1 : 0); this.type = type; this.properties = GraphStoreConfiguration.ENABLE_EDGE_PROPERTIES ? new EdgePropertiesImpl() : null; this.attributes = new Object[GraphStoreConfiguration.EDGE_WEIGHT_INDEX + 1]; this.attributes[GraphStoreConfiguration.ELEMENT_ID_INDEX] = id; if (graphStore == null || graphStore.configuration.getEdgeWeightType().equals(Double.class)) { this.attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX] = weight; } }
private void setTimeWeight(double weight, Object timeObject) { checkWeightDynamicType(); boolean res; synchronized (this) { Object oldValue = attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX]; TimeMap dynamicValue = null; if (oldValue == null) { try { attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX] = dynamicValue = (TimeMap) graphStore.configuration .getEdgeWeightType().newInstance(); } catch (InstantiationException ex) { throw new RuntimeException(ex); } catch (IllegalAccessException ex) { throw new RuntimeException(ex); } } else { dynamicValue = (TimeMap) oldValue; } res = dynamicValue.put(timeObject, weight); } TimeIndexStore timeIndexStore = getTimeIndexStore(); if (res && timeIndexStore != null && isValid()) { timeIndexStore.add(timeObject); } ColumnStore columnStore = getColumnStore(); if (res && columnStore != null && isValid()) { Column column = columnStore.getColumnByIndex(GraphStoreConfiguration.EDGE_WEIGHT_INDEX); ((ColumnImpl) column).incrementVersion(this); } }
private void setTimeWeight(double weight, Object timeObject) { checkWeightDynamicType(); boolean res; synchronized (this) { Object oldValue = attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX]; TimeMap dynamicValue = null; if (oldValue == null) { try { attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX] = dynamicValue = (TimeMap) graphStore.configuration .getEdgeWeightType().newInstance(); } catch (InstantiationException ex) { throw new RuntimeException(ex); } catch (IllegalAccessException ex) { throw new RuntimeException(ex); } } else { dynamicValue = (TimeMap) oldValue; } res = dynamicValue.put(timeObject, weight); } TimeIndexStore timeIndexStore = getTimeIndexStore(); if (res && timeIndexStore != null && isValid()) { timeIndexStore.add(timeObject); } ColumnStore columnStore = getColumnStore(); if (res && columnStore != null && isValid()) { Column column = columnStore.getColumnByIndex(GraphStoreConfiguration.EDGE_WEIGHT_INDEX); ((ColumnImpl) column).incrementVersion(this); } }
private void serializeConfiguration(final DataOutput out) throws IOException { Configuration config = model.store.configuration; serialize(out, config.getNodeIdType()); serialize(out, config.getEdgeIdType()); serialize(out, config.getEdgeLabelType()); serialize(out, config.getEdgeWeightType()); serialize(out, config.getTimeRepresentation()); serialize(out, config.getEdgeWeightColumn()); }
private void serializeConfiguration(final DataOutput out) throws IOException { Configuration config = model.store.configuration; serialize(out, config.getNodeIdType()); serialize(out, config.getEdgeIdType()); serialize(out, config.getEdgeLabelType()); serialize(out, config.getEdgeWeightType()); serialize(out, config.getTimeRepresentation()); serialize(out, config.getEdgeWeightColumn()); }
.intToShort(GraphStoreConfiguration.EDGE_WEIGHT_INDEX)); edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID, config.getEdgeWeightType(), "Weight", null, Origin.PROPERTY, false, false)); } else { edgeTable.removeColumn(GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID); if (!config.getEdgeWeightType().equals(configuration.getEdgeWeightType())) { TableImpl<Edge> edgeTable = store.edgeTable; Class newWeightType = config.getEdgeWeightType(); if (config.getEdgeWeightColumn()) { edgeTable.removeColumn(GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID);
.intToShort(GraphStoreConfiguration.EDGE_WEIGHT_INDEX)); edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID, config.getEdgeWeightType(), "Weight", null, Origin.PROPERTY, false, false)); } else { edgeTable.removeColumn(GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID); if (!config.getEdgeWeightType().equals(configuration.getEdgeWeightType())) { TableImpl<Edge> edgeTable = store.edgeTable; Class newWeightType = config.getEdgeWeightType(); if (config.getEdgeWeightColumn()) { edgeTable.removeColumn(GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID);
configuration.getEdgeWeightType(), "Weight", null, Origin.PROPERTY, false, false)); } else { edgeTable.store.length++;
configuration.getEdgeWeightType(), "Weight", null, Origin.PROPERTY, false, false)); } else { edgeTable.store.length++;