Ejemplo n.º 1
0
 /**
  * Get a non-modal boolean property value. Throws an exception if no property value exists or an
  * error occurs.
  *
  * @param ph The property holder from which to retrieve the property value.
  * @param pd The property to retrieve.
  * @return The boolean value of the property.
  * @throws InvalidModelException Thrown if the property value cannot be retrieved because the
  *     model is incomplete or otherwise invalid.
  * @throws PropertyNotPresentException Thrown if the property is undefined for ph.
  * @throws PropertyIsModalException Thrown if ph is modal and declarative.
  * @throws IllegalStateException Thrown if the lookup encounters a cycle of property reference
  *     dependencies.
  * @throws IllegalArgumentException Thrown if ph or pd is null.
  * @throws PropertyDoesNotApplyToHolderException Thrown if pd does not apply to ph.
  * @throws PropertyIsListException Thrown if the property is not scalar.
  * @throws ClassCastException Thrown if the retrieved value is not a {@link TrueFalseValue} value.
  */
 public static boolean getBooleanValue(final NamedElement ph, final Property pd)
     throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException,
         IllegalStateException, IllegalArgumentException, PropertyDoesNotApplyToHolderException,
         PropertyIsListException, ClassCastException {
   final BooleanLiteral pv = (BooleanLiteral) getSimplePropertyValue(ph, pd);
   return pv.isValue();
 }
Ejemplo n.º 2
0
 /**
  * Get a non-modal boolean property value. Returns a given default value if no property value
  * exists. Throws an exception if an error occurs.
  *
  * @param ph The property holder from which to retrieve the property value.
  * @param pd The property to retrieve.
  * @param defaultVal The value to return if the property has no value.
  * @return The boolean value of the property.
  */
 public static boolean getBooleanValue(
     final NamedElement ph, final Property pd, final boolean defaultVal) {
   try {
     final PropertyExpression pv = getSimplePropertyValue(ph, pd);
     final BooleanLiteral v = (BooleanLiteral) pv;
     return v.getValue();
   } catch (PropertyLookupException e) {
     return defaultVal;
   }
 }
Ejemplo n.º 3
0
 /** Creates a PropertyValue for an aadlboolean. */
 public static BooleanLiteral createTrueFalseValue(boolean boolValue) {
   BooleanLiteral newPropertyValue = Aadl2Factory.eINSTANCE.createBooleanLiteral();
   newPropertyValue.setValue(boolValue);
   return newPropertyValue;
 }