Commit 30a77101 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Merge branch 'feature/drop-string-buffer' into 'develop'

Drop StringBuffer usage

See merge request !219
parents efb634e1 152e5a9c
Pipeline #1570 passed with stages
in 23 minutes and 37 seconds
......@@ -83,6 +83,9 @@
<action dev="luc" type="add" issue="862">
PropagatorParallelizer now preserves existing step handlers in the propagators it runs.
</action>
<action dev="ShippingEnjoyer" type="add">
Get rid of StringBuffer for logging without unnecessary synchronization (bias-locking disabled at jdk18)
</action>
</release>
<release version="11.0.2" date="2021-11-24"
description="Version 11.0.2 is a patch release of Orekit.
......
......@@ -189,7 +189,7 @@ class RapidDataAndPredictionXMLLoader extends AbstractEopLoader
private final String name;
/** Buffer for read characters. */
private final StringBuffer buffer;
private final StringBuilder buffer;
/** Indicator for daily data XML format or final data XML format. */
private DataFileContent content;
......@@ -202,7 +202,7 @@ class RapidDataAndPredictionXMLLoader extends AbstractEopLoader
*/
EOPContentHandler(final String name) {
this.name = name;
this.buffer = new StringBuffer();
this.buffer = new StringBuilder();
}
/** {@inheritDoc} */
......
......@@ -1261,7 +1261,7 @@ public class CircularOrbit
* @return a string representation of this object
*/
public String toString() {
return new StringBuffer().append("circular parameters: ").append('{').
return new StringBuilder().append("circular parameters: ").append('{').
append("a: ").append(a).
append(", ex: ").append(ex).append(", ey: ").append(ey).
append(", i: ").append(FastMath.toDegrees(i)).
......
......@@ -993,7 +993,7 @@ public class EquinoctialOrbit extends Orbit {
* @return a string representation of this object
*/
public String toString() {
return new StringBuffer().append("equinoctial parameters: ").append('{').
return new StringBuilder().append("equinoctial parameters: ").append('{').
append("a: ").append(a).
append("; ex: ").append(ex).append("; ey: ").append(ey).
append("; hx: ").append(hx).append("; hy: ").append(hy).
......
......@@ -1300,7 +1300,7 @@ public class FieldCircularOrbit<T extends CalculusFieldElement<T>>
* @return a string representation of this object
*/
public String toString() {
return new StringBuffer().append("circular parameters: ").append('{').
return new StringBuilder().append("circular parameters: ").append('{').
append("a: ").append(a.getReal()).
append(", ex: ").append(ex.getReal()).append(", ey: ").append(ey.getReal()).
append(", i: ").append(FastMath.toDegrees(i.getReal())).
......
......@@ -1065,7 +1065,7 @@ public class FieldEquinoctialOrbit<T extends CalculusFieldElement<T>> extends Fi
* @return a string representation of this object
*/
public String toString() {
return new StringBuffer().append("equinoctial parameters: ").append('{').
return new StringBuilder().append("equinoctial parameters: ").append('{').
append("a: ").append(a.getReal()).
append("; ex: ").append(ex.getReal()).append("; ey: ").append(ey.getReal()).
append("; hx: ").append(hx.getReal()).append("; hy: ").append(hy.getReal()).
......
......@@ -1706,7 +1706,7 @@ public class FieldKeplerianOrbit<T extends CalculusFieldElement<T>> extends Fiel
* @return a string representation of this object
*/
public String toString() {
return new StringBuffer().append("Keplerian parameters: ").append('{').
return new StringBuilder().append("Keplerian parameters: ").append('{').
append("a: ").append(a.getReal()).
append("; e: ").append(e.getReal()).
append("; i: ").append(FastMath.toDegrees(i.getReal())).
......
......@@ -1593,7 +1593,7 @@ public class KeplerianOrbit extends Orbit {
* @return a string representation of this object
*/
public String toString() {
return new StringBuffer().append("Keplerian parameters: ").append('{').
return new StringBuilder().append("Keplerian parameters: ").append('{').
append("a: ").append(a).
append("; e: ").append(e).
append("; i: ").append(FastMath.toDegrees(i)).
......
......@@ -457,7 +457,7 @@ public class FieldTLE<T extends CalculusFieldElement<T>> implements FieldTimeSta
*/
private void buildLine1() {
final StringBuffer buffer = new StringBuffer();
final StringBuilder buffer = new StringBuilder();
buffer.append('1');
......@@ -542,7 +542,7 @@ public class FieldTLE<T extends CalculusFieldElement<T>> implements FieldTimeSta
*/
private void buildLine2() {
final StringBuffer buffer = new StringBuffer();
final StringBuilder buffer = new StringBuilder();
final DecimalFormat f34 = new DecimalFormat("##0.0000", SYMBOLS);
final DecimalFormat f211 = new DecimalFormat("#0.00000000", SYMBOLS);
......
......@@ -122,7 +122,7 @@ class ParseUtils {
satelliteNumber, name, string);
}
final StringBuffer padding = new StringBuffer();
final StringBuilder padding = new StringBuilder();
for (int i = 0; i < size; ++i) {
padding.append(c);
}
......
......@@ -458,7 +458,7 @@ public class TLE implements TimeStamped, Serializable {
*/
private void buildLine1() {
final StringBuffer buffer = new StringBuffer();
final StringBuilder buffer = new StringBuilder();
buffer.append('1');
......@@ -500,7 +500,7 @@ public class TLE implements TimeStamped, Serializable {
buffer.append(' ');
buffer.append(ParseUtils.addPadding("elementNumber", elementNumber, ' ', 4, true, satelliteNumber));
buffer.append(Integer.toString(checksum(buffer)));
buffer.append(checksum(buffer));
line1 = buffer.toString();
......@@ -542,7 +542,7 @@ public class TLE implements TimeStamped, Serializable {
*/
private void buildLine2() {
final StringBuffer buffer = new StringBuffer();
final StringBuilder buffer = new StringBuilder();
final DecimalFormat f34 = new DecimalFormat("##0.0000", SYMBOLS);
final DecimalFormat f211 = new DecimalFormat("#0.00000000", SYMBOLS);
......@@ -566,7 +566,7 @@ public class TLE implements TimeStamped, Serializable {
buffer.append(ParseUtils.addPadding(MEAN_MOTION, f211.format(meanMotion * 43200.0 / FastMath.PI), ' ', 11, true, satelliteNumber));
buffer.append(ParseUtils.addPadding("revolutionNumberAtEpoch", revolutionNumberAtEpoch, ' ', 5, true, satelliteNumber));
buffer.append(Integer.toString(checksum(buffer)));
buffer.append(checksum(buffer));
line2 = buffer.toString();
......@@ -890,7 +890,7 @@ public class TLE implements TimeStamped, Serializable {
// Updates revolutionNumberAtEpoch
final int revolutionNumberAtEpoch = templateTLE.getRevolutionNumberAtEpoch();
final double dt = epoch.durationFrom(templateTLE.getDate());
final int newRevolutionNumberAtEpoch = (int) ((int) revolutionNumberAtEpoch + FastMath.floor((MathUtils.normalizeAngle(meanAnomaly, FastMath.PI) + dt * meanMotion) / (2 * FastMath.PI)));
final int newRevolutionNumberAtEpoch = (int) (revolutionNumberAtEpoch + FastMath.floor((MathUtils.normalizeAngle(meanAnomaly, FastMath.PI) + dt * meanMotion) / (2 * FastMath.PI)));
// Gets B*
final double bStar = templateTLE.getBStar();
// Gets Mean Motion derivatives
......
......@@ -473,7 +473,7 @@ public class DateComponents implements Serializable, Comparable<DateComponents>
* @return string representation of the date.
*/
public String toString() {
return new StringBuffer().
return new StringBuilder().
append(FOUR_DIGITS.format(year)).append('-').
append(TWO_DIGITS.format(month)).append('-').
append(TWO_DIGITS.format(day)).
......
......@@ -764,7 +764,7 @@ public class FieldPVCoordinates<T extends CalculusFieldElement<T>>
*/
public String toString() {
final String comma = ", ";
return new StringBuffer().append('{').append("P(").
return new StringBuilder().append('{').append("P(").
append(position.getX().getReal()).append(comma).
append(position.getY().getReal()).append(comma).
append(position.getZ().getReal()).append("), V(").
......
......@@ -584,7 +584,7 @@ public class PVCoordinates implements TimeShiftable<PVCoordinates>, Serializable
*/
public String toString() {
final String comma = ", ";
return new StringBuffer().append('{').append("P(").
return new StringBuilder().append('{').append("P(").
append(position.getX()).append(comma).
append(position.getY()).append(comma).
append(position.getZ()).append("), V(").
......
......@@ -344,7 +344,7 @@ public class TimeStampedPVCoordinates extends PVCoordinates implements TimeStamp
*/
public String toString(final TimeScale utc) {
final String comma = ", ";
return new StringBuffer().append('{').
return new StringBuilder().append('{').
append(date.toString(utc)).append(", P(").
append(getPosition().getX()).append(comma).
append(getPosition().getY()).append(comma).
......
......@@ -103,7 +103,7 @@ public class Utils {
public static DataContext setDataRoot(String root) {
try {
clearFactories();
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
for (String component : root.split(":")) {
String componentPath;
componentPath = Utils.class.getClassLoader().getResource(component).toURI().getPath();
......
Supports Markdown
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