Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1611 | - | 1 | package dongfang.mkt.configuration; |
2 | |||
3 | public class ArrayEntry extends ParameterEntry { |
||
4 | int length; |
||
5 | boolean isDynamic; |
||
6 | int[] values; |
||
7 | |||
8 | ArrayEntry(String name, boolean isDynamic, int length) { |
||
9 | super(name); |
||
10 | this.isDynamic = isDynamic; |
||
11 | this.length = length; |
||
12 | } |
||
13 | |||
14 | int[] getValue() { |
||
15 | return values; |
||
16 | } |
||
17 | |||
18 | int setValue(int[] data, int offset) { |
||
19 | values = new int[length]; |
||
20 | System.arraycopy(data, offset, values, 0, length); |
||
21 | return length; |
||
22 | } |
||
23 | |||
24 | int getByteCount() { |
||
25 | return length; |
||
26 | } |
||
27 | |||
28 | String toStringWithValues() { |
||
29 | StringBuilder result = new StringBuilder(name + ":\t{"); |
||
30 | for (int i = 0; i < length; i++) { |
||
31 | if (i != 0) |
||
32 | result.append(","); |
||
33 | result.append(values[i]); |
||
34 | } |
||
35 | result.append("}"); |
||
36 | return result.toString(); |
||
37 | } |
||
38 | |||
39 | void toXML(StringBuilder result) { |
||
40 | result.append(" <list name=\"" + name + "\">\n"); |
||
41 | for (int i = 0; i < length; i++) { |
||
42 | result.append(" <entry value=\"" + values[i] + "\"/>\n"); |
||
43 | } |
||
44 | result.append(" </list>\n"); |
||
45 | } |
||
46 | } |