Skip to content

Commit

Permalink
feat: new functions to clone and then set a new name
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Sep 25, 2024
1 parent 22074d2 commit 50b3b79
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.apache.logging.log4j.Logger;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
import neqsim.util.exception.InvalidInputException;

/**
* <p>
Expand Down Expand Up @@ -54,6 +55,23 @@ public EquilibriumStream clone() {
return clonedStream;
}

/**
* Clone Equilibriumstream object and give it a new name.
*
* @param name Name to set for the cloned object
* @return Cloned EquilibriumStream object
*/
@Override
public EquilibriumStream clone(String name) {
if (this.getName() == name) {
throw new RuntimeException(
new InvalidInputException(this, "clone", "name", "- Same name as in original object"));
}
EquilibriumStream s = this.clone();
s.setName(name);
return s;
}

/** {@inheritDoc} */
@Override
public void run(UUID id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.apache.logging.log4j.Logger;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
import neqsim.util.exception.InvalidInputException;

/**
* <p>
Expand Down Expand Up @@ -69,6 +70,23 @@ public IronIonSaturationStream clone() {
return clonedSystem;
}

/**
* Clone IronIonSaturationStream object and give it a new name.
*
* @param name Name to set for the cloned object
* @return Cloned IronIonSaturationStream object
*/
@Override
public IronIonSaturationStream clone(String name) {
if (this.getName() == name) {
throw new RuntimeException(
new InvalidInputException(this, "clone", "name", "- Same name as in original object"));
}
IronIonSaturationStream s = this.clone();
s.setName(name);
return s;
}

/** {@inheritDoc} */
@Override
public void run(UUID id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.thermo.system.SystemInterface;
import neqsim.util.exception.InvalidInputException;

/**
* <p>
Expand Down Expand Up @@ -64,6 +65,23 @@ public NeqStream clone() {
return clonedStream;
}

/**
* Clone NeqStream object and give it a new name.
*
* @param name Name to set for the cloned object
* @return Cloned NeqStream object
*/
@Override
public NeqStream clone(String name) {
if (this.getName() == name) {
throw new RuntimeException(
new InvalidInputException(this, "clone", "name", "- Same name as in original object"));
}
NeqStream s = this.clone();
s.setName(name);
return s;
}

/** {@inheritDoc} */
@Override
public void run(UUID id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.apache.logging.log4j.Logger;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
import neqsim.util.exception.InvalidInputException;

/**
* <p>
Expand Down Expand Up @@ -63,6 +64,23 @@ public ScalePotentialCheckStream clone() {
return clonedSystem;
}

/**
* Clone ScalePotentialCheckStream object and give it a new name.
*
* @param name Name to set for the cloned object
* @return Cloned ScalePotentialCheckStream object
*/
@Override
public ScalePotentialCheckStream clone(String name) {
if (this.getName() == name) {
throw new RuntimeException(
new InvalidInputException(this, "clone", "name", "- Same name as in original object"));
}
ScalePotentialCheckStream s = this.clone();
s.setName(name);
return s;
}

/** {@inheritDoc} */
@Override
public void run(UUID id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import neqsim.standards.oilQuality.Standard_ASTM_D6377;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
import neqsim.util.exception.InvalidInputException;

/**
* <p>
Expand Down Expand Up @@ -170,6 +171,23 @@ public Stream clone() {
return clonedSystem;
}

/**
* Clone Stream object and give it a new name.
*
* @param name Name to set for the cloned object
* @return Cloned Stream object
*/
@Override
public Stream clone(String name) {
if (this.getName() == name) {
throw new RuntimeException(
new InvalidInputException(this, "clone", "name", "- Same name as in original object"));
}
Stream s = this.clone();
s.setName(name);
return s;
}

/** {@inheritDoc} */
@Override
public double getTemperature() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,24 @@ public default double getFlowRate(String unit) {

/**
* <p>
* clone.
* Clone object.
* </p>
*
* @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
*/
public StreamInterface clone();

/**
* <p>
* Clone object and set a new name.
* </p>
*
* @param name Name of cloned object
* @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
*/
public StreamInterface clone(String name);


/**
* <p>
* flashStream.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package neqsim.processSimulation.processEquipment.stream;

import java.util.UUID;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;

/**
Expand Down

0 comments on commit 50b3b79

Please sign in to comment.