Commit 914acfc8 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

Merge branch 'anettjakab/titan.EclipsePlug-ins-master'

parents 78766c89 71a73694
......@@ -9,6 +9,8 @@ package org.eclipse.titan.runtime.core;
import java.math.BigInteger;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.titan.runtime.core.BER.ASN_BER_TLV;
import org.eclipse.titan.runtime.core.BER.ASN_BERdescriptor;
......@@ -25,7 +27,6 @@ import org.eclipse.titan.runtime.core.TTCN_EncDec.error_type;
import org.eclipse.titan.runtime.core.TTCN_EncDec.raw_order_t;
import org.eclipse.titan.runtime.core.TTCN_Logger.Severity;
import javafx.util.Pair;
/**
* The base class of all types.
......@@ -693,16 +694,19 @@ public abstract class Base_Type {
}
public Pair<Boolean, TitanInteger> BER_decode_TLV_Integer(ASN_BER_TLV p_tlv, int p_unsigned, TitanInteger p_int_val) {
public Map<Boolean, TitanInteger> BER_decode_TLV_Integer(ASN_BER_TLV p_tlv, int p_unsigned, TitanInteger p_int_val) {
p_tlv.chk_constructedFlag(false);
Map<Boolean, TitanInteger> result = new HashMap<Boolean, TitanInteger>();
if(!p_tlv.isComplete) {
return new Pair<Boolean, TitanInteger> (false, p_int_val);
result.put(false, p_int_val);
return result;
}
if(p_tlv.Vlen == 0) {
TTCN_EncDec_ErrorContext.error(error_type.ET_INVAL_MSG, "Length of V-part is 0.");
return new Pair<Boolean, TitanInteger> (false, p_int_val);
result.put(false, p_int_val);
return result;
}
int Vlen = p_tlv.Vlen;
......@@ -711,8 +715,8 @@ public abstract class Base_Type {
if(Vlen >= Integer.BYTES) {
BigInteger D = new BigInteger(p_tlv.Vstr);
return new Pair<Boolean, TitanInteger> (true, new TitanInteger(D));
result.put(true, new TitanInteger(D));
return result;
}
......@@ -737,7 +741,9 @@ public abstract class Base_Type {
p_int_val = new TitanInteger(intVal);
return new Pair<Boolean, TitanInteger> (true, p_int_val);
result.put(true, p_int_val);
return result;
}
public ASN_BER_TLV BER_encode_chk_bound(boolean p_isbound) {
......
......@@ -9,6 +9,7 @@ package org.eclipse.titan.runtime.core;
import java.math.BigInteger;
import java.text.MessageFormat;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
......@@ -37,8 +38,6 @@ import org.eclipse.titan.runtime.core.TTCN_EncDec.error_type;
import org.eclipse.titan.runtime.core.TTCN_EncDec.raw_order_t;
import org.eclipse.titan.runtime.core.TitanCharString.CharCoding;
import javafx.util.Pair;
/**
* TTCN-3 integer
......@@ -1346,7 +1345,6 @@ public class TitanInteger extends Base_Type {
TTCN_EncDec_ErrorContext.error_internal("No BER descriptor available for type '%s'.", p_td.name);
}
//int L_form = flavour;
ASN_BER_TLV tlv = new ASN_BER_TLV();
BER_decode_str2TLV(p_buf, tlv, flavour);
......@@ -2354,7 +2352,7 @@ public class TitanInteger extends Base_Type {
else return null;
}
public ASN_BER_TLV BER_encode_TLV (final TTCN_Typedescriptor p_td, int coding) {
public ASN_BER_TLV BER_encode_TLV(final TTCN_Typedescriptor p_td, int coding) {
ASN_BER_TLV newTlv = BER_encode_chk_bound(is_bound());
......@@ -2371,17 +2369,18 @@ public class TitanInteger extends Base_Type {
return newTlv;
}
public boolean BER_decode_TLV (TTCN_Typedescriptor p_td, ASN_BER_TLV p_tlv, int L_form) {
public boolean BER_decode_TLV(TTCN_Typedescriptor p_td, ASN_BER_TLV p_tlv, int L_form) {
boundFlag = false;
ASN_BER_TLV strippedTlv = new ASN_BER_TLV();
strippedTlv = BER_decode_strip_tags(p_td.ber, p_tlv, L_form, strippedTlv);
TitanInteger tmp = new TitanInteger();
Pair <Boolean, TitanInteger> p = BER_decode_TLV_Integer(strippedTlv, L_form, tmp);
Map<Boolean, TitanInteger> p = BER_decode_TLV_Integer(strippedTlv, L_form, tmp);
boolean returnVal = p.getKey();
tmp = p.getValue();
for (Map.Entry<Boolean, TitanInteger> me: p.entrySet()) {
boolean returnVal = me.getKey();
tmp = me.getValue();
if (tmp.is_native()) {
nativeFlag = true;
......@@ -2404,4 +2403,6 @@ public class TitanInteger extends Base_Type {
return returnVal;
}
return false;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment