コード例 #1
0
ファイル: PropertyUtils.java プロジェクト: bejiso/osate2-core
 /**
  * Creates a PropertyValue for an aadlreal with units.
  *
  * @throws IllegalArgumentException Thrown if unit is null.
  */
 public static RealLiteral createRealValue(double realValue, UnitLiteral unit)
     throws IllegalArgumentException {
   if (unit == null) throw new IllegalArgumentException("UnitLiteral unit cannot be null.");
   RealLiteral newPropertyValue = createRealValue(realValue);
   newPropertyValue.setUnit(unit);
   return newPropertyValue;
 }
コード例 #2
0
 public void setStreamMissRate(final NamedElement ph, final double rate) {
   final RealLiteral newPropertyValue = Aadl2Factory.eINSTANCE.createRealLiteral();
   newPropertyValue.setValue(rate);
   ph.setPropertyValue(
       GetProperties.lookupPropertyDefinition(ph, SEI._NAME, SEI.STREAM_MISS_RATE),
       newPropertyValue);
 }
コード例 #3
0
ファイル: PropertyUtils.java プロジェクト: bejiso/osate2-core
  /**
   * Creates a PropertyValue for a range of aadlreal 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 createRealRangeValue(
      double min, UnitLiteral minUnits, double 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.");

    RealLiteral minimumValue = createRealValue(min, minUnits);
    RealLiteral maximumValue = createRealValue(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;
  }
コード例 #4
0
ファイル: PropertyUtils.java プロジェクト: bejiso/osate2-core
 /** Creates a PropertyValue for an aadlreal. */
 public static RealLiteral createRealValue(double realValue) {
   RealLiteral newPropertyValue = Aadl2Factory.eINSTANCE.createRealLiteral();
   newPropertyValue.setValue(realValue);
   return newPropertyValue;
 }