/** * Creates a PropertyValue for an aadlinteger with units. * * @throws IllegalArgumentException Thrown if unit is null. */ public static IntegerLiteral createIntegerValue(long intValue, UnitLiteral unit) throws IllegalArgumentException { if (unit == null) throw new IllegalArgumentException("UnitLiteral unit cannot be null."); IntegerLiteral newPropertyValue = createIntegerValue(intValue); newPropertyValue.setUnit(unit); return newPropertyValue; }
protected boolean _isLeaf(IntegerLiteral bpa) { if (bpa.eContainer() instanceof RecordValue) { return false; } return false; }
/** * Creates a PropertyValue for a range of aadlinteger with units. * * @throws IllegalArgumentException Thrown if minUnits or maxUnits is null, if minUnits and * maxUnits are not of the same UnitType, or if min is greater than max. */ public static RangeValue createIntegerRangeValue( long min, UnitLiteral minUnits, long max, UnitLiteral maxUnits) throws IllegalArgumentException { if (minUnits == null) throw new IllegalArgumentException("minUnits cannot be null."); if (maxUnits == null) throw new IllegalArgumentException("maxUnits cannot be null."); if (!minUnits.eContainer().equals(maxUnits.eContainer())) throw new IllegalArgumentException("minUnits and maxUnits are not of the same type."); IntegerLiteral minimumValue = createIntegerValue(min, minUnits); IntegerLiteral maximumValue = createIntegerValue(max, maxUnits); if (minimumValue.getScaledValue() > maximumValue.getScaledValue()) throw new IllegalArgumentException("min cannot be greater than max."); RangeValue newPropertyValue = Aadl2Factory.eINSTANCE.createRangeValue(); newPropertyValue.setMinimum(minimumValue); newPropertyValue.setMaximum(maximumValue); return newPropertyValue; }
/** Creates a PropertyValue for an aadlinteger. */ public static IntegerLiteral createIntegerValue(long intValue) { IntegerLiteral newPropertyValue = Aadl2Factory.eINSTANCE.createIntegerLiteral(); newPropertyValue.setValue(intValue); return newPropertyValue; }