use of org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value in project titan.EclipsePlug-ins by eclipse.
the class Sequence_Value method evaluateIspresent.
@Override
public /**
* {@inheritDoc}
*/
boolean evaluateIspresent(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference) {
final List<ISubReference> subreferences = reference.getSubreferences();
if (getIsErroneous(timestamp) || subreferences.size() <= actualSubReference) {
return true;
}
if (convertedValue != null && convertedValue != this) {
return convertedValue.evaluateIsbound(timestamp, reference, actualSubReference);
}
final IType type = myGovernor.getTypeRefdLast(timestamp);
if (type.getIsErroneous(timestamp)) {
return false;
}
final ISubReference subreference = subreferences.get(actualSubReference);
switch(subreference.getReferenceType()) {
case arraySubReference:
return false;
case fieldSubReference:
final Identifier fieldId = ((FieldSubReference) subreference).getId();
switch(type.getTypetype()) {
case TYPE_TTCN3_SEQUENCE:
if (!((TTCN3_Sequence_Type) type).hasComponentWithName(fieldId.getName())) {
return false;
}
break;
case TYPE_ASN1_SEQUENCE:
if (!((ASN1_Sequence_Type) type).hasComponentWithName(fieldId)) {
return false;
}
break;
default:
return false;
}
if (values.hasNamedValueWithName(fieldId)) {
// we can move on with the check
return values.getNamedValueByName(fieldId).getValue().evaluateIspresent(timestamp, reference, actualSubReference + 1);
}
if (Type_type.TYPE_TTCN3_SEQUENCE.equals(type.getTypetype())) {
return false;
}
final CompField compField = ((ASN1_Sequence_Type) type).getComponentByName(fieldId);
if (compField.isOptional()) {
// create an explicit omit value
final Value result = new Omit_Value();
final BridgingNamedNode bridge = new BridgingNamedNode(this, "." + fieldId.getDisplayName());
result.setFullNameParent(bridge);
result.setMyScope(getMyScope());
return result.evaluateIspresent(timestamp, reference, actualSubReference + 1);
} else if (compField.hasDefault()) {
return compField.getDefault().evaluateIspresent(timestamp, reference, actualSubReference + 1);
}
return false;
case parameterisedSubReference:
return false;
default:
return false;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value in project titan.EclipsePlug-ins by eclipse.
the class Sequence_Value method evaluateIsbound.
@Override
public /**
* {@inheritDoc}
*/
boolean evaluateIsbound(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference) {
final List<ISubReference> subreferences = reference.getSubreferences();
if (getIsErroneous(timestamp) || subreferences.size() <= actualSubReference) {
return true;
}
if (convertedValue != null && convertedValue != this) {
return convertedValue.evaluateIsbound(timestamp, reference, actualSubReference);
}
final IType type = myGovernor.getTypeRefdLast(timestamp);
if (type.getIsErroneous(timestamp)) {
return false;
}
final ISubReference subreference = subreferences.get(actualSubReference);
switch(subreference.getReferenceType()) {
case arraySubReference:
return false;
case fieldSubReference:
final Identifier fieldId = ((FieldSubReference) subreference).getId();
switch(type.getTypetype()) {
case TYPE_TTCN3_SEQUENCE:
if (!((TTCN3_Sequence_Type) type).hasComponentWithName(fieldId.getName())) {
return false;
}
break;
case TYPE_ASN1_SEQUENCE:
if (!((ASN1_Sequence_Type) type).hasComponentWithName(fieldId)) {
return false;
}
break;
default:
return false;
}
if (values.hasNamedValueWithName(fieldId)) {
// we can move on with the check
return values.getNamedValueByName(fieldId).getValue().evaluateIsbound(timestamp, reference, actualSubReference + 1);
}
if (Type_type.TYPE_TTCN3_SEQUENCE.equals(type.getTypetype())) {
return false;
}
final CompField compField = ((ASN1_Sequence_Type) type).getComponentByName(fieldId);
if (compField.isOptional()) {
// create an explicit omit value
final Value result = new Omit_Value();
final BridgingNamedNode bridge = new BridgingNamedNode(this, "." + fieldId.getDisplayName());
result.setFullNameParent(bridge);
result.setMyScope(getMyScope());
return result.evaluateIsbound(timestamp, reference, actualSubReference + 1);
} else if (compField.hasDefault()) {
return compField.getDefault().evaluateIsbound(timestamp, reference, actualSubReference + 1);
}
return false;
case parameterisedSubReference:
return false;
default:
return false;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value in project titan.EclipsePlug-ins by eclipse.
the class Set_Value method evaluateIspresent.
@Override
public /**
* {@inheritDoc}
*/
boolean evaluateIspresent(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference) {
final List<ISubReference> subreferences = reference.getSubreferences();
if (getIsErroneous(timestamp) || subreferences.size() <= actualSubReference) {
return true;
}
final IType type = myGovernor.getTypeRefdLast(timestamp);
if (type.getIsErroneous(timestamp)) {
return false;
}
final ISubReference subreference = subreferences.get(actualSubReference);
switch(subreference.getReferenceType()) {
case arraySubReference:
return false;
case fieldSubReference:
final Identifier fieldId = ((FieldSubReference) subreference).getId();
switch(type.getTypetype()) {
case TYPE_TTCN3_SET:
if (!((TTCN3_Set_Type) type).hasComponentWithName(fieldId.getName())) {
return false;
}
break;
case TYPE_ASN1_SET:
if (!((ASN1_Set_Type) type).hasComponentWithName(fieldId)) {
return false;
}
break;
default:
return false;
}
if (values.hasNamedValueWithName(fieldId)) {
// we can move on with the check
return values.getNamedValueByName(fieldId).getValue().evaluateIspresent(timestamp, reference, actualSubReference + 1);
}
if (Type_type.TYPE_TTCN3_SET.equals(type.getTypetype())) {
return false;
}
final CompField compField = ((ASN1_Set_Type) type).getComponentByName(fieldId);
if (compField.isOptional()) {
// create an explicit omit value
final Value result = new Omit_Value();
final BridgingNamedNode bridge = new BridgingNamedNode(this, "." + fieldId.getDisplayName());
result.setFullNameParent(bridge);
result.setMyScope(getMyScope());
return result.evaluateIspresent(timestamp, reference, actualSubReference + 1);
} else if (compField.hasDefault()) {
return compField.getDefault().evaluateIspresent(timestamp, reference, actualSubReference + 1);
}
return false;
case parameterisedSubReference:
return false;
default:
return false;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value in project titan.EclipsePlug-ins by eclipse.
the class Set_Value method evaluateIsbound.
@Override
public /**
* {@inheritDoc}
*/
boolean evaluateIsbound(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference) {
final List<ISubReference> subreferences = reference.getSubreferences();
if (getIsErroneous(timestamp) || subreferences.size() <= actualSubReference) {
return true;
}
final IType type = myGovernor.getTypeRefdLast(timestamp);
if (type.getIsErroneous(timestamp)) {
return false;
}
final ISubReference subreference = subreferences.get(actualSubReference);
switch(subreference.getReferenceType()) {
case arraySubReference:
return false;
case fieldSubReference:
final Identifier fieldId = ((FieldSubReference) subreference).getId();
switch(type.getTypetype()) {
case TYPE_TTCN3_SET:
if (!((TTCN3_Set_Type) type).hasComponentWithName(fieldId.getName())) {
return false;
}
break;
case TYPE_ASN1_SET:
if (!((ASN1_Set_Type) type).hasComponentWithName(fieldId)) {
return false;
}
break;
default:
return false;
}
if (values.hasNamedValueWithName(fieldId)) {
// we can move on with the check
return values.getNamedValueByName(fieldId).getValue().evaluateIsbound(timestamp, reference, actualSubReference + 1);
}
if (Type_type.TYPE_TTCN3_SET.equals(type.getTypetype())) {
return false;
}
final CompField compField = ((ASN1_Set_Type) type).getComponentByName(fieldId);
if (compField.isOptional()) {
// create an explicit omit value
final Value result = new Omit_Value();
final BridgingNamedNode bridge = new BridgingNamedNode(this, "." + fieldId.getDisplayName());
result.setFullNameParent(bridge);
result.setMyScope(getMyScope());
return result.evaluateIsbound(timestamp, reference, actualSubReference + 1);
} else if (compField.hasDefault()) {
return compField.getDefault().evaluateIsbound(timestamp, reference, actualSubReference + 1);
}
return false;
case parameterisedSubReference:
return false;
default:
return false;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value in project titan.EclipsePlug-ins by eclipse.
the class ASN1_Integer_Type method checkThisValueLimit.
// this method accepts REAL_VALUE
public void checkThisValueLimit(final CompilationTimeStamp timestamp, final IValue value, final ValueCheckingOptions valueCheckingOptions) {
super.checkThisValue(timestamp, value, null, valueCheckingOptions);
final IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
if (null == last || last.getIsErroneous(timestamp)) {
return;
}
// already handled ones
switch(value.getValuetype()) {
case OMIT_VALUE:
case REFERENCED_VALUE:
return;
case UNDEFINED_LOWERIDENTIFIER_VALUE:
if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
return;
}
break;
default:
break;
}
switch(last.getValuetype()) {
case INTEGER_VALUE:
case REAL_VALUE:
break;
case NAMED_INTEGER_VALUE:
if (null != namedNumbers) {
// convert it into an integer value
final Identifier name = ((Named_Integer_Value) last).getIdentifier();
final NamedValue namedValue = namedNumbers.getNamedValueByName(name);
IValue tempValue = namedValue.getValue();
final ReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
tempValue = tempValue.getValueRefdLast(timestamp, referenceChain);
referenceChain.release();
if (!tempValue.getIsErroneous(timestamp) && Value_type.INTEGER_VALUE.equals(tempValue.getValuetype())) {
final int temp = ((Integer_Value) tempValue).intValue();
final Integer_Value converted = new Integer_Value(temp);
converted.copyGeneralProperties(value);
((Named_Integer_Value) last).setCalculatedValue(converted);
} else {
// FIXME Most probably we were not able
// to build the semantic structure for
// something, because it is not yet
// supported, like referenced values in
// sets
}
}
break;
case EXPRESSION_VALUE:
case MACRO_VALUE:
// already checked
break;
default:
value.getLocation().reportSemanticError(INTEGERVALUEEXPECTED);
value.setIsErroneous(true);
}
}
Aggregations