use of org.eclipse.titan.designer.AST.TTCN3.values.UniversalChar in project titan.EclipsePlug-ins by eclipse.
the class Unichar2CharExpression method evaluateValue.
@Override
public /**
* {@inheritDoc}
*/
IValue evaluateValue(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return lastValue;
}
isErroneous = false;
lastTimeChecked = timestamp;
lastValue = this;
if (value == null) {
return lastValue;
}
checkExpressionOperands(timestamp, expectedValue, referenceChain);
if (getIsErroneous(timestamp) || isUnfoldable(timestamp, referenceChain)) {
return lastValue;
}
final IValue last = value.getValueRefdLast(timestamp, referenceChain);
if (last.getIsErroneous(timestamp)) {
setIsErroneous(true);
return lastValue;
}
switch(last.getValuetype()) {
case UNIVERSALCHARSTRING_VALUE:
{
final UniversalCharstring string = ((UniversalCharstring_Value) last).getValue();
final UniversalChar uchar = string.get(0);
final byte[] bytes = new byte[] { (byte) uchar.cell() };
lastValue = new Charstring_Value(new String(bytes));
break;
}
case CHARSTRING_VALUE:
{
lastValue = new Charstring_Value(((Charstring_Value) last).getValue());
break;
}
default:
return this;
}
lastValue.copyGeneralProperties(this);
return lastValue;
}
Aggregations