AbstractHardwareDataBuffer.java
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.example.mina.server.base;
import com.example.mina.server.entity.Entry;
/**
* @author 杜云山
* @date 2021/03/05
*/
public abstract class AbstractHardwareDataBuffer {
protected int maxRow;
protected int maxCol;
protected int maxOffset;
protected int maxAttenuate;
protected Entry[][] matrixData;
protected Entry[] offsetData;
public AbstractHardwareDataBuffer() {
}
public AbstractHardwareDataBuffer(int row, int col, int offset, int maxAttenuate) {
this.maxRow = row;
this.maxCol = col;
this.maxOffset = offset;
this.maxAttenuate = maxAttenuate;
}
/**
* Set cross point attenuation value. Actually that is not correct.
* In case of LTE device, this is a ON/OFF status (0,1)
*
* @param row the row index. *** starts from 1 ***
* @param col the col index. *** starts from 1 ***
* @param val the attenuation value
*/
public synchronized void setAttenuation(int row, int col, int val) {
if (val != -1 && (row < 1 || row > maxRow || col < 1 || col > maxCol)) {
return;
}
if (val == -1) {
val = maxAttenuate;
}
matrixData[row - 1][col - 1] = new Entry(row - 1, col - 1, "rr", val, false);
;
}
public int getAttenuation(int row, int col) {
return matrixData[row - 1][col - 1].getValue() ;
}
public synchronized void setOffset(int row, int val) {
if (row < 1 || row > maxOffset) {
return;
}
offsetData[row - 1] = new Entry(row - 1, 0, "rr", val, false);
}
public int getOffset(int row) {
return offsetData[row - 1].getValue();
}
public Entry[] getOffsetData() {
return offsetData;
}
public Entry[][] getMatrixData() {
return matrixData;
}
public int getMaxRow() {
return maxRow;
}
public int getMaxCol() {
return maxCol;
}
public int getMaxOffset() {
return maxOffset;
}
public int getMaxAttenuate() {
return maxAttenuate;
}
}