use of org.eclipse.titan.designer.AST.TTCN3.values.Hexstring_Value in project titan.EclipsePlug-ins by eclipse.
the class RotateRightExpression 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 (value1 == null || value2 == null) {
return lastValue;
}
checkExpressionOperands(timestamp, expectedValue, referenceChain);
if (getIsErroneous(timestamp) || isUnfoldable(timestamp, referenceChain)) {
return lastValue;
}
final IValue last1 = value1.getValueRefdLast(timestamp, referenceChain);
final IValue last2 = value2.getValueRefdLast(timestamp, referenceChain);
String string;
int shiftSize;
switch(last1.getValuetype()) {
case BITSTRING_VALUE:
string = ((Bitstring_Value) last1).getValue();
shiftSize = ((Integer_Value) last2).intValue();
lastValue = new Bitstring_Value(rotateRight(string, shiftSize));
lastValue.copyGeneralProperties(this);
break;
case HEXSTRING_VALUE:
string = ((Hexstring_Value) last1).getValue();
shiftSize = ((Integer_Value) last2).intValue();
lastValue = new Hexstring_Value(rotateRight(string, shiftSize));
lastValue.copyGeneralProperties(this);
break;
case OCTETSTRING_VALUE:
string = ((Octetstring_Value) last1).getValue();
shiftSize = ((Integer_Value) last2).intValue() * 2;
lastValue = new Octetstring_Value(rotateRight(string, shiftSize));
lastValue.copyGeneralProperties(this);
break;
case CHARSTRING_VALUE:
string = ((Charstring_Value) last1).getValue();
shiftSize = ((Integer_Value) last2).intValue();
lastValue = new Charstring_Value(rotateRight(string, shiftSize));
lastValue.copyGeneralProperties(this);
break;
case UNIVERSALCHARSTRING_VALUE:
final UniversalCharstring string2 = ((UniversalCharstring_Value) last1).getValue();
shiftSize = ((Integer_Value) last2).intValue();
lastValue = new UniversalCharstring_Value(rotateRight(string2, shiftSize));
lastValue.copyGeneralProperties(this);
break;
default:
setIsErroneous(true);
break;
}
return lastValue;
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Hexstring_Value in project titan.EclipsePlug-ins by eclipse.
the class Not4bExpression 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)) {
return lastValue;
}
if (isUnfoldable(timestamp, referenceChain)) {
return lastValue;
}
final IValue last = value.getValueRefdLast(timestamp, referenceChain);
if (last.getIsErroneous(timestamp)) {
setIsErroneous(true);
return lastValue;
}
switch(last.getValuetype()) {
case BITSTRING_VALUE:
lastValue = new Bitstring_Value(not4bBit(((Bitstring_Value) last).getValue()));
lastValue.copyGeneralProperties(this);
break;
case HEXSTRING_VALUE:
lastValue = new Hexstring_Value(not4bHex(((Hexstring_Value) last).getValue()));
lastValue.copyGeneralProperties(this);
break;
case OCTETSTRING_VALUE:
lastValue = new Octetstring_Value(not4bHex(((Octetstring_Value) last).getValue()));
lastValue.copyGeneralProperties(this);
break;
default:
setIsErroneous(true);
break;
}
return lastValue;
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Hexstring_Value in project titan.EclipsePlug-ins by eclipse.
the class Or4bExpression 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 (value1 == null || value2 == null) {
return lastValue;
}
checkExpressionOperands(timestamp, expectedValue, referenceChain);
if (getIsErroneous(timestamp)) {
return lastValue;
}
if (isUnfoldable(timestamp, referenceChain)) {
return lastValue;
}
final IValue last1 = value1.getValueRefdLast(timestamp, referenceChain);
final IValue last2 = value2.getValueRefdLast(timestamp, referenceChain);
String str1;
String str2;
switch(last1.getValuetype()) {
case BITSTRING_VALUE:
str1 = ((Bitstring_Value) last1).getValue();
str2 = ((Bitstring_Value) last2).getValue();
lastValue = new Bitstring_Value(or4b(str1, str2));
lastValue.copyGeneralProperties(this);
break;
case HEXSTRING_VALUE:
str1 = ((Hexstring_Value) last1).getValue();
str2 = ((Hexstring_Value) last2).getValue();
lastValue = new Hexstring_Value(or4b(str1, str2));
lastValue.copyGeneralProperties(this);
break;
case OCTETSTRING_VALUE:
str1 = ((Octetstring_Value) last1).getValue();
str2 = ((Octetstring_Value) last2).getValue();
lastValue = new Octetstring_Value(or4b(str1, str2));
lastValue.copyGeneralProperties(this);
break;
default:
setIsErroneous(true);
break;
}
return lastValue;
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Hexstring_Value in project titan.EclipsePlug-ins by eclipse.
the class And4bExpression 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 (value1 == null || value2 == null) {
return lastValue;
}
checkExpressionOperands(timestamp, expectedValue, referenceChain);
if (getIsErroneous(timestamp) || isUnfoldable(timestamp, referenceChain)) {
setIsErroneous(true);
return lastValue;
}
final IValue last1 = value1.getValueRefdLast(timestamp, referenceChain);
final IValue last2 = value2.getValueRefdLast(timestamp, referenceChain);
String str1;
String str2;
switch(last1.getValuetype()) {
case BITSTRING_VALUE:
str1 = ((Bitstring_Value) last1).getValue();
str2 = ((Bitstring_Value) last2).getValue();
lastValue = new Bitstring_Value(and4b(str1, str2));
lastValue.copyGeneralProperties(this);
break;
case HEXSTRING_VALUE:
str1 = ((Hexstring_Value) last1).getValue();
str2 = ((Hexstring_Value) last2).getValue();
lastValue = new Hexstring_Value(and4b(str1, str2));
lastValue.copyGeneralProperties(this);
break;
case OCTETSTRING_VALUE:
str1 = ((Octetstring_Value) last1).getValue();
str2 = ((Octetstring_Value) last2).getValue();
lastValue = new Octetstring_Value(and4b(str1, str2));
lastValue.copyGeneralProperties(this);
break;
default:
setIsErroneous(true);
break;
}
return lastValue;
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Hexstring_Value in project titan.EclipsePlug-ins by eclipse.
the class Hex2IntExpression 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)) {
return lastValue;
}
if (isUnfoldable(timestamp, referenceChain)) {
return lastValue;
}
final IValue last = value.getValueRefdLast(timestamp, referenceChain);
if (last.getIsErroneous(timestamp)) {
setIsErroneous(true);
return lastValue;
}
switch(last.getValuetype()) {
case HEXSTRING_VALUE:
final String temp = ((Hexstring_Value) last).getValue();
lastValue = hex2int(temp);
break;
default:
return this;
}
lastValue.copyGeneralProperties(this);
return lastValue;
}
Aggregations