Differential D8191 Diff 29562 java/src/main/java/org/softwareheritage/graph/SwhUnidirectionalGraph.java
Changeset View
Changeset View
Standalone View
Standalone View
java/src/main/java/org/softwareheritage/graph/SwhUnidirectionalGraph.java
Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | public static SwhUnidirectionalGraph loadLabelledOffline(String path, ProgressLogger pl) throws IOException { | ||||
return loadLabelled(LoadMethod.OFFLINE, path, null, pl); | return loadLabelled(LoadMethod.OFFLINE, path, null, pl); | ||||
} | } | ||||
public static SwhUnidirectionalGraph loadLabelledOffline(String path) throws IOException { | public static SwhUnidirectionalGraph loadLabelledOffline(String path) throws IOException { | ||||
return loadLabelled(LoadMethod.OFFLINE, path, null, null); | return loadLabelled(LoadMethod.OFFLINE, path, null, null); | ||||
} | } | ||||
@Override | @Override | ||||
public SwhUnidirectionalGraph copy() { | public SwhUnidirectionalGraph copy() { | ||||
return new SwhUnidirectionalGraph(this.graph.copy(), | return new SwhUnidirectionalGraph(this.graph.copy(), | ||||
this.labelledGraph != null ? this.labelledGraph.copy() : null, this.properties); | this.labelledGraph != null ? this.labelledGraph.copy() : null, this.properties.copy()); | ||||
JaredR26: I'm not sure it matters, but because this.graph can refer to the underlying graph of this. | |||||
} | } | ||||
@Override | @Override | ||||
public boolean randomAccess() { | public boolean randomAccess() { | ||||
return graph.randomAccess(); | return graph.randomAccess(); | ||||
} | } | ||||
public void close() throws IOException { | public void close() throws IOException { | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |
I'm not sure it matters, but because this.graph can refer to the underlying graph of this.labelledGraph (Line 71, inside loadLabelledGraphOnly), that would result in double-copying. (When you first wrote the copy function, we hadn't yet found the need to assign the underlying to graph) I'm sure it is low overhead, but would it be better to first copy this.labelledGraph and then assign g.g again if labelledGraph exists?