Search in sources :

Example 1 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class Octetstring_Value method checkEquality.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkEquality(final CompilationTimeStamp timestamp, final IValue other) {
    final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    final IValue last = other.getValueRefdLast(timestamp, referenceChain);
    referenceChain.release();
    return Value_type.OCTETSTRING_VALUE.equals(last.getValuetype()) && value.equals(((Octetstring_Value) last).getValue());
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Example 2 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class Referenced_Value method evaluateIsbound.

@Override
public /**
 * {@inheritDoc}
 */
boolean evaluateIsbound(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference) {
    final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    final IValue last = getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
    referenceChain.release();
    if (last == this) {
        return false;
    }
    return last.evaluateIsbound(timestamp, reference, actualSubReference);
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Example 3 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class Referenced_Value method generateCodeInitMandatory.

@Override
public /**
 * {@inheritDoc}
 */
StringBuilder generateCodeInitMandatory(final JavaGenData aData, final StringBuilder source, final String name) {
    final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    final IValue last = getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
    referenceChain.release();
    if (last == this) {
        final ExpressionStruct expression = new ExpressionStruct();
        expression.expression.append(name);
        expression.expression.append(".assign(");
        reference.generateConstRef(aData, expression);
        generateCodeExpressionOptionalFieldReference(aData, expression, reference);
        expression.expression.append(")");
        expression.mergeExpression(source);
        return source;
    }
    // the code generation is based on the referred value
    if (last.canGenerateSingleExpression() && myScope.getModuleScope() == last.getMyScope().getModuleScope()) {
        // simple substitution for in-line values within the same module
        source.append(MessageFormat.format("{0}.assign({1});\n", name, last.generateSingleExpression(aData)));
    } else {
        // TODO might need initialization see needs_init_precede
        // TODO Value.cc:generate_code_init_refd
        source.append(MessageFormat.format("{0}.assign({1});\n", name, last.getGenNameOwn(myScope)));
    }
    return source;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Example 4 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class Referenced_Value method evaluateIspresent.

@Override
public /**
 * {@inheritDoc}
 */
boolean evaluateIspresent(final CompilationTimeStamp timestamp, final Reference reference, final int actualSubReference) {
    final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    final IValue last = getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
    referenceChain.release();
    if (last == this) {
        return false;
    }
    return last.evaluateIspresent(timestamp, reference, actualSubReference);
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Example 5 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class Referenced_Value method generateSingleExpression.

@Override
public /**
 * {@inheritDoc}
 */
StringBuilder generateSingleExpression(final JavaGenData aData) {
    final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    final IValue last = getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
    referenceChain.release();
    if (last != this && last.canGenerateSingleExpression() && last.getMyScope().getModuleScope() == myScope.getModuleScope()) {
        return last.generateSingleExpression(aData);
    }
    final ExpressionStruct expression = new ExpressionStruct();
    reference.generateConstRef(aData, expression);
    return expression.expression;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Aggregations

IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)154 IValue (org.eclipse.titan.designer.AST.IValue)102 IType (org.eclipse.titan.designer.AST.IType)55 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)21 ISubReference (org.eclipse.titan.designer.AST.ISubReference)18 Value (org.eclipse.titan.designer.AST.Value)18 Assignment (org.eclipse.titan.designer.AST.Assignment)16 BigInteger (java.math.BigInteger)15 IReferencingType (org.eclipse.titan.designer.AST.IReferencingType)14 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)13 Identifier (org.eclipse.titan.designer.AST.Identifier)12 Reference (org.eclipse.titan.designer.AST.Reference)9 ExpressionStruct (org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)8 ValueCheckingOptions (org.eclipse.titan.designer.AST.IType.ValueCheckingOptions)7 Expression_Value (org.eclipse.titan.designer.AST.TTCN3.values.Expression_Value)7 HashMap (java.util.HashMap)6 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)6 Referenced_Type (org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type)6 Real_Value (org.eclipse.titan.designer.AST.TTCN3.values.Real_Value)6 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)5