use of org.osate.aadl2.properties.PropertyAcc in project osate2 by osate.
the class SubcomponentImpl method getPropertyValueInternal.
// TODO-lw: Why don't we return immediately if a pa was found?
public final void getPropertyValueInternal(final Property prop, final PropertyAcc pas, final boolean fromInstanceSlaveCall, final boolean all) throws InvalidModelException {
final ComponentImplementation owner = (ComponentImplementation) getContainingClassifier();
// local contained value
if (!fromInstanceSlaveCall) {
pas.addLocalContained(this, owner);
}
// get local value
pas.addLocal(this);
// collect values from refined subcomponents
Subcomponent refined = getRefined();
while (refined != null) {
if (!fromInstanceSlaveCall) {
pas.addLocalContained(refined, refined.getContainingClassifier());
}
pas.addLocal(refined);
refined = refined.getRefined();
}
// get values from classifier
final ComponentClassifier cc = getClassifier();
if (cc != null) {
cc.getPropertyValueInternal(prop, pas, fromInstanceSlaveCall, all);
}
// get values from container
if (!fromInstanceSlaveCall && prop.isInherit()) {
owner.getPropertyValueInternal(prop, pas, fromInstanceSlaveCall, all);
}
}
use of org.osate.aadl2.properties.PropertyAcc in project osate2 by osate.
the class GetProperties method isAssignedPropertyValue.
/**
* returns true if property is explicitly assigned
*
* @param element NamedELement
* @param pn Property definition
* @return
*/
public static boolean isAssignedPropertyValue(NamedElement element, Property pn) {
try {
final PropertyAcc propertyAccumulator = element.getPropertyValue(pn);
PropertyAssociation firstAssociation = propertyAccumulator.first();
return firstAssociation != null;
} catch (org.osate.aadl2.properties.PropertyDoesNotApplyToHolderException exception) {
return false;
}
}
use of org.osate.aadl2.properties.PropertyAcc in project osate2 by osate.
the class GetProperties method getSourceName.
public static String getSourceName(final NamedElement ne) {
try {
Property sn = lookupPropertyDefinition(ne, ProgrammingProperties._NAME, ProgrammingProperties.SOURCE_NAME);
PropertyAcc pacc = ne.getPropertyValue(sn);
if (pacc.getAssociations().size() > 0) {
ModalPropertyValue mdv = pacc.getAssociations().get(0).getOwnedValues().get(0);
PropertyExpression pe = mdv.getOwnedValue();
// System.out.println("pe=" + pe);
StringLiteral sl = (StringLiteral) pe;
return sl.getValue();
}
// System.out.println("pacc" + pacc.getAssociations().get(0).getOwnedValues().get(0));
return null;
} catch (PropertyLookupException e) {
return null;
}
}
use of org.osate.aadl2.properties.PropertyAcc in project osate2 by osate.
the class ConnectionImpl method getPropertyValueInternal.
public final void getPropertyValueInternal(final Property pn, final PropertyAcc pas, final boolean fromInstanceSlaveCall, final boolean all) throws InvalidModelException {
final ComponentImplementation partOf = (ComponentImplementation) getContainingClassifier();
// First look in the container's contained property associations
if (!fromInstanceSlaveCall && pas.addLocalContained(this, partOf)) {
if (!all) {
return;
}
}
/*
* Next see if the property is defined in connection's properties
* subclause (could merge this with the loop below, but I want to make
* the steps more explicit.)
*/
if (pas.addLocal(this)) {
if (!all) {
return;
}
}
// Next find the value by walking up the connection's refinement
// sequence
Connection refined = getRefined();
while (refined != null) {
if (!fromInstanceSlaveCall && pas.addLocalContained(refined, refined.getContainingClassifier())) {
if (!all) {
return;
}
}
if (pas.addLocal(refined)) {
if (!all) {
return;
}
}
refined = refined.getRefined();
}
/*
* if still not set, and the property is "inherit", try the containing
* component implementation.
*/
if (!fromInstanceSlaveCall && pn.isInherit()) {
partOf.getPropertyValueInternal(pn, pas, fromInstanceSlaveCall, all);
}
}
use of org.osate.aadl2.properties.PropertyAcc in project osate2 by osate.
the class FeatureImpl method getPropertyValueInternal.
public void getPropertyValueInternal(final Property prop, final PropertyAcc pas, final boolean fromInstanceSlaveCall, final boolean all) throws InvalidModelException {
Classifier owner = getContainingClassifier();
if (pas.addLocalContained(this, owner) && !all || pas.addLocal(this)) {
if (!all) {
return;
}
}
// values from refined features
Feature refined = getRefined();
while (refined != null) {
if (pas.addLocalContained(refined, refined.getContainingClassifier())) {
if (!all) {
return;
}
}
if (pas.addLocal(refined)) {
if (!all) {
return;
}
}
refined = refined.getRefined();
}
getPropertyValueInternalHelper(prop, pas, fromInstanceSlaveCall, all);
// feature group TYPE, not an implementation.
if (prop.isInherit()) {
owner.getPropertyValueInternal(prop, pas, fromInstanceSlaveCall, all);
}
}
Aggregations