protected void checkTimeRepresentationInterval() { if (!getTimeRepresentation().equals(TimeRepresentation.INTERVAL)) { throw new RuntimeException("Can't use intervals as the configuration is set to " + getTimeRepresentation()); } }
protected void checkTimeRepresentationTimestamp() { if (!getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) { throw new RuntimeException("Can't use timestamps as the configuration is set to " + getTimeRepresentation()); } }
protected void checkTimeRepresentationTimestamp() { if (!getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) { throw new RuntimeException("Can't use timestamps as the configuration is set to " + getTimeRepresentation()); } }
protected void checkTimeRepresentationInterval() { if (!getTimeRepresentation().equals(TimeRepresentation.INTERVAL)) { throw new RuntimeException("Can't use intervals as the configuration is set to " + getTimeRepresentation()); } }
.equals(other.timeRepresentation))) { return false;
.equals(other.timeRepresentation))) { return false;
private boolean checkTimerepresentationIsInterval() { if (!container.getTimeRepresentation().equals(TimeRepresentation.INTERVAL)) { report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_timerepresentation_intervalerror"), Issue.Level.SEVERE)); return false; } return true; }
private boolean checkTimerepresentationIsTimestamp() { if (!container.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) { report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_timerepresentation_timestamperror"), Issue.Level.SEVERE)); return false; } return true; }
private void copyEdgeWeight(EdgeImpl edge, Edge edgeCopy) { if (edge.hasDynamicWeight()) { TimeRepresentation tr = edge.graphStore.configuration.getTimeRepresentation(); if (tr.equals(TimeRepresentation.INTERVAL)) { for (Map.Entry<Interval, Double> entry : edge.getWeights()) { edgeCopy.setWeight(entry.getValue(), entry.getKey()); } } else if (tr.equals(TimeRepresentation.TIMESTAMP)) { for (Map.Entry<Double, Double> entry : edge.getWeights()) { edgeCopy.setWeight(entry.getValue(), entry.getKey()); } } } else { edgeCopy.setWeight(edge.getWeight()); } }
private void copyEdgeWeight(EdgeImpl edge, Edge edgeCopy) { if (edge.hasDynamicWeight()) { TimeRepresentation tr = edge.graphStore.configuration.getTimeRepresentation(); if (tr.equals(TimeRepresentation.INTERVAL)) { for (Map.Entry<Interval, Double> entry : edge.getWeights()) { edgeCopy.setWeight(entry.getValue(), entry.getKey()); } } else if (tr.equals(TimeRepresentation.TIMESTAMP)) { for (Map.Entry<Double, Double> entry : edge.getWeights()) { edgeCopy.setWeight(entry.getValue(), entry.getKey()); } } } else { edgeCopy.setWeight(edge.getWeight()); } }
@Override public void execute(GraphModel graphModel) { this.graphModel = graphModel; this.isDirected = graphModel.isDirected(); this.averages = new HashMap<>(); //Attributes cols if (!averageOnly) { TimeRepresentation tr = graphModel.getConfiguration().getTimeRepresentation(); Table nodeTable = graphModel.getNodeTable(); dynamicInDegreeColumn = nodeTable.getColumn(DYNAMIC_INDEGREE); dynamicOutDegreeColumn = nodeTable.getColumn(DYNAMIC_OUTDEGREE); dynamicDegreeColumn = nodeTable.getColumn(DYNAMIC_DEGREE); if (isDirected) { if (dynamicInDegreeColumn == null) { dynamicInDegreeColumn = nodeTable.addColumn(DYNAMIC_INDEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.InDegree"), tr.equals(TimeRepresentation.INTERVAL) ? IntervalIntegerMap.class : TimestampIntegerMap.class, null); } if (dynamicOutDegreeColumn == null) { dynamicOutDegreeColumn = nodeTable.addColumn(DYNAMIC_OUTDEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.OutDegree"), tr.equals(TimeRepresentation.INTERVAL) ? IntervalIntegerMap.class : TimestampIntegerMap.class, null); } } if (dynamicDegreeColumn == null) { dynamicDegreeColumn = nodeTable.addColumn(DYNAMIC_DEGREE, NbBundle.getMessage(DynamicDegree.class, "DynamicDegree.nodecolumn.Degree"), tr.equals(TimeRepresentation.INTERVAL) ? IntervalIntegerMap.class : TimestampIntegerMap.class, null); } } }
@Override public void execute(GraphModel graphModel) { this.graphModel = graphModel; this.isDirected = graphModel.isDirected(); this.averages = new HashMap<>(); //Attributes cols if (!averageOnly) { TimeRepresentation tr = graphModel.getConfiguration().getTimeRepresentation(); Table nodeTable = graphModel.getNodeTable(); dynamicCoefficientColumn = nodeTable.getColumn(DYNAMIC_CLUSTERING_COEFFICIENT); if (dynamicCoefficientColumn == null) { dynamicCoefficientColumn = nodeTable.addColumn(DYNAMIC_CLUSTERING_COEFFICIENT, NbBundle.getMessage(DynamicClusteringCoefficient.class, "DynamicClusteringCoefficient.nodecolumn.ClusteringCoefficient"), tr.equals(TimeRepresentation.INTERVAL) ? IntervalDoubleMap.class : TimestampDoubleMap.class, null); } } }
private void copyAttributes(TableImpl sourceTable, TableImpl destTable, Element element, Element elementCopy) { TimeRepresentation tr = sourceTable.store.configuration.getTimeRepresentation(); for (Column col : sourceTable.toArray()) { if (!col.isProperty()) { Column colCopy = destTable.getColumn(col.getId()); if (col.isDynamic() && tr.equals(TimeRepresentation.TIMESTAMP)) { for (Map.Entry<Double, Object> entry : element.getAttributes(col)) { Double key = entry.getKey(); Object value = entry.getValue(); elementCopy.setAttribute(colCopy, value, key); } } else if (col.isDynamic() && tr.equals(TimeRepresentation.INTERVAL)) { for (Map.Entry<Interval, Object> entry : element.getAttributes(col)) { Interval key = entry.getKey(); Object value = entry.getValue(); elementCopy.setAttribute(colCopy, value, key); } } else { Object attribute = element.getAttribute(col); elementCopy.setAttribute(colCopy, attribute); } } } }
private void copyAttributes(TableImpl sourceTable, TableImpl destTable, Element element, Element elementCopy) { TimeRepresentation tr = sourceTable.store.configuration.getTimeRepresentation(); for (Column col : sourceTable.toArray()) { if (!col.isProperty()) { Column colCopy = destTable.getColumn(col.getId()); if (col.isDynamic() && tr.equals(TimeRepresentation.TIMESTAMP)) { for (Map.Entry<Double, Object> entry : element.getAttributes(col)) { Double key = entry.getKey(); Object value = entry.getValue(); elementCopy.setAttribute(colCopy, value, key); } } else if (col.isDynamic() && tr.equals(TimeRepresentation.INTERVAL)) { for (Map.Entry<Interval, Object> entry : element.getAttributes(col)) { Interval key = entry.getKey(); Object value = entry.getValue(); elementCopy.setAttribute(colCopy, value, key); } } else { Object attribute = element.getAttribute(col); elementCopy.setAttribute(colCopy, attribute); } } } }
public TimeStore(GraphStore store, GraphLock graphLock, boolean indexed) { lock = graphLock; graphStore = store; TimeRepresentation timeRepresentation = GraphStoreConfiguration.DEFAULT_TIME_REPRESENTATION; if (store != null) { timeRepresentation = store.configuration.getTimeRepresentation(); } if (timeRepresentation.equals(TimeRepresentation.INTERVAL)) { nodeIndexStore = new IntervalIndexStore<Node>(Node.class, lock, indexed); edgeIndexStore = new IntervalIndexStore<Edge>(Edge.class, lock, indexed); } else { nodeIndexStore = new TimestampIndexStore<Node>(Node.class, lock, indexed); edgeIndexStore = new TimestampIndexStore<Edge>(Edge.class, lock, indexed); } }
public TimeStore(GraphStore store, GraphLock graphLock, boolean indexed) { lock = graphLock; graphStore = store; TimeRepresentation timeRepresentation = GraphStoreConfiguration.DEFAULT_TIME_REPRESENTATION; if (store != null) { timeRepresentation = store.configuration.getTimeRepresentation(); } if (timeRepresentation.equals(TimeRepresentation.INTERVAL)) { nodeIndexStore = new IntervalIndexStore<Node>(Node.class, lock, indexed); edgeIndexStore = new IntervalIndexStore<Edge>(Edge.class, lock, indexed); } else { nodeIndexStore = new TimestampIndexStore<Node>(Node.class, lock, indexed); edgeIndexStore = new TimestampIndexStore<Edge>(Edge.class, lock, indexed); } }
protected void resetConfiguration() { if (graphStore != null) { if (graphStore.configuration.getTimeRepresentation().equals(TimeRepresentation.INTERVAL)) { nodeIndexStore = new IntervalIndexStore<Node>(Node.class, lock, nodeIndexStore.hasIndex()); edgeIndexStore = new IntervalIndexStore<Edge>(Edge.class, lock, edgeIndexStore.hasIndex()); } else { nodeIndexStore = new TimestampIndexStore<Node>(Node.class, lock, nodeIndexStore.hasIndex()); edgeIndexStore = new TimestampIndexStore<Edge>(Edge.class, lock, edgeIndexStore.hasIndex()); } } }
private boolean evaluateElement(Element element) { if (timeRepresentation.equals(TimeRepresentation.INTERVAL)) { IntervalSet timeSet = (IntervalSet) element.getAttribute("timeset"); if (timeSet != null) { for (Interval i : timeSet.toArray()) { if (visibleInterval.compareTo(i) == 0) { return true; } } } else if (keepNull) { return true; } } else { TimestampSet timeSet = (TimestampSet) element.getAttribute("timeset"); if (timeSet != null) { for (double t : timeSet.toPrimitiveArray()) { if (visibleInterval.compareTo(t) == 0) { return true; } } } else if (keepNull) { return true; } } return false; }
protected void resetConfiguration() { if (graphStore != null) { if (graphStore.configuration.getTimeRepresentation().equals(TimeRepresentation.INTERVAL)) { nodeIndexStore = new IntervalIndexStore<Node>(Node.class, lock, nodeIndexStore.hasIndex()); edgeIndexStore = new IntervalIndexStore<Edge>(Edge.class, lock, edgeIndexStore.hasIndex()); } else { nodeIndexStore = new TimestampIndexStore<Node>(Node.class, lock, nodeIndexStore.hasIndex()); edgeIndexStore = new TimestampIndexStore<Edge>(Edge.class, lock, edgeIndexStore.hasIndex()); } } }
if (configuration.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) { nodeTable.store.addColumn(new ColumnImpl(nodeTable, GraphStoreConfiguration.ELEMENT_TIMESET_COLUMN_ID, TimestampSet.class, "Timestamp", null, Origin.PROPERTY, false, false));