Skip to content

Commit

Permalink
style: autoformat
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed May 3, 2022
1 parent 61fa152 commit 6953e97
Show file tree
Hide file tree
Showing 10 changed files with 791 additions and 791 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public void setYvalues(double[] y, String name, String unit) {
@SuppressWarnings("deprecation")
public void createFile() {
try {
ncfile =
NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf3, fileName, null);
ncfile = NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf3, fileName, null);
} catch (IOException e) {
System.err.println("ERROR creating file");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,77 +18,77 @@
* @version $Id: $Id
*/
public class DataReader implements DataReaderInterface {
protected String fileName;
protected ArrayList<DataObject> sampleObjectList = new ArrayList<DataObject>();
protected String fileName;
protected ArrayList<DataObject> sampleObjectList = new ArrayList<DataObject>();

/**
* <p>
* Constructor for DataReader.
* </p>
*/
public DataReader() {}
/**
* <p>
* Constructor for DataReader.
* </p>
*/
public DataReader() {}

/**
* <p>
* Constructor for DataReader.
* </p>
*
* @param fileName a {@link java.lang.String} object
*/
public DataReader(String fileName) {
this.fileName = fileName;
readData();
}
/**
* <p>
* Constructor for DataReader.
* </p>
*
* @param fileName a {@link java.lang.String} object
*/
public DataReader(String fileName) {
this.fileName = fileName;
readData();
}

/** {@inheritDoc} */
@Override
public void readData() {
StringTokenizer tokenizer;
/** {@inheritDoc} */
@Override
public void readData() {
StringTokenizer tokenizer;

String path = "c:/logdata/" + this.fileName + ".log";
System.out.println(path);
String path = "c:/logdata/" + this.fileName + ".log";
System.out.println(path);

try (RandomAccessFile file = new RandomAccessFile(path, "r")) {
long filepointer = 0;
long length = file.length();
for (int i = 0; i < 6; i++) {
file.readLine();
}
do {
System.out.println("test");
String s = file.readLine();
tokenizer = new StringTokenizer(s);
tokenizer.nextToken();
try (RandomAccessFile file = new RandomAccessFile(path, "r")) {
long filepointer = 0;
long length = file.length();
for (int i = 0; i < 6; i++) {
file.readLine();
}
do {
System.out.println("test");
String s = file.readLine();
tokenizer = new StringTokenizer(s);
tokenizer.nextToken();

filepointer = file.getFilePointer();
tokenizer.nextToken();
} while (filepointer < length);
} catch (Exception e) {
String err = e.toString();
System.out.println(err);
}
filepointer = file.getFilePointer();
tokenizer.nextToken();
} while (filepointer < length);
} catch (Exception e) {
String err = e.toString();
System.out.println(err);
}
}

/**
* <p>
* Getter for the field <code>sampleObjectList</code>.
* </p>
*
* @return a {@link java.util.ArrayList} of {@link DataObject}
*/
public ArrayList<DataObject> getSampleObjectList() {
return sampleObjectList;
}
/**
* <p>
* Getter for the field <code>sampleObjectList</code>.
* </p>
*
* @return a {@link java.util.ArrayList} of {@link DataObject}
*/
public ArrayList<DataObject> getSampleObjectList() {
return sampleObjectList;
}

/**
* <p>
* main.
* </p>
*
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
public static void main(String[] args) {
DataReader reader = new DataReader("31011222");
}
/**
* <p>
* main.
* </p>
*
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
public static void main(String[] args) {
DataReader reader = new DataReader("31011222");
}
}
16 changes: 8 additions & 8 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1747,8 +1747,7 @@ public void initAnalytic(int type) {
}
}
numberOfPhases = 2;
}
else if (type == 1) {
} else if (type == 1) {
for (int i = 0; i < numberOfPhases; i++) {
if (IsPhase(i)) {
getPhase(i).init(getTotalNumberOfMoles(), numberOfComponents, 1, phaseType[phaseIndex[i]],
Expand Down Expand Up @@ -3823,18 +3822,19 @@ public java.lang.String getFluidName() {
public void setFluidName(java.lang.String fluidName) {
this.fluidName = fluidName;
}

public void addToComponentNames(java.lang.String name) {
for(int j=0;j<componentNames.size();j++) {
componentNames.set(j, componentNames.get(j)+name);
for (int j = 0; j < componentNames.size(); j++) {
componentNames.set(j, componentNames.get(j) + name);
}
for (int i = 0; i < getMaxNumberOfPhases(); i++) {
for(int j=0;j<componentNames.size();j++) {
getPhase(i).getComponent(j).setComponentName(getPhase(i).getComponent(j).getComponentName()+name);
for (int j = 0; j < componentNames.size(); j++) {
getPhase(i).getComponent(j)
.setComponentName(getPhase(i).getComponent(j).getComponentName() + name);
}
}
}

/**
* <p>
* setLastTBPasPlus.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,72 +14,71 @@
* @version $Id: $Id
*/
public class HydrateFunction extends LevenbergMarquardtFunction {
static Logger logger = LogManager.getLogger(HydrateFunction.class);
static Logger logger = LogManager.getLogger(HydrateFunction.class);

/**
* <p>
* Constructor for HydrateFunction.
* </p>
*/
public HydrateFunction() {
// params = new double[3];
}
/**
* <p>
* Constructor for HydrateFunction.
* </p>
*/
public HydrateFunction() {
// params = new double[3];
}

/** {@inheritDoc} */
@Override
public double calcValue(double[] dependentValues) {
try {
thermoOps.hydrateFormationTemperature(1);
// System.out.println("temperature " + system.getTemperature());
} catch (Exception e) {
logger.error(e.toString());
}
return system.getTemperature();
/** {@inheritDoc} */
@Override
public double calcValue(double[] dependentValues) {
try {
thermoOps.hydrateFormationTemperature(1);
// System.out.println("temperature " + system.getTemperature());
} catch (Exception e) {
logger.error(e.toString());
}
return system.getTemperature();
}

/** {@inheritDoc} */
@Override
public double calcTrueValue(double val) {
return val;
}
/** {@inheritDoc} */
@Override
public double calcTrueValue(double val) {
return val;
}

/** {@inheritDoc} */
@Override
public void setFittingParams(int i, double value) {
// int structure = 1;
params[i] = value;
// if(i==0) ((ComponentHydrate)
// system.getPhase(4).getComponent("water")).setDGfHydrate(value, structure);
// if(i==1) ((ComponentHydrate)
// system.getPhase(4).getComponent("water")).setDHfHydrate(value, structure);
// int k=0;
/** {@inheritDoc} */
@Override
public void setFittingParams(int i, double value) {
// int structure = 1;
params[i] = value;
// if(i==0) ((ComponentHydrate)
// system.getPhase(4).getComponent("water")).setDGfHydrate(value, structure);
// if(i==1) ((ComponentHydrate)
// system.getPhase(4).getComponent("water")).setDHfHydrate(value, structure);
// int k=0;

// if(i==0) ((ComponentHydrate)
// system.getPhase(4).getComponent("water")).setEmptyHydrateVapourPressureConstant(0,0,
// value);
// if(i==1) ((ComponentHydrate)
// system.getPhase(4).getComponent("water")).setEmptyHydrateVapourPressureConstant(0,1,
// value);
// if(i==0) ((ComponentHydrate)
// system.getPhase(4).getComponent("water")).setEmptyHydrateVapourPressureConstant(0,0,
// value);
// if(i==1) ((ComponentHydrate)
// system.getPhase(4).getComponent("water")).setEmptyHydrateVapourPressureConstant(0,1,
// value);

// for(int k=0;k<system.getNumberOfPhases();k++){
// if(i==0)
// system.getPhase(k).getComponent(0).setLennardJonesEnergyParameter(value);
// if(i==1)
// system.getPhase(k).getComponent(0).setLennardJonesMolecularDiameter(value);
// if(i==2) system.getPhase(k).getComponent(0).setSphericalCoreRadius(value);
// }
// for(int k=0;k<system.getNumberOfPhases();k++){
// if(i==0)
// system.getPhase(k).getComponent(0).setLennardJonesEnergyParameter(value);
// if(i==1)
// system.getPhase(k).getComponent(0).setLennardJonesMolecularDiameter(value);
// if(i==2) system.getPhase(k).getComponent(0).setSphericalCoreRadius(value);
// }

if (i == 0) {
((ComponentHydrate) system.getPhase(4).getComponent(0))
.setLennardJonesEnergyParameterHydrate(value);
}
if (i == 1) {
((ComponentHydrate) system.getPhase(4).getComponent(0))
.setLennardJonesMolecularDiameterHydrate(value);
}
if (i == 2) {
((ComponentHydrate) system.getPhase(4).getComponent(0))
.setSphericalCoreRadiusHydrate(value);
}
if (i == 0) {
((ComponentHydrate) system.getPhase(4).getComponent(0))
.setLennardJonesEnergyParameterHydrate(value);
}
if (i == 1) {
((ComponentHydrate) system.getPhase(4).getComponent(0))
.setLennardJonesMolecularDiameterHydrate(value);
}
if (i == 2) {
((ComponentHydrate) system.getPhase(4).getComponent(0)).setSphericalCoreRadiusHydrate(value);
}
}
}
2 changes: 1 addition & 1 deletion src/test/java/neqsim/NeqSimTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
public class NeqSimTest {
public NeqSimTest() {
//Setting NeqSim to use test parameter database
// Setting NeqSim to use test parameter database
neqsim.util.database.NeqSimDataBase
.setConnectionString("jdbc:derby:classpath:data/neqsimtestdatabase");
}
Expand Down
Loading

0 comments on commit 6953e97

Please sign in to comment.