1
2
3
4
5 package oshi.hardware;
6
7 import oshi.annotation.concurrent.Immutable;
8 import oshi.util.FormatUtil;
9
10
11
12
13
14 @Immutable
15 public class PhysicalMemory {
16
17 private final String bankLabel;
18 private final long capacity;
19 private final long clockSpeed;
20 private final String manufacturer;
21 private final String memoryType;
22 private final String partNumber;
23 private final String serialNumber;
24
25 public PhysicalMemory(String bankLabel, long capacity, long clockSpeed, String manufacturer, String memoryType,
26 String partNumber, String serialNumber) {
27 this.bankLabel = bankLabel;
28 this.capacity = capacity;
29 this.clockSpeed = clockSpeed;
30 this.manufacturer = manufacturer;
31 this.memoryType = memoryType;
32 this.partNumber = partNumber;
33 this.serialNumber = serialNumber;
34 }
35
36
37
38
39
40
41 public String getBankLabel() {
42 return bankLabel;
43 }
44
45
46
47
48
49
50 public long getCapacity() {
51 return capacity;
52 }
53
54
55
56
57
58
59
60
61 public long getClockSpeed() {
62 return clockSpeed;
63 }
64
65
66
67
68
69
70 public String getManufacturer() {
71 return manufacturer;
72 }
73
74
75
76
77
78
79 public String getMemoryType() {
80 return memoryType;
81 }
82
83
84
85
86
87
88 public String getPartNumber() {
89 return partNumber;
90 }
91
92
93
94
95
96
97 public String getSerialNumber() {
98 return serialNumber;
99 }
100
101 @Override
102 public String toString() {
103 StringBuilder sb = new StringBuilder();
104 sb.append("Bank label: " + getBankLabel());
105 sb.append(", Capacity: " + FormatUtil.formatBytes(getCapacity()));
106 sb.append(", Clock speed: " + FormatUtil.formatHertz(getClockSpeed()));
107 sb.append(", Manufacturer: " + getManufacturer());
108 sb.append(", Memory type: " + getMemoryType());
109 sb.append(", Part number: " + getPartNumber());
110 sb.append(", Serial number: " + getSerialNumber());
111 return sb.toString();
112 }
113 }