Skip to content

Commit e5aa801

Browse files
authored
feat: fix typo and package name (#834)
* feat: fix typo and package name * test: added main function as test
1 parent d04112a commit e5aa801

File tree

3 files changed

+59
-54
lines changed

3 files changed

+59
-54
lines changed

src/main/java/neqsim/statistics/dataAnalysis/dataSmoothing/DataSmoothor.java src/main/java/neqsim/statistics/dataAnalysis/dataSmoothing/DataSmoother.java

+16-31
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
* DataSmoothor.java
2+
* DataSmoother.java
33
*
44
* Created on 31. januar 2001, 21:27
55
*/
66

7-
package neqsim.statistics.dataAnalysis.dataSmoothing;
7+
package neqsim.statistics.dataanalysis.datasmoothing;
88

99
import Jama.Matrix;
1010

@@ -16,20 +16,22 @@
1616
* @author Even Solbraa
1717
* @version $Id: $Id
1818
*/
19-
public class DataSmoothor {
20-
double[] nonSmoothedNumbers, smoothedNumbers, cCoef;
21-
int nl = 0, nr = 0, ld = 0, m = 0, mm = 0, imj = 0, kk = 0;
19+
public class DataSmoother {
20+
double[] nonSmoothedNumbers;
21+
double[] smoothedNumbers;
22+
double[] cCoef;
23+
int nl = 0;
24+
int nr = 0;
25+
int ld = 0;
26+
int m = 0;
27+
int mm = 0;
28+
int imj = 0;
29+
int kk = 0;
2230
int[] index;
2331
double[][] a;
2432
double[] b;
25-
double sum = 0, fac = 0;
26-
27-
/**
28-
* <p>
29-
* Constructor for DataSmoothor.
30-
* </p>
31-
*/
32-
public DataSmoothor() {}
33+
double sum = 0;
34+
double fac = 0;
3335

3436
/**
3537
* <p>
@@ -42,7 +44,7 @@ public DataSmoothor() {}
4244
* @param ld a int
4345
* @param m a int
4446
*/
45-
public DataSmoothor(double[] nonSmoothedNumbers, int nl, int nr, int ld, int m) {
47+
public DataSmoother(double[] nonSmoothedNumbers, int nl, int nr, int ld, int m) {
4648
this.nonSmoothedNumbers = new double[nonSmoothedNumbers.length];
4749
this.smoothedNumbers = new double[nonSmoothedNumbers.length];
4850
this.cCoef = new double[nonSmoothedNumbers.length];
@@ -157,21 +159,4 @@ public void setSmoothedNumbers() {
157159
public double[] getSmoothedNumbers() {
158160
return smoothedNumbers;
159161
}
160-
161-
/**
162-
* <p>
163-
* main.
164-
* </p>
165-
*
166-
* @param args an array of {@link java.lang.String} objects
167-
*/
168-
public static void main(String args[]) {
169-
double[] numbers = {10, 11, 12, 13, 14, 15, 15.5, 15, 19, 14, 14, 13, 12, 12, 11, 10, 9, 8};
170-
DataSmoothor test = new DataSmoothor(numbers, 3, 3, 0, 4);
171-
Matrix data = new Matrix(test.getSmoothedNumbers(), 1);
172-
data.print(10, 2);
173-
test.runSmoothing();
174-
data = new Matrix(test.getSmoothedNumbers(), 1);
175-
data.print(10, 2);
176-
}
177162
}

src/main/java/neqsim/statistics/experimentalSampleCreation/sampleCreator/wettedWallColumnSampleCreator/WettedWallColumnSampleCreator.java

+22-23
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
package neqsim.statistics.experimentalSampleCreation.sampleCreator.wettedWallColumnSampleCreator;
88

99
import Jama.Matrix;
10-
import neqsim.statistics.dataAnalysis.dataSmoothing.DataSmoothor;
10+
import neqsim.statistics.dataanalysis.datasmoothing.DataSmoother;
1111
import neqsim.statistics.experimentalEquipmentData.ExperimentalEquipmentData;
1212
import neqsim.statistics.experimentalEquipmentData.wettedWallColumnData.WettedWallColumnData;
1313
import neqsim.statistics.experimentalSampleCreation.readDataFromFile.wettedWallColumnReader.WettedWallColumnDataObject;
@@ -26,7 +26,6 @@
2626
*/
2727
public class WettedWallColumnSampleCreator extends SampleCreator {
2828
WettedWallDataReader reader;
29-
DataSmoothor smoothor;
3029
double[] time;
3130
double[] pressure;
3231
double[] inletLiquidTemperature;
@@ -115,33 +114,33 @@ public void smoothData() {
115114
Matrix data = new Matrix(pressure, 1);
116115
data.print(10, 2);
117116

118-
smoothor = new DataSmoothor(pressure, 10, 10, 0, 2);
119-
smoothor.runSmoothing();
120-
smoothedPressure = smoothor.getSmoothedNumbers();
117+
DataSmoother smoother = new DataSmoother(pressure, 10, 10, 0, 2);
118+
smoother.runSmoothing();
119+
smoothedPressure = smoother.getSmoothedNumbers();
121120

122-
smoothor = new DataSmoothor(inletLiquidTemperature, 10, 10, 0, 2);
123-
smoothor.runSmoothing();
124-
smoothedInletLiquidTemperature = smoothor.getSmoothedNumbers();
121+
smoother = new DataSmoother(inletLiquidTemperature, 10, 10, 0, 2);
122+
smoother.runSmoothing();
123+
smoothedInletLiquidTemperature = smoother.getSmoothedNumbers();
125124

126-
smoothor = new DataSmoothor(outletLiquidTemperature, 10, 10, 0, 2);
127-
smoothor.runSmoothing();
128-
smoothedOutletLiquidTemperature = smoothor.getSmoothedNumbers();
125+
smoother = new DataSmoother(outletLiquidTemperature, 10, 10, 0, 2);
126+
smoother.runSmoothing();
127+
smoothedOutletLiquidTemperature = smoother.getSmoothedNumbers();
129128

130-
smoothor = new DataSmoothor(columnWallTemperature, 10, 10, 0, 2);
131-
smoothor.runSmoothing();
132-
smoothedColumnWallTemperature = smoothor.getSmoothedNumbers();
129+
smoother = new DataSmoother(columnWallTemperature, 10, 10, 0, 2);
130+
smoother.runSmoothing();
131+
smoothedColumnWallTemperature = smoother.getSmoothedNumbers();
133132

134-
smoothor = new DataSmoothor(inletTotalGasFlowRate, 10, 10, 0, 2);
135-
smoothor.runSmoothing();
136-
smoothedInletTotalGasFlowRate = smoothor.getSmoothedNumbers();
133+
smoother = new DataSmoother(inletTotalGasFlowRate, 10, 10, 0, 2);
134+
smoother.runSmoothing();
135+
smoothedInletTotalGasFlowRate = smoother.getSmoothedNumbers();
137136

138-
smoothor = new DataSmoothor(co2SupplyRate, 10, 10, 0, 2);
139-
smoothor.runSmoothing();
140-
smoothedCo2SupplyRate = smoothor.getSmoothedNumbers();
137+
smoother = new DataSmoother(co2SupplyRate, 10, 10, 0, 2);
138+
smoother.runSmoothing();
139+
smoothedCo2SupplyRate = smoother.getSmoothedNumbers();
141140

142-
smoothor = new DataSmoothor(inletLiquidFlowRate, 10, 10, 0, 2);
143-
smoothor.runSmoothing();
144-
smoothedInletLiquidFlowRate = smoothor.getSmoothedNumbers();
141+
smoother = new DataSmoother(inletLiquidFlowRate, 10, 10, 0, 2);
142+
smoother.runSmoothing();
143+
smoothedInletLiquidFlowRate = smoother.getSmoothedNumbers();
145144

146145
data = new Matrix(smoothedPressure, 1);
147146
data.print(10, 2);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package neqsim.statistics.dataanalysis.datasmoothing;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
6+
public class DataSmootherTest {
7+
8+
@Test
9+
void testgetSmoothedNumbers() {
10+
double[] numbers = {10, 11, 12, 13, 14, 15, 15.5, 15, 19, 14, 14, 13, 12, 12, 11, 10, 9, 8};
11+
DataSmoother test = new DataSmoother(numbers, 3, 3, 0, 4);
12+
Assertions.assertArrayEquals(numbers, test.getSmoothedNumbers());
13+
14+
double[] expected = {10.000000, 11.000000, 12.000000, 12.567099567099579, 13.567099567099582,
15+
14.556277056277072, 15.305194805194823, 15.389610389610409, 16.66233766233768,
16+
17.149350649350666, 13.350649350649375, 13.627705627705646, 12.432900432900452,
17+
11.89177489177491, 11.541125541125552, 10.000000, 9.000000, 8.000000};
18+
test.runSmoothing();
19+
Assertions.assertArrayEquals(expected, test.getSmoothedNumbers());
20+
}
21+
}

0 commit comments

Comments
 (0)