|
1 /* |
|
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * Compound parameter |
|
17 * |
|
18 */ |
|
19 package com.nokia.trace.dictionary.model.decodeparameters; |
|
20 |
|
21 import java.nio.ByteBuffer; |
|
22 import java.util.ArrayList; |
|
23 import java.util.List; |
|
24 |
|
25 /** |
|
26 * Compound parameter |
|
27 * |
|
28 */ |
|
29 public class CompoundParameter extends DecodeParameter { |
|
30 |
|
31 /** |
|
32 * List of parameter types |
|
33 */ |
|
34 private ArrayList<DecodeParameter> parameters; |
|
35 |
|
36 /** |
|
37 * Name of the parameter types |
|
38 */ |
|
39 private ArrayList<String> parameterNames; |
|
40 |
|
41 /** |
|
42 * Constructor |
|
43 * |
|
44 * @param type |
|
45 * type |
|
46 * @param hidden |
|
47 * hidden |
|
48 */ |
|
49 public CompoundParameter(String type, boolean hidden) { |
|
50 super(type, hidden); |
|
51 parameters = new ArrayList<DecodeParameter>(); |
|
52 parameterNames = new ArrayList<String>(); |
|
53 } |
|
54 |
|
55 /* |
|
56 * (non-Javadoc) |
|
57 * |
|
58 * @see |
|
59 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode |
|
60 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int, |
|
61 * java.util.List) |
|
62 */ |
|
63 @Override |
|
64 public int decode(ByteBuffer dataFrame, int offset, |
|
65 StringBuffer traceString, int dataStart, int dataLength, |
|
66 List<String> parameterList) { |
|
67 // Check that there is enough data left in the buffer |
|
68 int bytesRemaining = dataLength - (offset - dataStart); |
|
69 if (bytesRemaining <= 0) { |
|
70 postDataMissingEvent(traceString, 0, 4); |
|
71 } |
|
72 return offset; |
|
73 } |
|
74 |
|
75 /** |
|
76 * Adds new decode parameter to list |
|
77 * |
|
78 * @param parameter |
|
79 * the parameter |
|
80 * @param name |
|
81 * the name of the parameter |
|
82 */ |
|
83 public void addParameter(DecodeParameter parameter, String name) { |
|
84 parameters.add(parameter); |
|
85 parameterNames.add(name); |
|
86 } |
|
87 |
|
88 /* |
|
89 * (non-Javadoc) |
|
90 * |
|
91 * @see |
|
92 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#getSize |
|
93 * () |
|
94 */ |
|
95 @Override |
|
96 public int getSize() { |
|
97 // Not implemented yet |
|
98 return 0; |
|
99 } |
|
100 } |