Skip to content

Commit

Permalink
refact: inherit name from namedbaseclass (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil authored Feb 28, 2022
1 parent d3d6a38 commit c189e78
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import neqsim.thermo.component.ComponentInterface;
import neqsim.thermo.phase.PhaseInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.util.NamedBaseClass;

/**
* <p>
Expand All @@ -18,11 +19,11 @@
* @author Even Solbraa
* @version $Id: $Id
*/
public class ChemicalReaction implements neqsim.thermo.ThermodynamicConstantsInterface {
public class ChemicalReaction extends NamedBaseClass
implements neqsim.thermo.ThermodynamicConstantsInterface {
private static final long serialVersionUID = 1000;

String[] names, reactantNames, productNames;
String name;
double[] stocCoefs = new double[4];
double[] reacCoefs, prodCoefs, moles;
boolean shiftSignK = false;
Expand All @@ -35,8 +36,15 @@ public class ChemicalReaction implements neqsim.thermo.ThermodynamicConstantsInt
* <p>
* Constructor for ChemicalReaction.
* </p>
*
* @deprecated use
* {@link #ChemicalReaction(String, String[], double[], double[], double, double, double)}
* instead
*/
public ChemicalReaction() {}
@Deprecated
public ChemicalReaction() {
super("ChemicalReaction");
}

/**
* <p>
Expand All @@ -57,7 +65,7 @@ public ChemicalReaction(String name, String[] names, double[] stocCoefs, double[
* this.names = names; this.stocCoefs = stocCoefs; this.K = K;
*
*/
this.name = name;
super(name);
this.names = new String[names.length];
this.moles = new double[names.length];
this.stocCoefs = new double[stocCoefs.length];
Expand Down Expand Up @@ -486,22 +494,4 @@ public void setK(double[] k) {
public void setK(int i, double Kd) {
this.K[i] = Kd;
}

/**
* Getter for property name.
*
* @return Value of property name.
*/
public java.lang.String getName() {
return name;
}

/**
* Setter for property name.
*
* @param name New value of property name.
*/
public void setName(java.lang.String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
package neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings;

import neqsim.util.NamedBaseClass;

/**
* <p>
* Packing class.
Expand All @@ -13,16 +15,18 @@
* @author esol
* @version $Id: $Id
*/
public class Packing implements PackingInterface {
public class Packing extends NamedBaseClass implements PackingInterface {
double voidFractionPacking = 0.951, size = 0, surfaceAreaPrVolume = 112.6;
String name = null;

/**
* <p>
* Constructor for Packing.
* </p>
*/
public Packing() {}
@Deprecated
public Packing() {
super("Packing");
}

/**
* <p>
Expand All @@ -32,7 +36,7 @@ public Packing() {}
* @param name a {@link java.lang.String} object
*/
public Packing(String name) {
this.name = name;
super(name);
try {
System.out.println("init packing");
neqsim.util.database.NeqSimDataBase database =
Expand Down Expand Up @@ -62,7 +66,7 @@ public Packing(String name) {
* @param size a int
*/
public Packing(String name, String material, int size) {
this.name = name;
super(name);
try {
System.out.println("init packing");
neqsim.util.database.NeqSimDataBase database =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public class PallRingPacking extends Packing {
* Constructor for PallRingPacking.
* </p>
*/
@Deprecated
public PallRingPacking() {
super();
super("PallRingPacking");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public class RachigRingPacking extends Packing {
* Constructor for RachigRingPacking.
* </p>
*/
public RachigRingPacking() {}
@Deprecated
public RachigRingPacking() {
super("RachigRingPacking");
}

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
import neqsim.util.NamedBaseClass;

/**
* <p>
Expand All @@ -12,19 +13,23 @@
* @author asmund
* @version $Id: $Id
*/
public class Well implements java.io.Serializable {
public class Well extends NamedBaseClass {
private static final long serialVersionUID = 1000;

private StreamInterface stream = null;
private String name;
double x, y, z;

/**
* <p>
* Constructor for Well.
* </p>
*
* @deprecated use {@link #Well(String)} instead
*/
public Well() {}
@Deprecated
public Well() {
this("Well");
}

/**
* <p>
Expand All @@ -34,7 +39,7 @@ public Well() {}
* @param name a {@link java.lang.String} object
*/
public Well(String name) {
this.setName(name);
super(name);
}

/**
Expand Down Expand Up @@ -120,26 +125,4 @@ public double getStdOilProduction() {
}
return volume;
}

/**
* <p>
* Getter for the field <code>name</code>.
* </p>
*
* @return a {@link java.lang.String} object
*/
public String getName() {
return name;
}

/**
* <p>
* Setter for the field <code>name</code>.
* </p>
*
* @param name a {@link java.lang.String} object
*/
public void setName(String name) {
this.name = name;
}
}
33 changes: 25 additions & 8 deletions src/main/java/neqsim/processSimulation/util/monitor/Fluid.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.HashMap;
import java.util.Map;
import neqsim.thermo.system.SystemInterface;
import neqsim.util.NamedBaseClass;

/**
* <p>
Expand All @@ -12,9 +13,7 @@
* @author asmund
* @version $Id: $Id
*/
public class Fluid {
public String name;

public class Fluid extends NamedBaseClass {
public Double volumeFlow;
public Double molarMass;
public Double massDensity;
Expand All @@ -30,23 +29,41 @@ public class Fluid {
* Constructor for Fluid.
* </p>
*/
@Deprecated
public Fluid() {
this.definedComponent = new HashMap<>();
this.oilComponent = new HashMap<>();
this("Fluid");
}

/**
* <p>
* Constructor for Fluid.
* Constructor for Fluid. Sets name of inputFluid as name.
* </p>
*
*
* @param inputFluid a {@link neqsim.thermo.system.SystemInterface} object
*/
public Fluid(SystemInterface inputFluid) {
this(inputFluid.getFluidName(), inputFluid);
}

/**
* Constructor for Fluid.
*
* @param name
*/
public Fluid(String name) {
super(name);
this.definedComponent = new HashMap<>();
this.oilComponent = new HashMap<>();
}

name = inputFluid.getFluidName();
/**
* Constructor for Fluid.
*
* @param name
* @param inputFluid
*/
public Fluid(String name, SystemInterface inputFluid) {
this(name);

for (int i = 0; i < inputFluid.getNumberOfComponents(); i++) {
compProp = new HashMap<>();
Expand Down
52 changes: 33 additions & 19 deletions src/main/java/neqsim/standards/Standard.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import neqsim.standards.salesContract.ContractInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
import neqsim.util.NamedBaseClass;

/**
* <p>
Expand All @@ -26,16 +27,22 @@
* @author ESOL
* @version $Id: $Id
*/
public abstract class Standard implements StandardInterface {
protected String name = "Base Standard";
public abstract class Standard extends NamedBaseClass implements StandardInterface {
protected String standardDescription = "Base Description";
protected ContractInterface salesContract = new BaseContract();
protected String[][] resultTable = null;
protected SystemInterface thermoSystem;
protected ThermodynamicOperations thermoOps;
private String referenceState = "real"; // "ideal"real

public Standard() {}
/**
* Constructor for Standard.
*
*/
@Deprecated
public Standard() {
super("Base Standard");
}

/**
* <p>
Expand All @@ -44,8 +51,30 @@ public Standard() {}
*
* @param thermoSyst a {@link neqsim.thermo.system.SystemInterface} object
*/
@Deprecated
public Standard(SystemInterface thermoSyst) {
thermoSystem = thermoSyst;
this("Base Standard", thermoSyst);
}

/**
* Constructor for Standard.
*
* @param name
*
*/
public Standard(String name) {
super(name);
}

/**
* Constructor for Standard.
*
* @param name
* @param thermoSyst
*/
public Standard(String name, SystemInterface thermoSyst) {
super(name);
setThermoSystem(thermoSyst);
}

/** {@inheritDoc} */
Expand Down Expand Up @@ -80,21 +109,6 @@ public ContractInterface getSalesContract() {
return salesContract;
}

/** {@inheritDoc} */
@Override
public String getName() {
return name;
}

/**
* Setter for property name.
*
* @param name New value of property name.
*/
public void setName(String name) {
this.name = name;
}

/** {@inheritDoc} */
@Override
public String getStandardDescription() {
Expand Down
Loading

0 comments on commit c189e78

Please sign in to comment.