use of org.osate.aadl2.EventDataPort in project osate2 by osate.
the class AbstractTypeImpl method createOwnedEventDataPort.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EventDataPort createOwnedEventDataPort() {
EventDataPort newOwnedEventDataPort = (EventDataPort) create(Aadl2Package.eINSTANCE.getEventDataPort());
getOwnedEventDataPorts().add(newOwnedEventDataPort);
return newOwnedEventDataPort;
}
use of org.osate.aadl2.EventDataPort in project osate2 by osate.
the class FeatureGroupTypeImpl method createOwnedEventDataPort.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EventDataPort createOwnedEventDataPort() {
EventDataPort newOwnedEventDataPort = (EventDataPort) create(Aadl2Package.eINSTANCE.getEventDataPort());
getOwnedEventDataPorts().add(newOwnedEventDataPort);
return newOwnedEventDataPort;
}
use of org.osate.aadl2.EventDataPort in project AMASE by loonwerks.
the class SafetyScopeProvider method scope_GetPropertyExpr_prop.
protected IScope scope_GetPropertyExpr_prop(GetPropertyExpr ctx, EReference ref) {
IScope prevScope = prevScope(ctx, ref);
ComponentRef cr = ctx.getComponentRef();
if (cr instanceof ThisRef) {
List<Property> ps = new ArrayList<>();
EObject container = ctx.getContainingClassifier();
while (container != null) {
if (container instanceof Classifier) {
List<PropertyAssociation> pas = ((Classifier) container).getAllPropertyAssociations();
for (PropertyAssociation pa : pas) {
ps.add(pa.getProperty());
}
container = ((Classifier) container).eContainer();
} else if (container instanceof AadlPackage) {
for (PropertySet propSet : EcoreUtil2.getAllContentsOfType(container, PropertySet.class)) {
for (Property p : propSet.getOwnedProperties()) {
ps.add(p);
}
// =======
// EList<EObject> refs = null;
//
// if (container instanceof NestedDotID) {
// NestedDotID parent = (NestedDotID) container;
// refs = parent.eCrossReferences();
//
// if (refs.size() != 1) {
// return new HashSet<>(); // this will throw a parsing error
// }
// container = refs.get(0); // figure out what this type this portion
//
// // of the nest id is so we can figure out
// // what we could possibly link to
//
// if (container instanceof ThreadSubcomponent) {
// container = ((ThreadSubcomponent) container).getComponentType();
// result.addAll(getAadlElements(container));
// } else if (container instanceof Subcomponent) {
// container = ((Subcomponent) container).getComponentImplementation();
// if (container == null) { // no implementation is provided
// container = refs.get(0);
// container = ((Subcomponent) container).getClassifier();
// }
// result.addAll(getAadlElements(container));
// } else if (container instanceof DataPort) {
// container = ((DataPort) container).getDataFeatureClassifier();
// result.addAll(getAadlElements(container));
// } else if (container instanceof EventDataPort) {
// container = ((EventDataPort) container).getDataFeatureClassifier();
// result.addAll(getAadlElements(container));
// } else if (container instanceof AadlPackage) {
// result.addAll(getAadlElements(container));
// } else if (container instanceof FeatureGroupImpl) {
// container = ((FeatureGroupImpl) container).getAllFeatureGroupType();
// result.addAll(getAadlElements(container));
// } else if (container instanceof Arg || container instanceof ConstStatement) {
// Type type;
//
// if (container instanceof Arg) {
// type = ((Arg) container).getType();
// } else {
// type = ((ConstStatement) container).getType();
// }
//
// if (type instanceof RecordType) {
// DoubleDotRef elID = ((RecordType) type).getRecord();
// NamedElement namedEl = elID.getElm();
//
// if (namedEl instanceof ComponentImplementation) {
// ComponentImplementation componentImplementation = (ComponentImplementation) namedEl;
// EList<Subcomponent> subs = componentImplementation.getAllSubcomponents();
// result.addAll(subs);
// } else if (namedEl instanceof RecordDefExpr) {
// result.addAll(((RecordDefExpr) namedEl).getArgs());
// >>>>>>> origin/develop
}
container = null;
} else {
container = container.eContainer();
}
}
return Scopes.scopeFor(ps, prevScope);
} else if (cr instanceof DoubleDotRef) {
NamedElement ne = ((DoubleDotRef) cr).getElm();
if (ne instanceof Subcomponent) {
List<PropertyAssociation> pas = ((Subcomponent) ne).getOwnedPropertyAssociations();
List<Property> ps = new ArrayList<>();
for (PropertyAssociation pa : pas) {
ps.add(pa.getProperty());
}
return Scopes.scopeFor(ps, prevScope);
}
}
return IScope.NULLSCOPE;
}
use of org.osate.aadl2.EventDataPort in project AMASE by loonwerks.
the class SafetyAnnexContentAssist method getNestedDotIDCandidates.
private List<String> getNestedDotIDCandidates(SelectionExpr id) {
NamedElement base = ((NamedElmExpr) id).getElm();
NamedElement namedEl = null;
if (base instanceof Arg) {
Type type = ((Arg) base).getType();
DoubleDotRef elID = ((DoubleDotRef) type);
namedEl = elID.getElm();
} else if (base instanceof DataPort) {
namedEl = ((DataPort) base).getDataFeatureClassifier();
} else if (base instanceof EventDataPort) {
namedEl = ((EventDataPort) base).getDataFeatureClassifier();
} else if (base instanceof AadlPackage) {
return getNestedDotIDCandidates((AadlPackage) base);
} else {
return new ArrayList<>();
}
return getNestedDotIDCandidates(namedEl);
}
use of org.osate.aadl2.EventDataPort in project VERDICT by ge-high-assurance.
the class Aadl2Vdm method translateThreadGroupTypeObjects.
// End of translateProcessTypeObjects
/**
* Analyzing each threadGroupType:
* 1. Determine if it is a lower-level system or higher-level system
* 2. If lower-level, add to componentType list attribute of Model
* 2.1 Populate the port, contract, cyberRel, safetyRel, event, id, compCategory
* fields of componentType of the Model object
* 3. If higher-level, assign to Model
* 3.1 Populate the safetyReq
* cyberReq, mission fields of Model object
* @param threadGroupTypes
* @param m1
* @return
*/
public Model translateThreadGroupTypeObjects(List<ThreadGroupType> threadGroupTypes, Model m1, HashSet<String> dataTypeDecl) {
for (ThreadGroupType tgType : threadGroupTypes) {
// variables for unpacking tgType
List<Event> events = new ArrayList<>();
List<CyberMission> missionReqs = new ArrayList<>();
List<CyberRel> cyberRels = new ArrayList<>();
List<SafetyRel> safetyRels = new ArrayList<>();
List<CyberReq> cyberReqs = new ArrayList<>();
List<SafetyReq> safetyReqs = new ArrayList<>();
// a flag to check if a higher -level component has already been found
boolean higher_flag = false;
// unpacking tgType
for (AnnexSubclause annex : tgType.getOwnedAnnexSubclauses()) {
if (annex.getName().equalsIgnoreCase("verdict")) {
Verdict verdictAnnex = VerdictUtil.getVerdict(annex);
for (Statement statement : verdictAnnex.getElements()) {
if (statement instanceof Event) {
events.add((Event) statement);
} else if (statement instanceof CyberMission) {
missionReqs.add((CyberMission) statement);
} else if (statement instanceof CyberReq) {
cyberReqs.add((CyberReq) statement);
} else if (statement instanceof CyberRel) {
cyberRels.add((CyberRel) statement);
} else if (statement instanceof SafetyReq) {
safetyReqs.add((SafetyReq) statement);
} else if (statement instanceof SafetyRel) {
safetyRels.add((SafetyRel) statement);
}
}
}
}
/**
* For every ThreadGroupType,
* populate the id, name, compCateg, port, event,
* cyberRel, and safetyRel fields of componentType
* and add it to the list of componentType
* of the Model object
*/
if (true) {
// No Filter-- do for all System Types
// to pack the memType as a VDM component
verdict.vdm.vdm_model.ComponentType packComponent = new verdict.vdm.vdm_model.ComponentType();
// Note: Not populating "contract" for now
// ISSUE: There is no getId() function for memoryType
packComponent.setId(tgType.getQualifiedName());
// populating "name"
packComponent.setName(tgType.getName());
// populating "compCateg"
packComponent.setCompCateg(tgType.getCategory().getName());
// ISSUE: no getOwnedBusAccesses
// get all data accesses and store them as ports
List<DataAccess> dataAccesses = tgType.getOwnedDataAccesses();
// checking each dataAccess's details and adding it to the port list
for (DataAccess dataAccess : dataAccesses) {
String portName = dataAccess.getName();
String modeString = "in";
if (dataAccess.getKind() == AccessType.PROVIDES) {
modeString = "providesDataAccess";
} else if (dataAccess.getKind() == AccessType.REQUIRES) {
modeString = "requiresDataAccess";
}
verdict.vdm.vdm_model.Port newPort = createVdmPort(portName, modeString, dataAccess.getQualifiedName());
// Note: Not populating "type" for now
// ISSUE: "probe", "event", and "id" not found in DataPort class or superclass
// add to port list of component
packComponent.getPort().add(newPort);
}
// End of checking each dataAccess
// get all ports
List<DataPort> dataPorts = tgType.getOwnedDataPorts();
// checking each port's mode and name and adding it to the port list
for (DataPort dataPort : dataPorts) {
verdict.vdm.vdm_model.Port newPort = createVdmPort(dataPort, m1, dataTypeDecl);
// ISSUE: "probe", "event", and "id" not found in DataPort class or superclass
// add to port list of component
packComponent.getPort().add(newPort);
}
// End of checking each port
// get all event data ports
List<EventDataPort> eventDataPorts = tgType.getOwnedEventDataPorts();
for (EventDataPort eventDataPort : eventDataPorts) {
verdict.vdm.vdm_model.Port newPort = createVdmPort(eventDataPort, m1, dataTypeDecl);
// add to port list of component
packComponent.getPort().add(newPort);
}
// get all event ports
List<EventPort> eventPorts = tgType.getOwnedEventPorts();
for (EventPort eventPort : eventPorts) {
verdict.vdm.vdm_model.Port newPort = createVdmEventPort(eventPort);
// add to port list of component
packComponent.getPort().add(newPort);
}
// packing all events and adding to component
for (Event anEvent : events) {
// To pack the event as a VDM event
verdict.vdm.vdm_model.Event packEvent = createVdmEvent(anEvent);
// adding to the list of component's events
packComponent.getEvent().add(packEvent);
}
// packing all cyberRels and adding to component
for (CyberRel aCyberRel : cyberRels) {
// To pack the cyberRel as a VDM event
verdict.vdm.vdm_model.CyberRel packCyberRel = createVdmCyberRel(aCyberRel);
// adding to the list of component's Cyber relations
packComponent.getCyberRel().add(packCyberRel);
}
// packing all safetyRels and adding to component
for (SafetyRel aSafetyRel : safetyRels) {
// To pack the safetyRel as a VDM event
verdict.vdm.vdm_model.SafetyRel packSafetyRel = createVdmSafetyRel(aSafetyRel);
// adding to the list of component's Safety relations
packComponent.getSafetyRel().add(packSafetyRel);
}
// End of packing all safetyRels
// adding to the list of componenmemTypes of the Model object
m1.getComponentType().add(packComponent);
}
/**
* If a high-level system
* populate the name, safetyReq, cyberReq, and mission
* for the model object
*/
if (!cyberReqs.isEmpty() || !safetyReqs.isEmpty() || !missionReqs.isEmpty()) {
// checking if a high-level system has already been found
if (higher_flag == false) {
higher_flag = true;
} else {
System.out.println("Warning: Multiple high-level systems detected!");
}
// populating name
m1.setName(tgType.getName());
// packing all safetyReqs and adding to model
for (SafetyReq aSafetyReq : safetyReqs) {
// To pack the safettReq as a VDM event
verdict.vdm.vdm_model.SafetyReq packSafetyReq = createVdmSafetyReq(aSafetyReq, tgType.getFullName());
// adding to the list of model's Safety requirements
m1.getSafetyReq().add(packSafetyReq);
}
// packing all cyberReqs and adding to model
for (CyberReq aCyberReq : cyberReqs) {
// To pack the safettReq as a VDM event
verdict.vdm.vdm_model.CyberReq packCyberReq = createVdmCyberReq(aCyberReq, tgType.getFullName());
// adding to the list of model's Cyber requirements
m1.getCyberReq().add(packCyberReq);
}
// packing all missionReqs and adding to model
for (CyberMission aMission : missionReqs) {
// To pack the safettReq as a VDM event
verdict.vdm.vdm_model.Mission packMission = createVdmMission(aMission);
// adding to the list of model's Mission
m1.getMission().add(packMission);
}
// End of packing all missionReqs
}
// End of if a higher-level system
}
// returning the populated Model
return m1;
}
Aggregations