Skip to content

Commit b640096

Browse files
authored
ObjectProperty (applied-geodesy#445)
- Primitives replaced by ObjectProperty
1 parent 93ec545 commit b640096

File tree

1 file changed

+137
-27
lines changed

1 file changed

+137
-27
lines changed

JAG3D/src/org/applied_geodesy/adjustment/statistic/TestStatisticParameterSet.java

Lines changed: 137 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,62 +21,172 @@
2121

2222
package org.applied_geodesy.adjustment.statistic;
2323

24+
import javafx.beans.property.ObjectProperty;
25+
import javafx.beans.property.ReadOnlyObjectProperty;
26+
import javafx.beans.property.ReadOnlyObjectWrapper;
27+
import javafx.beans.property.SimpleObjectProperty;
28+
import javafx.beans.value.ObservableObjectValue;
29+
2430
public class TestStatisticParameterSet {
25-
private double quantile, ncp, alpha, beta, logP;
26-
private final double f1, f2;
27-
private final boolean isGlobalTestStatistic;
31+
private ObjectProperty<Double> quantile = new SimpleObjectProperty<Double>(this, "quantile");
32+
private ObjectProperty<Double> noncentralityParameter = new SimpleObjectProperty<Double>(this, "noncentralityParameter");
33+
private ObjectProperty<Double> probabilityValue = new SimpleObjectProperty<Double>(this, "probabilityValue");
34+
private ObjectProperty<Double> powerOfTest = new SimpleObjectProperty<Double>(this, "powerOfTest");
35+
private ObjectProperty<Double> logPvalue = new SimpleObjectProperty<Double>(this, "logPvalue");
36+
37+
private final ReadOnlyObjectProperty<Double> f1, f2;
38+
private final ReadOnlyObjectProperty<Boolean> globalTestStatistic;
2839

29-
public TestStatisticParameterSet(double f1, double f2, boolean isGlobalTestStatistic) {
30-
this.f1 = f1;
31-
this.f2 = f2;
32-
this.isGlobalTestStatistic = isGlobalTestStatistic;
40+
public TestStatisticParameterSet(double f1, double f2, boolean globalTestStatistic) {
41+
this.f1 = new ReadOnlyObjectWrapper<Double>(this, "numeratorDof", f1);
42+
this.f2 = new ReadOnlyObjectWrapper<Double>(this, "denominatorDof", f2);
43+
this.globalTestStatistic = new ReadOnlyObjectWrapper<Boolean>(this, "globalTestStatistic", globalTestStatistic);
3344
}
45+
3446
public TestStatisticParameterSet(double f1, double f2) {
3547
this(f1, f2, Boolean.FALSE);
3648
}
37-
public double getQuantile() {
49+
50+
public ObservableObjectValue<Double> numeratorDofProperty() {
51+
return this.f1;
52+
}
53+
54+
/**
55+
* Returns degree of freedom of numerator f1 of F distribution
56+
* @return numerator
57+
*/
58+
public double getNumeratorDof() {
59+
return this.f1.get();
60+
}
61+
62+
public ObservableObjectValue<Double> denominatorDofProperty() {
63+
return this.f2;
64+
}
65+
66+
/**
67+
* Returns degree of freedom of denominator f2 of F distribution
68+
* @return numerator
69+
*/
70+
public double getDenominatorDof() {
71+
return this.f2.get();
72+
}
73+
74+
public ObservableObjectValue<Double> quantileProperty() {
3875
return this.quantile;
3976
}
77+
78+
/**
79+
* Returns quantile q of F(f1,f2) distribution
80+
* @return
81+
*/
82+
public double getQuantile() {
83+
return this.quantile.get();
84+
}
85+
86+
/**
87+
* Sets quantile q of F(f1,f2) distribution
88+
* @param quantile
89+
*/
4090
public void setQuantile(double quantile) {
41-
this.quantile = quantile;
91+
this.quantile.set(quantile);
92+
}
93+
94+
public ObservableObjectValue<Double> noncentralityParameterProperty() {
95+
return this.noncentralityParameter;
4296
}
97+
98+
/**
99+
* Returns noncentrality parameter of F
100+
* @return noncentralityParameter
101+
*/
43102
public double getNoncentralityParameter() {
44-
return this.ncp;
103+
return this.noncentralityParameter.get();
104+
}
105+
106+
/**
107+
* Sets noncentrality parameter of F
108+
* @param noncentralityParameter
109+
*/
110+
public void setNoncentralityParameter(double noncentralityParameter) {
111+
this.noncentralityParameter.set(noncentralityParameter);
45112
}
46-
public void setNoncentralityParameter(double ncp) {
47-
this.ncp = ncp;
113+
114+
public ObservableObjectValue<Double> probabilityValueProperty() {
115+
return this.probabilityValue;
48116
}
117+
118+
/**
119+
* Returns probability value &alpha;
120+
* @return alpha
121+
*/
49122
public double getProbabilityValue() {
50-
return this.alpha;
123+
return this.probabilityValue.get();
51124
}
125+
126+
/**
127+
* Sets probability value &alpha;
128+
* @param alpha probability
129+
*/
52130
public void setProbabilityValue(double alpha) {
53-
this.alpha = alpha;
131+
this.probabilityValue.set(alpha);
54132
}
133+
134+
public ObservableObjectValue<Double> powerOfTestProperty() {
135+
return this.powerOfTest;
136+
}
137+
138+
/**
139+
* Returns test power &beta;
140+
* @return beta
141+
*/
55142
public double getPowerOfTest() {
56-
return this.beta;
143+
return this.powerOfTest.get();
57144
}
145+
146+
/**
147+
* Sets test power &beta;
148+
* @return beta power
149+
*/
58150
public void setPowerOfTest(double beta) {
59-
this.beta = beta;
151+
this.powerOfTest.set(beta);
60152
}
61-
public double getNumeratorDof() {
62-
return this.f1;
153+
154+
public ObservableObjectValue<Double> logarithmicProbabilityValueProperty() {
155+
return this.logPvalue;
63156
}
64-
public double getDenominatorDof() {
65-
return this.f2;
157+
158+
/**
159+
* Returns p-Value in log representation, i.e., log(p)
160+
* @return log(p)
161+
*/
162+
public double getLogarithmicProbabilityValue() {
163+
return this.logPvalue.get();
66164
}
165+
166+
/**
167+
* Sets p-Value in log representation, i.e., log(p)
168+
* @param logP log(p)
169+
*/
67170
public void setLogarithmicProbabilityValue(double logP) {
68-
this.logP = logP;
171+
this.logPvalue.set(logP);
69172
}
70-
public double getLogarithmicProbabilityValue() {
71-
return this.logP;
173+
174+
public ObservableObjectValue<Boolean> globalTestStatisticProperty() {
175+
return this.globalTestStatistic;
72176
}
177+
178+
/**
179+
* Returns true, if test statistic relates to global/family-wise test
180+
* @return familyWise
181+
*/
73182
public boolean isGlobalTestStatistic() {
74-
return this.isGlobalTestStatistic;
183+
return this.globalTestStatistic.get();
75184
}
185+
76186
@Override
77187
public String toString() {
78-
return "TestStatisticParameterSet [quantile=" + quantile + ", ncp="
79-
+ ncp + ", alpha=" + alpha + ", beta=" + beta + ", logP="
80-
+ logP + ", f1=" + f1 + ", f2=" + f2 + "]";
188+
return "TestStatisticParameterSet [quantile=" + getQuantile() + ", noncentralityParameter=" + getNoncentralityParameter()
189+
+ ", probabilityValue=" + getProbabilityValue() + ", powerOfTest=" + getPowerOfTest() + ", logPvalue=" + getLogarithmicProbabilityValue()
190+
+ ", d1=" + getNumeratorDof() + ", d2=" + getDenominatorDof() + ", globalTestStatistic=" + isGlobalTestStatistic() + "]";
81191
}
82192
}

0 commit comments

Comments
 (0)