Rev

Rev 2230 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | Bug Tracker

Rev 2230 Rev 2655
Line 3... Line 3...
3
 * @version    $id$
3
 * @version    $id$
4
 */
4
 */
5
package org.etsi.tool.elvior;
5
package org.etsi.tool.elvior;
6
6
7
import java.math.BigInteger;
7
import java.math.BigInteger;
-
 
8
import java.util.logging.Logger;
8
9
9
import org.elvior.ttcn.tritci.IntegerValueEx;
10
import org.elvior.ttcn.tritci.IntegerValueEx;
10
import org.elvior.ttcn.tritci.TciProvider;
11
import org.elvior.ttcn.tritci.TciProvider;
-
 
12
import org.etsi.adapter.TERFactory;
11
import org.etsi.codec.ITciCDWrapper;
13
import org.etsi.codec.ITciCDWrapper;
12
import org.etsi.ttcn.tci.BooleanValue;
14
import org.etsi.ttcn.tci.BooleanValue;
13
import org.etsi.ttcn.tci.CharstringValue;
15
import org.etsi.ttcn.tci.CharstringValue;
14
import org.etsi.ttcn.tci.EnumeratedValue;
16
import org.etsi.ttcn.tci.EnumeratedValue;
15
import org.etsi.ttcn.tci.FloatValue;
17
import org.etsi.ttcn.tci.FloatValue;
Line 28... Line 30...
28
 * See ETSI ES 201 873-6 V4.2.1 - Clause 7.3.2.1 TCI-CD required
30
 * See ETSI ES 201 873-6 V4.2.1 - Clause 7.3.2.1 TCI-CD required
29
 */
31
 */
30
public class TciCDWrapper implements ITciCDWrapper {
32
public class TciCDWrapper implements ITciCDWrapper {
31
33
32
    private TciCDRequired _tciFactory = TciProvider.getInstance().getTciCDRequired();
34
    private TciCDRequired _tciFactory = TciProvider.getInstance().getTciCDRequired();
-
 
35
   
-
 
36
    private Logger _logger;
33
   
37
   
34
    public TciCDWrapper() {
38
    public TciCDWrapper() {
35
        // Nothing to do
39
        _logger = Logger.getLogger("org.etsi.its");
36
    }
40
    }
37
   
41
   
38
    @Override
42
    @Override
39
    public IntegerValue setInteger(final Integer value) {
43
    public IntegerValue setInteger(final Integer value) {
40
        IntegerValue iv = (IntegerValue)_tciFactory.getInteger().newInstance();
44
        IntegerValue iv = (IntegerValue)_tciFactory.getInteger().newInstance();
Line 47... Line 51...
47
        return iv.getInteger();
51
        return iv.getInteger();
48
    }
52
    }
49
53
50
    @Override
54
    @Override
51
    public IntegerValue setInteger(final BigInteger value) {
55
    public IntegerValue setInteger(final BigInteger value) {
52
//        System.out.println(">>> getBigInteger: " + value);
56
//        TERFactory.getInstance().logDebug(">>> getBigInteger: " + value);
53
        IntegerValueEx bi = (IntegerValueEx) _tciFactory.getInteger().newInstance(); //_tciFactory.getTypeForName("org.elvior.ttcn.tritci.IntegerValueEx");
57
        IntegerValueEx bi = (IntegerValueEx) _tciFactory.getInteger().newInstance(); //_tciFactory.getTypeForName("org.elvior.ttcn.tritci.IntegerValueEx");
54
        if (bi != null) {
58
        if (bi != null) {
55
//            System.out.println("getBigInteger: then");
59
//            TERFactory.getInstance().logDebug("getBigInteger: then");
56
            bi.setInt64(value.longValue());
60
            bi.setInt64(value.longValue());
57
//            System.out.println("getBigInteger: bi=" + bi.getInt64());
61
//            TERFactory.getInstance().logDebug("getBigInteger: bi=" + bi.getInt64());
58
            return (IntegerValue)bi;
62
            return (IntegerValue)bi;
59
        } else {
63
        } else {
60
//            System.out.println("getBigInteger: else");
64
//            TERFactory.getInstance().logDebug("getBigInteger: else");
61
            IntegerValue i = (IntegerValue) _tciFactory.getInteger().newInstance();
65
            IntegerValue i = (IntegerValue) _tciFactory.getInteger().newInstance();
62
//            System.out.println("getBigInteger: i=" + i);
66
//            TERFactory.getInstance().logDebug("getBigInteger: i=" + i);
63
            i.setInteger(value.intValue());
67
            i.setInteger(value.intValue());
64
            return i;
68
            return i;
65
        }
69
        }
66
    }
70
    }
67
71
Line 94... Line 98...
94
        return (FloatValue)_tciFactory.getFloat().newInstance();
98
        return (FloatValue)_tciFactory.getFloat().newInstance();
95
    }
99
    }
96
100
97
    @Override
101
    @Override
98
    public Value getUnionValue(final Type decodingHypothesis, final String variantName) {
102
    public Value getUnionValue(final Type decodingHypothesis, final String variantName) {
99
//        System.out.println(">>> getUnionValue: " + decodingHypothesis.getName() + ", " + variantName);
103
//        TERFactory.getInstance().logDebug(">>> getUnionValue: " + decodingHypothesis.getName() + ", " + variantName);
100
       
104
       
101
        String variantTypeName = decodingHypothesis.getDefiningModule().getModuleName() + "." + decodingHypothesis.getName() + "." + variantName;
105
        String variantTypeName = decodingHypothesis.getDefiningModule().getModuleName() + "." + decodingHypothesis.getName() + "." + variantName;
102
//        System.out.println("variantTypeName is " + variantTypeName);
106
//        TERFactory.getInstance().logDebug("variantTypeName is " + variantTypeName);
103
        Type variantType = _tciFactory.getTypeForName(variantTypeName);
107
        Type variantType = getTypeForName(variantTypeName);
104
        if(variantType != null) {
108
        if(variantType != null) {
105
            Value testVal = variantType.newInstance();
109
            Value testVal = variantType.newInstance();
106
            if(testVal != null) {
110
            if(testVal != null) {
107
//                System.out.println("Variant value has been created.");
111
//                TERFactory.getInstance().logDebug("Variant value has been created.");
108
                return testVal;
112
                return testVal;
109
            }
113
            }
110
        }
114
        }
111
        System.err.println("variantType is null");
115
//        TERFactory.getInstance().logError("variantType is null");
112
       
116
       
113
        System.out.println("Variant value hasn't been created.");
117
//        TERFactory.getInstance().logDebug("Variant value hasn't been created.");
114
        return null;
118
        return null;
115
    }
119
    }
116
   
120
   
117
    @Override
121
    @Override
118
    public Type getTypeForName(final String type) {
122
    public Type getTypeForName(final String type) {
119
//        return TciProvider.getInstance().getTciCDRequired().getTypeForName(type);
123
//        TERFactory.getInstance().logDebug("TciCDWrapper.getTypeForName: " + type);
-
 
124
        Type originalType;
-
 
125
        if (type.indexOf("DecodedBtpPayload") != -1) {
-
 
126
            if (type.endsWith("camPacket")) {
-
 
127
                originalType = _tciFactory.getTypeForName("CAM_PDU_Descriptions.CAM");
-
 
128
            } else if (type.endsWith("denmPacket")) {
-
 
129
                originalType = _tciFactory.getTypeForName("DENM_PDU_Descriptions.DENM");
-
 
130
            } else if (type.endsWith("mapemPacket")) {
-
 
131
                originalType = _tciFactory.getTypeForName("MAPEM_PDU_Descriptions.MAPEM");
-
 
132
            } else if (type.endsWith("spatemPacket")) {
-
 
133
                originalType = _tciFactory.getTypeForName("MAPEM_PDU_Descriptions.SPATEM");
-
 
134
            } else if (type.endsWith("ivimPacket")) {
-
 
135
                originalType = _tciFactory.getTypeForName("IVIM_PDU_Descriptions.IVIM");
-
 
136
            } else if (type.endsWith("evcsnPacket")) {
-
 
137
                originalType = _tciFactory.getTypeForName("EVCSN_PDU_Descriptions.EvcsnPdu");
-
 
138
            } else if (type.endsWith("sremPacket")) {
-
 
139
                originalType = _tciFactory.getTypeForName("SREM_PDU_Descriptions.SREM");
-
 
140
            } else if (type.endsWith("ssemPacket")) {
-
 
141
                originalType = _tciFactory.getTypeForName("SSEM_PDU_Descriptions.SSEM");
-
 
142
            } else {
120
//        System.out.println("TciCDWrapper.getTypeForName" + type);
143
                originalType = _tciFactory.getTypeForName(type);
-
 
144
           }
-
 
145
        } else {
121
        Type originalType = TciProvider.getInstance().getTciCDRequired().getTypeForName(type);
146
            originalType = _tciFactory.getTypeForName(type);
-
 
147
        }
122
//        System.out.println("TciCDWrapper.getTypeForName" + originalType.getName());
148
//        TERFactory.getInstance().logDebug("TciCDWrapper.getTypeForName: " + originalType.getName());
123
        return originalType;
149
        return originalType;
124
    } // End of method getTypeForName
150
    } // End of method getTypeForName
125
   
151
   
126
    @Override
152
    @Override
127
    public BooleanValue getBoolean() {
153
    public BooleanValue getBoolean() {
Line 146... Line 172...
146
    @Override
172
    @Override
147
    public void setInteger(IntegerValue intValue, final Integer value) {
173
    public void setInteger(IntegerValue intValue, final Integer value) {
148
        intValue.setInteger(value);
174
        intValue.setInteger(value);
149
    }
175
    }
150
   
176
   
-
 
177
//    @Override
-
 
178
//    public void logDebug(String debugMessage) {
-
 
179
//        _logger.info(debugMessage);
-
 
180
//    }
-
 
181
//
-
 
182
//    @Override
-
 
183
//    public void logError(String errorMessage) {
-
 
184
//        _logger.severe(errorMessage);
-
 
185
//    }
-
 
186
//
151
} // End of class TciCDWrapper
187
} // End of class TciCDWrapper