use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AMASE by loonwerks.
the class SafetyAnnexContentAssist method getNestedDotIDCandidates.
private List<String> getNestedDotIDCandidates(AadlPackage aadlPackage) {
AgreeContract contract = null;
List<String> results = new ArrayList<>();
for (AnnexLibrary annex : AnnexUtil.getAllActualAnnexLibraries(aadlPackage, AgreePackage.eINSTANCE.getAgreeContractLibrary())) {
if (annex instanceof AgreeLibrary) {
contract = (AgreeContract) ((AgreeContractLibrary) annex).getContract();
}
}
if (contract != null) {
for (SpecStatement spec : contract.getSpecs()) {
if (spec instanceof ConstStatement) {
results.add(((ConstStatement) spec).getName());
}
}
}
return results;
}
use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AMASE by loonwerks.
the class SafetyScopeProvider method getNamedElementsFromSpecs.
private Set<NamedElement> getNamedElementsFromSpecs(EList<SpecStatement> agreeSpecs) {
Set<NamedElement> nelms = new HashSet<>();
for (SpecStatement spec : agreeSpecs) {
if (spec instanceof NamedElement) {
nelms.add((NamedElement) spec);
}
if (spec instanceof EqStatement) {
EqStatement eq = (EqStatement) spec;
nelms.addAll(eq.getLhs());
} else if (spec instanceof InputStatement) {
nelms.addAll(((InputStatement) spec).getLhs());
} else if (spec instanceof EnumStatement) {
nelms.addAll(((EnumStatement) spec).getEnums());
}
}
return nelms;
}
use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AMASE by loonwerks.
the class SafetyScopeProvider method getNamedElementsFromSafetySpecs.
private Set<NamedElement> getNamedElementsFromSafetySpecs(EList<edu.umn.cs.crisys.safety.safety.SpecStatement> safetySpecs) {
Set<NamedElement> nelms = new HashSet<>();
EList<FaultSubcomponent> faultDefs = null;
for (SpecStatement spec : safetySpecs) {
if (spec instanceof FaultStatement) {
FaultStatement fs = (FaultStatement) spec;
faultDefs = fs.getFaultDefinitions();
for (FaultSubcomponent fsub : faultDefs) {
if (fsub instanceof SafetyEqStatement) {
SafetyEqStatement seq = (SafetyEqStatement) fsub;
if (seq instanceof EqValue) {
EqValue eqVal = (EqValue) seq;
nelms.addAll(eqVal.getLhs());
} else if (seq instanceof IntervalEq) {
IntervalEq eqVal = (IntervalEq) seq;
nelms.add(eqVal.getLhs_int());
}
}
}
// nelms.add((NamedElement) spec);
}
}
return nelms;
}
use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AGREE by loonwerks.
the class AgreeAnnexContentAssist method getNestedDotIDCandidates.
private List<String> getNestedDotIDCandidates(AadlPackage aadlPackage) {
AgreeContract contract = null;
List<String> results = new ArrayList<>();
for (AnnexLibrary annex : AnnexUtil.getAllActualAnnexLibraries(aadlPackage, AgreePackage.eINSTANCE.getAgreeContractLibrary())) {
if (annex instanceof AgreeLibrary) {
contract = (AgreeContract) ((AgreeContractLibrary) annex).getContract();
}
}
if (contract != null) {
for (SpecStatement spec : contract.getSpecs()) {
if (spec instanceof ConstStatement) {
results.add(((ConstStatement) spec).getName());
}
}
}
return results;
}
use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AGREE by loonwerks.
the class AgreeASTBuilder method getReachableStatements.
private List<AgreeStatement> getReachableStatements(EList<SpecStatement> specs, Map<String, jkind.lustre.Expr> rewriteMap) {
List<AgreeStatement> reachables = new ArrayList<>();
for (SpecStatement spec : specs) {
if (spec instanceof ReachableStatement) {
ReachableStatement reachable = (ReachableStatement) spec;
if (reachable.getExpr() != null) {
reachables.add(new AgreeStatement(reachable.getStr(), new jkind.lustre.UnaryExpr(jkind.lustre.UnaryOp.NOT, doSwitch(reachable.getExpr()).accept(new SubstitutionVisitor(rewriteMap))), spec));
} else {
PatternStatement pattern = reachable.getPattern();
AgreeStatement patStatement = new AgreePatternBuilder(reachable.getStr(), reachable, this).doSwitch(pattern);
patStatement.expr = new jkind.lustre.UnaryExpr(jkind.lustre.UnaryOp.NOT, patStatement.expr.accept(new SubstitutionVisitor(rewriteMap)));
reachables.add(patStatement);
}
}
}
return reachables;
}
Aggregations