Search in sources :

Example 1 with NumberValue

use of com.google.api.ads.admanager.jaxws.v202205.NumberValue in project osate2 by osate.

the class UnitLiteralImpl method createFactor.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public NumberValue createFactor(EClass eClass) {
    NumberValue newFactor = (NumberValue) create(eClass);
    setFactor(newFactor);
    return newFactor;
}
Also used : NumberValue(org.osate.aadl2.NumberValue)

Example 2 with NumberValue

use of com.google.api.ads.admanager.jaxws.v202205.NumberValue in project osate2 by osate.

the class PropertiesValidator method checkInRange.

private void checkInRange(NumberType type, NumberValue value) {
    NumericRange range = type.getRange();
    if (range != null) {
        PropertyExpression lowerExpression;
        try {
            MpvProxy modalProxy = range.getLowerBound().evaluate(null, 0).first();
            lowerExpression = modalProxy == null ? null : modalProxy.getValue();
        } catch (InvalidModelException e) {
            lowerExpression = null;
        }
        PropertyExpression upperExpression;
        try {
            MpvProxy modalProxy = range.getUpperBound().evaluate(null, 0).first();
            upperExpression = modalProxy == null ? null : modalProxy.getValue();
        } catch (InvalidModelException e) {
            upperExpression = null;
        }
        if (lowerExpression instanceof NumberValue && upperExpression instanceof NumberValue) {
            NumberValue lower = (NumberValue) lowerExpression;
            NumberValue upper = (NumberValue) upperExpression;
            double valueScaled = value.getScaledValue();
            if (valueScaled < lower.getScaledValue() || valueScaled > upper.getScaledValue()) {
                error(value, "Value must be between " + lower + " and " + upper);
            }
        }
    }
}
Also used : NumericRange(org.osate.aadl2.NumericRange) InvalidModelException(org.osate.aadl2.properties.InvalidModelException) NumberValue(org.osate.aadl2.NumberValue) MpvProxy(org.osate.aadl2.properties.EvaluatedProperty.MpvProxy) PropertyExpression(org.osate.aadl2.PropertyExpression)

Example 3 with NumberValue

use of com.google.api.ads.admanager.jaxws.v202205.NumberValue in project osate2 by osate.

the class PropertiesValidator method caseRangeValue.

@Check(CheckType.FAST)
public void caseRangeValue(final RangeValue rv) {
    final NumberValue deltaNV = rv.getDeltaValue();
    if (deltaNV != null) {
        final double delta = deltaNV.getScaledValue();
        if (delta < 0) {
            error("Range value has a negative delta component", rv.getDelta(), null, DELTA_NEGATIVE);
        }
    }
    final NumberValue lower = rv.getMinimumValue();
    final NumberValue upper = rv.getMaximumValue();
    if (lower != null && upper != null) {
        final double lowerScaled = lower.getScaledValue();
        final double upperScaled = upper.getScaledValue();
        if (upperScaled < lowerScaled) {
            error("Upper bound of range is less than the lower bound.", rv, null, UPPER_LESS_THAN_LOWER);
        }
    }
}
Also used : NumberValue(org.osate.aadl2.NumberValue) Check(org.eclipse.xtext.validation.Check)

Example 4 with NumberValue

use of com.google.api.ads.admanager.jaxws.v202205.NumberValue in project osate2 by osate.

the class PropertiesValidator method checkPropertyAssociation.

protected void checkPropertyAssociation(PropertyAssociation pa) {
    // type check value against type
    Property pdef = pa.getProperty();
    checkPropertySetElementReferenceForPackageProperties(pdef, pa);
    checkPropertySetElementReference(pdef, pa);
    if (Aadl2Util.isNull(pdef)) {
        return;
    }
    PropertyType pt = pdef.getPropertyType();
    if (Aadl2Util.isNull(pt)) {
        return;
    }
    EList<ModalPropertyValue> pvl = pa.getOwnedValues();
    for (ModalPropertyValue modalPropertyValue : pvl) {
        typeCheckPropertyValues(pt, modalPropertyValue.getOwnedValue(), modalPropertyValue.getOwnedValue(), pdef.getQualifiedName(), 0);
    }
    checkAssociationAppliesTo(pa);
    checkInBinding(pa);
    if (pa.getProperty() != null) {
        if ("Byte_Count".equalsIgnoreCase(pa.getProperty().getName())) {
            boolean offerQuickFix = true;
            for (ModalPropertyValue modalPropertyValue : pvl) {
                PropertyExpression pe = modalPropertyValue.getOwnedValue();
                if (!(pe instanceof NumberValue)) {
                    offerQuickFix = false;
                    break;
                }
            }
            if (offerQuickFix) {
                warning("Byte_Count is deprecated. Please use Memory_Size.", pa, null, BYTE_COUNT_DEPRECATED);
            } else {
                warning(pa, "Byte_Count is deprecated. Please use Memory_Size.");
            }
        } else // } else
        if ("Source_Code_Size".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Source_Code_Size is deprecated. Please use Code_Size.", pa, null, SOURCE_CODE_SIZE_DEPRECATED);
        } else if ("Source_Data_Size".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Source_Data_Size is deprecated. Please use Data_Size.", pa, null, SOURCE_DATA_SIZE_DEPRECATED);
        } else if ("Source_Heap_Size".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Source_Heap_Size is deprecated. Please use Heap_Size.", pa, null, SOURCE_HEAP_SIZE_DEPRECATED);
        } else if ("Source_Stack_Size".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Source_Stack_Size is deprecated. Please use Stack_Size.", pa, null, SOURCE_STACK_SIZE_DEPRECATED);
        } else if ("Data_Volume".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Data_Volume is deprecated. Please use Data_Rate.", pa, null, DATA_VOLUME_DEPRECATED);
        }
    }
    checkConstantProperty(pa);
}
Also used : ModalPropertyValue(org.osate.aadl2.ModalPropertyValue) NumberValue(org.osate.aadl2.NumberValue) PropertyExpression(org.osate.aadl2.PropertyExpression) PropertyType(org.osate.aadl2.PropertyType) ArraySizeProperty(org.osate.aadl2.ArraySizeProperty) Property(org.osate.aadl2.Property)

Example 5 with NumberValue

use of com.google.api.ads.admanager.jaxws.v202205.NumberValue in project osate2 by osate.

the class GetProperties method getMinimumTransmissionTimePerByte.

public static double getMinimumTransmissionTimePerByte(final NamedElement bus) {
    RecordValue rv;
    RangeValue bpa;
    NumberValue nv;
    rv = GetProperties.getTransmissionTime(bus);
    if (rv == null) {
        return 0;
    }
    bpa = (RangeValue) PropertyUtils.getRecordFieldValue(rv, "PerByte");
    if (bpa != null) {
        nv = bpa.getMinimumValue();
        return nv.getScaledValue(GetProperties.getMSUnitLiteral(bus));
    }
    return 0;
}
Also used : NumberValue(org.osate.aadl2.NumberValue) RecordValue(org.osate.aadl2.RecordValue) RangeValue(org.osate.aadl2.RangeValue)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)30 NumberValue (org.osate.aadl2.NumberValue)24 RangeValue (org.osate.aadl2.RangeValue)13 PropertyExpression (org.osate.aadl2.PropertyExpression)12 ParseException (java.text.ParseException)10 Set (java.util.Set)10 Before (org.junit.Before)10 Test (org.junit.Test)10 RecordValue (org.osate.aadl2.RecordValue)6 NumberValue (com.google.api.ads.admanager.axis.v202108.NumberValue)5 NumberValue (com.google.api.ads.admanager.axis.v202111.NumberValue)5 BooleanValue (com.google.api.ads.admanager.axis.v202105.BooleanValue)4 DateTimeValue (com.google.api.ads.admanager.axis.v202105.DateTimeValue)4 DateValue (com.google.api.ads.admanager.axis.v202105.DateValue)4 NumberValue (com.google.api.ads.admanager.axis.v202105.NumberValue)4 SetValue (com.google.api.ads.admanager.axis.v202105.SetValue)4 TargetingValue (com.google.api.ads.admanager.axis.v202105.TargetingValue)4 TextValue (com.google.api.ads.admanager.axis.v202105.TextValue)4 BooleanValue (com.google.api.ads.admanager.axis.v202202.BooleanValue)4 BooleanValue (com.google.api.ads.admanager.jaxws.v202205.BooleanValue)4