• 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

16.67
/SpiNNaker-comms/src/main/java/uk/ac/manchester/spinnaker/alloc/client/BoardCoords.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.client;
17

18
import static java.lang.String.format;
19

20
import com.fasterxml.jackson.annotation.JsonIgnore;
21
import com.fasterxml.jackson.annotation.JsonProperty;
22
import com.google.errorprone.annotations.Immutable;
23

24
import uk.ac.manchester.spinnaker.machine.board.PhysicalCoords;
25
import uk.ac.manchester.spinnaker.machine.board.TriadCoords;
26
import uk.ac.manchester.spinnaker.machine.board.ValidBoardNumber;
27
import uk.ac.manchester.spinnaker.machine.board.ValidCabinetNumber;
28
import uk.ac.manchester.spinnaker.machine.board.ValidFrameNumber;
29
import uk.ac.manchester.spinnaker.machine.board.ValidTriadX;
30
import uk.ac.manchester.spinnaker.machine.board.ValidTriadY;
31
import uk.ac.manchester.spinnaker.machine.board.ValidTriadZ;
32
import uk.ac.manchester.spinnaker.utils.validation.IPAddress;
33

34
/**
35
 * Generalised coordinates of a board.
36
 *
37
 * @param x
38
 *            Logical triad X coordinate. Range: 0–255.
39
 * @param y
40
 *            Logical triad Y coordinate. Range: 0–255.
41
 * @param z
42
 *            Logical triad Z coordinate. Range: 0–2.
43
 * @param cabinet
44
 *            Number of the cabinet containing the frame containing the board.
45
 *            Range: 0–31.
46
 * @param frame
47
 *            Number of the frame (within the cabinet) containing the board.
48
 *            Range: 0–31.
49
 * @param board
50
 *            Number of the board within its frame. Range: 0–23. May be
51
 *            {@code null} under some circumstances.
52
 * @param address
53
 *            IP address of ethernet chip on board. May be {@code null} if the
54
 *            current user doesn't have permission to see the board address at
55
 *            this point (because it isn't allocated or booted).
56
 */
57
@Immutable
58
public record BoardCoords(//
1✔
59
                @JsonProperty("x") @ValidTriadX int x,
60
                @JsonProperty("y") @ValidTriadY int y,
61
                @JsonProperty("z") @ValidTriadZ int z,
62
                @JsonProperty("cabinet") @ValidCabinetNumber int cabinet,
63
                @JsonProperty("frame") @ValidFrameNumber int frame,
64
                @JsonProperty("board") @ValidBoardNumber Integer board,
65
                @JsonProperty("address") @IPAddress(nullOK = true) String address) {
66
        /**
67
         * The triad coordinate triple of the board.
68
         *
69
         * @return Logical triad coordinates.
70
         */
71
        @JsonIgnore
72
        public TriadCoords triad() {
73
                return new TriadCoords(x, y, z);
×
74
        }
75

76
        /**
77
         * The physical coordinate triple of the board.
78
         *
79
         * @return Physical board coordinates, or {@code null} if the {@link #board}
80
         *         is null.
81
         */
82
        @JsonIgnore
83
        public PhysicalCoords physicalCoords() {
84
                if (board == null) {
×
85
                        return null;
×
86
                }
87
                return new PhysicalCoords(cabinet, frame, board);
×
88
        }
89

90
        @Override
91
        public String toString() {
92
                return format("Board(%d,%d,%d|%d:%d:%d|%s)", x, y, z, cabinet, frame,
×
93
                                board, address);
94
        }
95
}
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