• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SpiNNakerManchester / JavaSpiNNaker / 6310285782

26 Sep 2023 08:47AM UTC coverage: 36.367% (-0.5%) from 36.866%
6310285782

Pull #658

github

dkfellows
Merge branch 'master' into java-17
Pull Request #658: Update Java version to 17 and JEE to 9

1675 of 1675 new or added lines in 266 files covered. (100.0%)

8368 of 23010 relevant lines covered (36.37%)

0.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/model/BoardRecord.java
1
/*
2
 * Copyright (c) 2021 The University of Manchester
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package uk.ac.manchester.spinnaker.alloc.model;
17

18
import static java.util.Objects.nonNull;
19

20
import java.time.Instant;
21
import java.util.ArrayList;
22
import java.util.List;
23

24
import com.google.errorprone.annotations.Keep;
25

26
import jakarta.validation.constraints.AssertTrue;
27
import jakarta.validation.constraints.NotBlank;
28
import uk.ac.manchester.spinnaker.machine.board.ValidBoardNumber;
29
import uk.ac.manchester.spinnaker.machine.board.ValidCabinetNumber;
30
import uk.ac.manchester.spinnaker.machine.board.ValidFrameNumber;
31
import uk.ac.manchester.spinnaker.machine.board.ValidTriadX;
32
import uk.ac.manchester.spinnaker.machine.board.ValidTriadY;
33
import uk.ac.manchester.spinnaker.machine.board.ValidTriadZ;
34
import uk.ac.manchester.spinnaker.utils.validation.IPAddress;
35

36
/**
37
 * Model of a board, for configuration purposes.
38
 *
39
 * @author Donal Fellows
40
 */
41
@JavaBean
42
public class BoardRecord {
×
43
        private Integer id;
44

45
        private Integer bmpId;
46

47
        @NotBlank
48
        private String machineName;
49

50
        @ValidTriadX
51
        private Integer x;
52

53
        @ValidTriadY
54
        private Integer y;
55

56
        @ValidTriadZ
57
        private Integer z;
58

59
        @ValidCabinetNumber
60
        private Integer cabinet;
61

62
        @ValidFrameNumber
63
        private Integer frame;
64

65
        @ValidBoardNumber
66
        private Integer board;
67

68
        @IPAddress(nullOK = true, emptyOK = true)
69
        private String ipAddress;
70

71
        private Boolean enabled;
72

73
        private Integer jobId;
74

75
        private boolean powered;
76

77
        private Instant lastPowerOn;
78

79
        private Instant lastPowerOff;
80

81
        /** The BMP serial number, if known. */
82
        private String bmpSerial;
83

84
        /** The physical board serial number, if known. */
85
        private String physicalSerial;
86

87
        private List<BoardIssueReport> reports = new ArrayList<>();
×
88

89
        /** @return The board ID, if known. */
90
        public Integer getId() {
91
                return id;
×
92
        }
93

94
        /**
95
         * @param id
96
         *            The board ID.
97
         */
98
        public void setId(Integer id) {
99
                this.id = id;
×
100
        }
×
101

102
        /** @return The BMP ID. */
103
        public Integer getBmpId() {
104
                return this.bmpId;
×
105
        }
106

107
        /**
108
         * @param bmpId
109
         *            The BMP ID.
110
         */
111
        public void setBmpId(Integer bmpId) {
112
                this.bmpId = bmpId;
×
113
        }
×
114

115
        /** @return Whether we have an ID. */
116
        public boolean isIdPresent() {
117
                return nonNull(id);
×
118
        }
119

120
        /** @return The machine name. */
121
        public String getMachineName() {
122
                return machineName;
×
123
        }
124

125
        /**
126
         * @param machineName
127
         *            The machine name.
128
         */
129
        public void setMachineName(String machineName) {
130
                this.machineName = machineName;
×
131
        }
×
132

133
        /** @return The board X coordinate, if known. */
134
        public Integer getX() {
135
                return x;
×
136
        }
137

138
        /**
139
         * @param x
140
         *            The board X coordinate.
141
         */
142
        public void setX(Integer x) {
143
                this.x = x;
×
144
        }
×
145

146
        /** @return The board Y coordinate, if known. */
147
        public Integer getY() {
148
                return y;
×
149
        }
150

151
        /**
152
         * @param y
153
         *            The board Y coordinate.
154
         */
155
        public void setY(Integer y) {
156
                this.y = y;
×
157
        }
×
158

159
        /** @return The board Z coordinate, if known. */
160
        public Integer getZ() {
161
                return z;
×
162
        }
163

164
        /**
165
         * @param z
166
         *            The board Z coordinate.
167
         */
168
        public void setZ(Integer z) {
169
                this.z = z;
×
170
        }
×
171

172
        /** @return Whether we have a full set of triad coordinates. */
173
        public boolean isTriadCoordPresent() {
174
                return nonNull(x) && nonNull(y) && nonNull(z);
×
175
        }
176

177
        /** @return The cabinet number, if known. */
178
        public Integer getCabinet() {
179
                return cabinet;
×
180
        }
181

182
        /**
183
         * @param cabinet
184
         *            The cabinet number.
185
         */
186
        public void setCabinet(Integer cabinet) {
187
                this.cabinet = cabinet;
×
188
        }
×
189

190
        /** @return The frame number, if known. */
191
        public Integer getFrame() {
192
                return frame;
×
193
        }
194

195
        /**
196
         * @param frame
197
         *            The frame number.
198
         */
199
        public void setFrame(Integer frame) {
200
                this.frame = frame;
×
201
        }
×
202

203
        /** @return The board number, if known. */
204
        public Integer getBoard() {
205
                return board;
×
206
        }
207

208
        /**
209
         * @param board
210
         *            The board number.
211
         */
212
        public void setBoard(Integer board) {
213
                this.board = board;
×
214
        }
×
215

216
        /** @return Whether we have a full set of physical coordinates. */
217
        public boolean isPhysicalCoordPresent() {
218
                return nonNull(cabinet) && nonNull(frame) && nonNull(board);
×
219
        }
220

221
        /** @return The board's IP address, if known. */
222
        public String getIpAddress() {
223
                return ipAddress;
×
224
        }
225

226
        /**
227
         * @param ipAddress
228
         *            The board's IP address.
229
         */
230
        public void setIpAddress(String ipAddress) {
231
                this.ipAddress = ipAddress;
×
232
        }
×
233

234
        /** @return Whether we have an IP address. */
235
        public boolean isAddressPresent() {
236
                return nonNull(ipAddress);
×
237
        }
238

239
        /**
240
         * @return Whether we have either the ID of a board (from a previous lookup)
241
         *         or the name of a machine and at least one set of coordinates for
242
         *         a board on that machine.
243
         */
244
        @Keep
245
        @AssertTrue(message = "board must have some mechanism for being located")
246
        private boolean isValidBoardLocator() {
247
                return isIdPresent() || (nonNull(machineName) && (isTriadCoordPresent()
×
248
                                || isPhysicalCoordPresent() || isAddressPresent()));
×
249
        }
250

251
        /** @return Whether the board is enabled. */
252
        public boolean isEnabled() {
253
                return enabled;
×
254
        }
255

256
        /** @return Whether the board enabled state is defined. */
257
        public boolean isEnabledDefined() {
258
                return nonNull(enabled);
×
259
        }
260

261
        /**
262
         * @param enabled
263
         *            Whether the board is enabled.
264
         */
265
        public void setEnabled(Boolean enabled) {
266
                this.enabled = enabled;
×
267
        }
×
268

269
        /** @return The ID of the job allocated to the board, if any. */
270
        public Integer getJobId() {
271
                return jobId;
×
272
        }
273

274
        /** @return Whether a job is allocated to the board. */
275
        public boolean isJobAllocated() {
276
                return nonNull(jobId);
×
277
        }
278

279
        /**
280
         * @param jobId
281
         *            The ID of the job allocated to the board.
282
         */
283
        public void setJobId(Integer jobId) {
284
                this.jobId = jobId;
×
285
        }
×
286

287
        /** @return When the board was last powered on, if known. */
288
        public Instant getLastPowerOn() {
289
                return lastPowerOn;
×
290
        }
291

292
        /**
293
         * @param lastPowerOn
294
         *            When the board was last powered on.
295
         */
296
        public void setLastPowerOn(Instant lastPowerOn) {
297
                this.lastPowerOn = lastPowerOn;
×
298
        }
×
299

300
        /** @return When the board was last powered off, if known. */
301
        public Instant getLastPowerOff() {
302
                return lastPowerOff;
×
303
        }
304

305
        /**
306
         * @param lastPowerOff
307
         *            When the board was last powered off.
308
         */
309
        public void setLastPowerOff(Instant lastPowerOff) {
310
                this.lastPowerOff = lastPowerOff;
×
311
        }
×
312

313
        /**
314
         * @return The reports associated with this board. The list is not
315
         *         modifiable.
316
         */
317
        public List<BoardIssueReport> getReports() {
318
                return reports;
×
319
        }
320

321
        /**
322
         * @param reports
323
         *            The reports associated with this board.
324
         */
325
        public void setReports(List<BoardIssueReport> reports) {
326
                this.reports = nonNull(reports) ? List.copyOf(reports) : List.of();
×
327
        }
×
328

329
        /** @return Whether this board is powered on. */
330
        public boolean isPowered() {
331
                return powered;
×
332
        }
333

334
        /**
335
         * @param power
336
         *            Whether this board is powered on.
337
         */
338
        public void setPowered(boolean power) {
339
                powered = power;
×
340
        }
×
341

342
        /** @return The BMP serial number, if known. */
343
        public String getBmpSerial() {
344
                return bmpSerial;
×
345
        }
346

347
        /**
348
         * @param bmpSerial
349
         *            The BMP serial number.
350
         */
351
        public void setBmpSerial(String bmpSerial) {
352
                this.bmpSerial = bmpSerial;
×
353
        }
×
354

355
        /** @return The physical board serial number, if known. */
356
        public String getPhysicalSerial() {
357
                return physicalSerial;
×
358
        }
359

360
        /**
361
         * @param physicalSerial
362
         *            The physical board serial number.
363
         */
364
        public void setPhysicalSerial(String physicalSerial) {
365
                this.physicalSerial = physicalSerial;
×
366
        }
×
367
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc