diff --git a/.vscode/settings.json b/.vscode/settings.json index afcce44522..e9bbfa256f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "java.configuration.updateBuildConfiguration": "interactive", "[java]": { - "editor.defaultFormatter": "redhat.java", + "editor.defaultFormatter": "serikb.google-java-format", "editor.formatOnSave": true, }, "java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml", diff --git a/pom.xml b/pom.xml index 964f6accb8..9f429523e2 100644 --- a/pom.xml +++ b/pom.xml @@ -61,6 +61,11 @@ commons-lang 2.6 + + com.google.code.gson + gson + 2.10.1 + org.apache.commons commons-math3 diff --git a/src/main/java/neqsim/processSimulation/util/monitor/CompressorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/CompressorResponse.java index 15adb97bac..b419db7cec 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/CompressorResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/CompressorResponse.java @@ -8,7 +8,7 @@ * @author asmund * @version $Id: $Id */ -public class CompressorResponse { +public class CompressorResponse extends Response{ public String name = "test"; public Double suctionTemperature; diff --git a/src/main/java/neqsim/processSimulation/util/monitor/HXResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/HXResponse.java index e1baa98547..070ffb37c3 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/HXResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/HXResponse.java @@ -10,7 +10,7 @@ * @author asmund * @version $Id: $Id */ -public class HXResponse { +public class HXResponse extends Response{ public String name = "test"; public Double feedTemperature1; diff --git a/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java index fde87bc08a..b00fcfbb29 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java @@ -10,7 +10,7 @@ * @author asmund * @version $Id: $Id */ -public class HeaterResponse { +public class HeaterResponse extends Response{ public String name = "test"; public Double feedTemperature; diff --git a/src/main/java/neqsim/processSimulation/util/monitor/MPMResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/MPMResponse.java index 5883a19b24..3b4dc329ad 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/MPMResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/MPMResponse.java @@ -10,7 +10,7 @@ * @author asmund * @version $Id: $Id */ -public class MPMResponse { +public class MPMResponse extends Response{ public String name; public Double massFLow, GOR, GOR_std, gasDensity, oilDensity, waterDensity; diff --git a/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java index 6778269202..b9fbaa0bcf 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java @@ -10,7 +10,7 @@ * @author asmund * @version $Id: $Id */ -public class PumpResponse { +public class PumpResponse extends Response{ public String name = "test"; public Double suctionTemperature; diff --git a/src/main/java/neqsim/processSimulation/util/monitor/Response.java b/src/main/java/neqsim/processSimulation/util/monitor/Response.java new file mode 100644 index 0000000000..f64a5eca7f --- /dev/null +++ b/src/main/java/neqsim/processSimulation/util/monitor/Response.java @@ -0,0 +1,16 @@ +package neqsim.processSimulation.util.monitor; + +import java.util.HashMap; +import java.util.Map; +import neqsim.thermo.system.SystemInterface; +import neqsim.util.NamedBaseClass; +import com.google.gson.Gson; + +public class Response { + + public String toJson() throws Exception { + Gson gson = new Gson(); + return gson.toJson(this); + } + +} \ No newline at end of file diff --git a/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java index 756230a71b..27c9f6e405 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java @@ -11,7 +11,7 @@ * @author asmund * @version $Id: $Id */ -public class SeparatorResponse { +public class SeparatorResponse extends Response{ public String name; public Double gasLoadFactor; public Double massflow; diff --git a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java index 113f470538..ba2fb4a888 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java @@ -8,7 +8,7 @@ * @author asmund * @version $Id: $Id */ -public class StreamResponse { +public class StreamResponse extends Response{ public String name; public Fluid fluid; public Double temperature; diff --git a/src/main/java/neqsim/processSimulation/util/monitor/ThreePhaseSeparatorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/ThreePhaseSeparatorResponse.java index abf3b83352..71863d7249 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/ThreePhaseSeparatorResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/ThreePhaseSeparatorResponse.java @@ -11,7 +11,7 @@ * @author asmund * @version $Id: $Id */ -public class ThreePhaseSeparatorResponse { +public class ThreePhaseSeparatorResponse extends Response{ public String name; public Double gasLoadFactor; public Double massflow; diff --git a/src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java index 38ee830b4d..e1a93888e2 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java @@ -10,7 +10,7 @@ * @author asmund * @version $Id: $Id */ -public class WellAllocatorResponse { +public class WellAllocatorResponse extends Response{ public String name; public Double gasExportRate, oilExportRate, totalExportRate;