Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1695 | - | 1 | package dongfang.mkt.frames; |
2 | |||
3 | import java.util.Formatter; |
||
4 | import java.util.Locale; |
||
5 | |||
6 | public class DCMMatrixResponseFrame extends ResponseFrame { |
||
7 | private float[][] matrix; |
||
8 | |||
9 | public DCMMatrixResponseFrame(int address) { |
||
10 | super(address); |
||
11 | } |
||
12 | |||
13 | @Override |
||
14 | public boolean isResponseTo(RequestFrame r) { |
||
15 | return r instanceof DCMMatrixRequestFrame; |
||
16 | } |
||
17 | |||
18 | public float[][] getMatrix() { |
||
19 | return matrix; |
||
20 | } |
||
21 | |||
22 | public void setMatrix(float[][] matrix) { |
||
23 | this.matrix = matrix; |
||
24 | } |
||
25 | |||
26 | public String toString() { |
||
27 | StringBuilder result = new StringBuilder(); |
||
28 | Formatter fmt = new Formatter(result, Locale.US); |
||
29 | fmt.format("%4.4f", matrix[0][0] + " "); |
||
30 | fmt.format("%4.4f", matrix[0][1] + " "); |
||
31 | fmt.format("%4.4f", matrix[0][2] + "\n"); |
||
32 | |||
33 | fmt.format("%4.4f", matrix[1][0] + " "); |
||
34 | fmt.format("%4.4f", matrix[1][1] + " "); |
||
35 | fmt.format("%4.4f", matrix[1][2] + "\n"); |
||
36 | |||
37 | fmt.format("%4.4f", matrix[2][0] + " "); |
||
38 | fmt.format("%4.4f", matrix[2][1] + " "); |
||
39 | fmt.format("%4.4f", matrix[2][2]); |
||
40 | return result.toString(); |
||
41 | } |
||
42 | } |