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

SpiNNakerManchester / JavaSpiNNaker / 6233274834

19 Sep 2023 08:46AM UTC coverage: 36.409% (-0.6%) from 36.982%
6233274834

Pull #658

github

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

1656 of 1656 new or added lines in 260 files covered. (100.0%)

8373 of 22997 relevant lines covered (36.41%)

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 javax.validation.constraints.AssertTrue;
25
import javax.validation.constraints.NotBlank;
26

27
import com.google.errorprone.annotations.Keep;
28

29
import uk.ac.manchester.spinnaker.machine.board.ValidBoardNumber;
30
import uk.ac.manchester.spinnaker.machine.board.ValidCabinetNumber;
31
import uk.ac.manchester.spinnaker.machine.board.ValidFrameNumber;
32
import uk.ac.manchester.spinnaker.machine.board.ValidTriadX;
33
import uk.ac.manchester.spinnaker.machine.board.ValidTriadY;
34
import uk.ac.manchester.spinnaker.machine.board.ValidTriadZ;
35
import uk.ac.manchester.spinnaker.utils.validation.IPAddress;
36

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

46
        private Integer bmpId;
47

48
        @NotBlank
49
        private String machineName;
50

51
        @ValidTriadX
52
        private Integer x;
53

54
        @ValidTriadY
55
        private Integer y;
56

57
        @ValidTriadZ
58
        private Integer z;
59

60
        @ValidCabinetNumber
61
        private Integer cabinet;
62

63
        @ValidFrameNumber
64
        private Integer frame;
65

66
        @ValidBoardNumber
67
        private Integer board;
68

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

72
        private Boolean enabled;
73

74
        private Integer jobId;
75

76
        private boolean powered;
77

78
        private Instant lastPowerOn;
79

80
        private Instant lastPowerOff;
81

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

361
        /**
362
         * @param physicalSerial
363
         *            The physical board serial number.
364
         */
365
        public void setPhysicalSerial(String physicalSerial) {
366
                this.physicalSerial = physicalSerial;
×
367
        }
×
368
}
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