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;
}
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);
}
}
}
}
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);
}
}
}
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);
}
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;
}
Aggregations