Skip to content

Commit 0d41aee

Browse files
authored
Merge pull request #27 from DevFactory/release/The_members_of_an_interface_declaration_or_class_should_appear_in_a_pre-defined_order_part_4
Fixing squid: S1213 The members of an interface declaration or class should appear in a pre-defined order" Part 4
2 parents e1e0cb5 + 47c8265 commit 0d41aee

File tree

7 files changed

+79
-81
lines changed

7 files changed

+79
-81
lines changed

geonetworking/src/main/java/net/gcdc/geonetworking/LongPositionVector.java

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,21 @@
4141
* Later it has to be encoded as an unsigned units of 0.1 degree from North.
4242
*/
4343
public final class LongPositionVector {
44-
45-
@Override
46-
public String toString() {
47-
return "LPV[" + (address.isPresent() ? address.get() : "") + " " + timestamp
48-
+ " " + position + " PAI=" + isPositionConfident
49-
+ ", " + speedMetersPerSecond + " m/s, bearing "
50-
+ headingDegreesFromNorth + " degrees]";
51-
}
52-
53-
private final Optional<Address> address;
44+
45+
private final Optional<Address> address;
5446
private final Instant timestamp;
5547
private final Position position;
5648
private final boolean isPositionConfident;
5749
private final double speedMetersPerSecond;
5850
private final double headingDegreesFromNorth;
5951

60-
public Optional<Address> address() { return address; }
61-
public Instant timestamp() { return timestamp; }
62-
public Position position() { return position; }
63-
public boolean isPositionConfident() { return isPositionConfident; }
64-
public double speedMetersPerSecond() { return speedMetersPerSecond; }
65-
public double headingDegreesFromNorth() { return headingDegreesFromNorth; }
66-
67-
68-
//private long taiMillisSince2004Mod32;
52+
/** Long Position Vector length in bytes. */
53+
public static final int LENGTH = 24;
54+
private final static double SPEED_STORE_SCALE = 0.01; // 0.01 meters per second.
55+
private final static double HEADING_STORE_SCALE = 0.1; // 0.1 degrees from north.
56+
private static final long LEAP_SECONDS_SINCE_2004 = 4; // Let's assume we're always in 2015.
6957

58+
//private long taiMillisSince2004Mod32;
7059
public LongPositionVector(
7160
Address address,
7261
Instant timestamp,
@@ -99,13 +88,23 @@ public LongPositionVector(
9988
this.headingDegreesFromNorth = headingDegreesFromNorth;
10089
}
10190

102-
/** Long Position Vector length in bytes. */
103-
public static final int LENGTH = 24;
91+
@Override
92+
public String toString() {
93+
return "LPV[" + (address.isPresent() ? address.get() : "") + " " + timestamp
94+
+ " " + position + " PAI=" + isPositionConfident
95+
+ ", " + speedMetersPerSecond + " m/s, bearing "
96+
+ headingDegreesFromNorth + " degrees]";
97+
}
10498

99+
105100

106-
private final static double SPEED_STORE_SCALE = 0.01; // 0.01 meters per second.
107-
private final static double HEADING_STORE_SCALE = 0.1; // 0.1 degrees from north.
108-
101+
public Optional<Address> address() { return address; }
102+
public Instant timestamp() { return timestamp; }
103+
public Position position() { return position; }
104+
public boolean isPositionConfident() { return isPositionConfident; }
105+
public double speedMetersPerSecond() { return speedMetersPerSecond; }
106+
public double headingDegreesFromNorth() { return headingDegreesFromNorth; }
107+
109108
private int speedAsStoreUnit(double speedMetersPerSecond) {
110109
return (int) Math.round(speedMetersPerSecond / SPEED_STORE_SCALE);
111110
}
@@ -168,8 +167,7 @@ public static LongPositionVector getFrom(ByteBuffer buffer) {
168167
);
169168
}
170169

171-
private static final long LEAP_SECONDS_SINCE_2004 = 4; // Let's assume we're always in 2015.
172-
170+
173171
/** Returns TAI milliseconds mod 2^32 for the given date.
174172
*
175173
* Since java int is signed 32 bit integer, return long instead.

geonetworking/src/main/java/net/gcdc/geonetworking/MacAddress.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111
* {@link #hashCode()}.
1212
*/
1313
public final class MacAddress {
14-
@Override public String toString() {
15-
return "MacAddress[" + address + "]";
16-
}
17-
18-
private final long address;
14+
15+
private final long address;
1916

2017
public MacAddress(long address) {
2118
if ((address & 0xffff_0000_0000_0000L) != 0) {
@@ -28,6 +25,11 @@ public MacAddress(String str) {
2825
this(parseFromString(str));
2926
}
3027

28+
@Override public String toString() {
29+
return "MacAddress[" + address + "]";
30+
}
31+
32+
3133
public long value() { return address; }
3234

3335
/** Returns 6-bytes array representing this address. */

geonetworking/src/main/java/net/gcdc/geonetworking/Position.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,25 @@
2020
* 32 bit signed integer in [1/10 micro-degree] units.
2121
*/
2222
public final class Position {
23-
@Override
23+
24+
final static double MICRODEGREE = 1E-6;
25+
final static double STORE_UNIT = 0.1 * MICRODEGREE;
26+
final static double earthRadius = 6371000; // In meters. In miles: 3958.75;
27+
public static final int LENGTH = 2*4; // Two 32-bit integers.
28+
29+
private final double lattitudeDegrees;
30+
private final double longitudeDegrees;
31+
32+
public Position(double lattitudeDegrees, double longitudeDegrees) {
33+
this.lattitudeDegrees = lattitudeDegrees;
34+
this.longitudeDegrees = longitudeDegrees;
35+
}
36+
37+
@Override
2438
public String toString() {
2539
return "Pos(" + lattitudeDegrees + ", " + longitudeDegrees + ")";
2640
}
27-
28-
final static double MICRODEGREE = 1E-6;
29-
final static double STORE_UNIT = 0.1 * MICRODEGREE;
30-
final static double earthRadius = 6371000; // In meters. In miles: 3958.75;
31-
32-
33-
private final double lattitudeDegrees;
34-
private final double longitudeDegrees;
35-
36-
public Position(double lattitudeDegrees, double longitudeDegrees) {
37-
this.lattitudeDegrees = lattitudeDegrees;
38-
this.longitudeDegrees = longitudeDegrees;
39-
}
40-
41-
public static final int LENGTH = 2*4; // Two 32-bit integers.
42-
41+
4342
public double lattitudeDegrees() { return lattitudeDegrees; }
4443
public double longitudeDegrees() { return longitudeDegrees; }
4544

geonetworking/src/main/java/net/gcdc/geonetworking/ShortPositionVector.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ public class ShortPositionVector {
88
private final Address address;
99
private final Instant timestamp;
1010
private final Position position;
11-
12-
public Address address() { return address; }
13-
public Instant timestamp() { return timestamp; }
14-
public Position position() { return position; }
15-
11+
/** Length in bytes. */
12+
public static final int LENGTH = 20;
13+
1614
public ShortPositionVector(
1715
Address address,
1816
Instant timestamp,
@@ -23,8 +21,9 @@ public ShortPositionVector(
2321
this.position = position;
2422
}
2523

26-
/** Length in bytes. */
27-
public static final int LENGTH = 20;
24+
public Address address() { return address; }
25+
public Instant timestamp() { return timestamp; }
26+
public Position position() { return position; }
2827

2928
public static ShortPositionVector getFrom(ByteBuffer buffer) {
3029
Address address = Address.getFrom(buffer);

geonetworking/src/main/java/net/gcdc/geonetworking/TrafficClass.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
*/
1010
public final class TrafficClass {
1111

12+
private final byte code;
13+
14+
public TrafficClass(byte code) {
15+
this.code = code;
16+
}
17+
1218
@Override
1319
public String toString() {
1420
return "TrafficClass [0x" + Integer.toHexString(code) + "]";
@@ -36,11 +42,7 @@ public boolean equals(Object obj) {
3642
return true;
3743
}
3844

39-
private final byte code;
40-
41-
public TrafficClass(byte code) {
42-
this.code = code;
43-
}
45+
4446

4547
public byte asByte() {
4648
return code;

geonetworking/src/main/java/net/gcdc/geonetworking/gpsdclient/GpsdClient.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public class GpsdClient implements PositionProvider, AutoCloseable,TelnetNotific
4343
private Future<?> runner;
4444

4545
private static TelnetClient tc = null;
46+
47+
public GpsdClient(InetSocketAddress address) throws IOException {
48+
logger.info("Starting GPSd client");
49+
gpsdAddress = address;
50+
}
4651

4752
@Override
4853
public void run(){
@@ -163,11 +168,7 @@ private Future<?> createReader(){
163168
return runner;
164169
}
165170

166-
public GpsdClient(InetSocketAddress address) throws IOException {
167-
logger.info("Starting GPSd client");
168-
gpsdAddress = address;
169-
}
170-
171+
171172
@Override
172173
public LongPositionVector getLatestPosition() {
173174
Optional<Address> emptyAddress = Optional.empty();

geonetworking/src/main/java/net/gcdc/plugtestcms4/DUT.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,18 @@
55

66
public class DUT
77
{
8-
8+
private boolean active = false;
9+
private String name = "Unset";
10+
private String rootPassword = "voyage";
11+
private String ipv4AddressEth = "Unset";
12+
private String ipv4AddressWLAN = "Unset";
13+
private boolean receives = false;
14+
private int rxPort = 1236;
15+
private boolean transmits = false;
16+
private int txPort = 1235;
17+
private PingSettings pingSettings = null;
18+
private Object pingSettingsLock = new Object ();
19+
920
public DUT (String name, String ipv4AddressEth, String ipv4AddressWLAN, int rxPort)
1021
{
1122
if (name == null || ipv4AddressEth == null || ipv4AddressWLAN == null)
@@ -16,7 +27,6 @@ public DUT (String name, String ipv4AddressEth, String ipv4AddressWLAN, int rxPo
1627
this.rxPort = rxPort;
1728
}
1829

19-
private boolean active = false;
2030

2131
public synchronized boolean getActive ()
2232
{
@@ -54,8 +64,6 @@ public synchronized void setActive (boolean active)
5464
}
5565
}
5666

57-
private String name = "Unset";
58-
5967
public String getName ()
6068
{
6169
return this.name;
@@ -68,14 +76,12 @@ public void setName (String name)
6876
this.name = name;
6977
}
7078

71-
private String rootPassword = "voyage";
7279

7380
public final String getRootPassword ()
7481
{
7582
return this.rootPassword;
7683
}
7784

78-
private String ipv4AddressEth = "Unset";
7985

8086
public String getIpv4AddressEth ()
8187
{
@@ -92,7 +98,6 @@ public void setIpv4AddressEth (String ipv4AddressEth)
9298
}
9399
}
94100

95-
private String ipv4AddressWLAN = "Unset";
96101

97102
public String getIpv4AddressWLAN ()
98103
{
@@ -109,8 +114,6 @@ public void setIpv4AddressWLAN (String ipv4AddressWLAN)
109114
}
110115
}
111116

112-
private boolean receives = false;
113-
114117
public boolean getReceives ()
115118
{
116119
return this.receives;
@@ -124,7 +127,6 @@ public void setReceives (boolean receives)
124127
}
125128
}
126129

127-
private int rxPort = 1236;
128130

129131
public int getRxPort ()
130132
{
@@ -139,8 +141,7 @@ public void setRxPort (int rxPort)
139141
}
140142
}
141143

142-
private boolean transmits = false;
143-
144+
144145
public boolean getTransmits ()
145146
{
146147
return this.transmits;
@@ -154,7 +155,6 @@ public void setTransmits (boolean transmits)
154155
}
155156
}
156157

157-
private int txPort = 1235;
158158

159159
public int getTxPort ()
160160
{
@@ -169,9 +169,6 @@ public void setTxPort (int txPort)
169169
}
170170
}
171171

172-
private PingSettings pingSettings = null;
173-
174-
private Object pingSettingsLock = new Object ();
175172

176173
public PingStatus getPingStatus ()
177174
{

0 commit comments

Comments
 (0)