From ed5766b09cf7eeb2d124b17685ba607c7daf3594 Mon Sep 17 00:00:00 2001 From: Nees Jan van Eck <36573334+neesjanvaneck@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:12:12 +0200 Subject: [PATCH] Bump networkanalysis from 1.2.0 to 1.3.0 --- build.gradle | 2 +- .../run/DatabaseIO.java | 24 +++++++++++-------- .../publicationclassification/run/FileIO.java | 23 +++++++++--------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index 2f35cca..ec4753c 100644 --- a/build.gradle +++ b/build.gradle @@ -14,8 +14,8 @@ repositories { } dependencies { + implementation group: 'nl.cwts', name: 'networkanalysis', version: '1.3.0' implementation group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '12.2.0.jre8' - implementation group: 'nl.cwts', name: 'networkanalysis', version: '1.2.0' } java { diff --git a/src/main/java/nl/cwts/publicationclassification/run/DatabaseIO.java b/src/main/java/nl/cwts/publicationclassification/run/DatabaseIO.java index 0291cc2..9a8cbd1 100644 --- a/src/main/java/nl/cwts/publicationclassification/run/DatabaseIO.java +++ b/src/main/java/nl/cwts/publicationclassification/run/DatabaseIO.java @@ -8,6 +8,8 @@ import java.sql.Statement; import nl.cwts.networkanalysis.Network; +import nl.cwts.util.LargeDoubleArray; +import nl.cwts.util.LargeIntArray; public class DatabaseIO { @@ -25,8 +27,8 @@ public class DatabaseIO public static Network readNetwork(String server, String database, String pubTable, String citLinkTable) { double[] pubWeight = null; - int[][] citLink = null; - double[] citLinkWeight = null; + LargeIntArray[] citLink = null; + LargeDoubleArray citLinkWeight = null; Connection connection = null; try @@ -57,23 +59,25 @@ public static Network readNetwork(String server, String database, String pubTabl // Read number of citation links. statement = connection.createStatement(); - resultSet = statement.executeQuery("select count(*) from " + citLinkTable); + resultSet = statement.executeQuery("select count_big(*) from " + citLinkTable); resultSet.next(); - int nCitLinks = resultSet.getInt(1); + long nCitLinks = resultSet.getLong(1); statement.close(); - citLink = new int[2][nCitLinks]; - citLinkWeight = new double[nCitLinks]; + citLink = new LargeIntArray[2]; + citLink[0] = new LargeIntArray(nCitLinks); + citLink[1] = new LargeIntArray(nCitLinks); + citLinkWeight = new LargeDoubleArray(nCitLinks); // Read citation links. statement = connection.createStatement(); resultSet = statement.executeQuery("select pub_no1, pub_no2, cit_weight from " + citLinkTable + " order by pub_no1, pub_no2"); - for (int i = 0; i < nCitLinks; i++) + for (long i = 0; i < nCitLinks; i++) { resultSet.next(); - citLink[0][i] = resultSet.getInt(1); - citLink[1][i] = resultSet.getInt(2); - citLinkWeight[i] = resultSet.getDouble(3); + citLink[0].set(i, resultSet.getInt(1)); + citLink[1].set(i, resultSet.getInt(2)); + citLinkWeight.set(i, resultSet.getDouble(3)); } statement.close(); diff --git a/src/main/java/nl/cwts/publicationclassification/run/FileIO.java b/src/main/java/nl/cwts/publicationclassification/run/FileIO.java index 28209a3..3c3c440 100644 --- a/src/main/java/nl/cwts/publicationclassification/run/FileIO.java +++ b/src/main/java/nl/cwts/publicationclassification/run/FileIO.java @@ -8,8 +8,8 @@ import java.io.IOException; import nl.cwts.networkanalysis.Network; -import nl.cwts.util.DynamicDoubleArray; -import nl.cwts.util.DynamicIntArray; +import nl.cwts.util.LargeDoubleArray; +import nl.cwts.util.LargeIntArray; public class FileIO { @@ -29,11 +29,15 @@ public class FileIO */ public static Network readNetwork(String pubFile, String citLinkFile) { - DynamicDoubleArray pubWeight = new DynamicDoubleArray(100); - DynamicIntArray[] citLink = new DynamicIntArray[2]; - citLink[0] = new DynamicIntArray(100); - citLink[1] = new DynamicIntArray(100); - DynamicDoubleArray citLinkWeight = new DynamicDoubleArray(100); + LargeDoubleArray pubWeight = new LargeDoubleArray(0); + pubWeight.ensureCapacity(100); + LargeIntArray[] citLink = new LargeIntArray[2]; + citLink[0] = new LargeIntArray(0); + citLink[0].ensureCapacity(100); + citLink[1] = new LargeIntArray(0); + citLink[1].ensureCapacity(100); + LargeDoubleArray citLinkWeight = new LargeDoubleArray(0); + citLinkWeight.ensureCapacity(100); BufferedReader reader = null; // Read publications file. @@ -153,12 +157,9 @@ public static Network readNetwork(String pubFile, String citLinkFile) // Create citation network. Network citNetwork = null; - int[][] citLink2 = new int[2][]; - citLink2[0] = citLink[0].toArray(); - citLink2[1] = citLink[1].toArray(); try { - citNetwork = new Network(pubWeight.toArray(), citLink2, citLinkWeight.toArray(), true, true); + citNetwork = new Network(pubWeight.toArray(), citLink, citLinkWeight, true, true); } catch (IllegalArgumentException e) {