Commit 6a93131c authored by Luc Maisonobe's avatar Luc Maisonobe

Ensure code blocks are always surrounded by braces.

The rule was in fact implicitly used everywhere in Orekit, but it
appeared braces were missing in very few places (11 violations
throughout the library).
parent 76edb56c
......@@ -57,6 +57,7 @@
<property name="severity" value="warning"/>
</module>
<module name="UnnecessaryParentheses"/>
<module name="NeedBraces"/>
<module name="UnusedImports"/>
<module name="VisibilityModifier"/>
<module name="WhitespaceAfter"/>
......
......@@ -424,10 +424,11 @@ public class FieldSpacecraftState <T extends RealFieldElement<T>>
final Map<String, T[]> newMap = new HashMap<String, T[]>(additional.size() + 1);
newMap.putAll(additional);
newMap.put(name, value.clone());
if (absPva == null)
if (absPva == null) {
return new FieldSpacecraftState<>(orbit, attitude, mass, newMap);
else
} else {
return new FieldSpacecraftState<>(absPva, attitude, mass, newMap);
}
}
/** Check orbit and attitude dates are equal.
......
......@@ -341,10 +341,11 @@ public class SpacecraftState
final Map<String, double[]> newMap = new HashMap<String, double[]>(additional.size() + 1);
newMap.putAll(additional);
newMap.put(name, value.clone());
if (absPva == null)
if (absPva == null) {
return new SpacecraftState(orbit, attitude, mass, newMap);
else
} else {
return new SpacecraftState(absPva, attitude, mass, newMap);
}
}
/** Check orbit and attitude dates are equal.
......@@ -435,12 +436,13 @@ public class SpacecraftState
* except for the mass and additional states which stay unchanged
*/
public SpacecraftState shiftedBy(final double dt) {
if (absPva == null)
if (absPva == null) {
return new SpacecraftState(orbit.shiftedBy(dt), attitude.shiftedBy(dt),
mass, additional);
else
} else {
return new SpacecraftState(absPva.shiftedBy(dt), attitude.shiftedBy(dt),
mass, additional);
}
}
/** {@inheritDoc}
......
......@@ -829,8 +829,9 @@ public abstract class FieldAbstractIntegratedPropagator<T extends RealFieldEleme
final FieldAdditionalEquations<T> additional = additionalEquations.get(i);
final T[] NState = newState.getAdditionalState(additional.getName());
secondary[i] = MathArrays.buildArray(getField(), NState.length);
for (int j = 0; j < NState.length; j++)
for (int j = 0; j < NState.length; j++) {
secondary[i][j] = NState[j];
}
}
return new FieldODEState<>(newState.getDate().durationFrom(getStartDate()),
......
......@@ -421,8 +421,7 @@ public abstract class AbstractGaussianContribution implements DSSTForceModel {
double maxDiff = FastMath.abs(meanRef[0] - meanCur[0]) / auxiliaryElements.getSma();
// Corrects mean element rates
for (int i = 1; i < meanRef.length; i++) {
final double diff = FastMath.abs(meanRef[i] - meanCur[i]);
if (maxDiff < diff) maxDiff = diff;
maxDiff = FastMath.max(maxDiff, FastMath.abs(meanRef[i] - meanCur[i]));
}
return maxDiff;
}
......@@ -443,8 +442,7 @@ public abstract class AbstractGaussianContribution implements DSSTForceModel {
T maxDiff = FastMath.abs(meanRef[0].subtract(meanCur[0])).divide(auxiliaryElements.getSma());;
// Corrects mean element rates
for (int i = 1; i < meanRef.length; i++) {
final T diff = FastMath.abs(meanRef[i].subtract(meanCur[i]));
if (maxDiff.getReal() < diff.getReal()) maxDiff = diff;
maxDiff = FastMath.max(maxDiff, FastMath.abs(meanRef[i].subtract(meanCur[i])));
}
return maxDiff;
}
......
......@@ -347,7 +347,9 @@ public class DSSTZonal implements DSSTForceModel {
final double cnm = harmonics.getUnnormalizedCnm(maxDeg, m);
final double snm = harmonics.getUnnormalizedSnm(maxDeg, m);
final double csnm = FastMath.hypot(cnm, snm);
if (csnm == 0.) break;
if (csnm == 0.) {
break;
}
// Set magnitude of last spherical harmonic term.
double lastTerm = 0.;
// Set current power of e and related indices.
......@@ -451,7 +453,9 @@ public class DSSTZonal implements DSSTForceModel {
final T cnm = zero.add(harmonics.getUnnormalizedCnm(maxDeg, m));
final T snm = zero.add(harmonics.getUnnormalizedSnm(maxDeg, m));
final T csnm = FastMath.hypot(cnm, snm);
if (csnm.getReal() == 0.) break;
if (csnm.getReal() == 0.) {
break;
}
// Set magnitude of last spherical harmonic term.
T lastTerm = zero;
// Set current power of e and related indices.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment