use of org.sireum.hamr.ir.BTSNameExp in project osate-plugin by sireum.
the class BAVisitor method caseClassifierPropertyReference.
@Override
public Boolean caseClassifierPropertyReference(ClassifierPropertyReference object) {
if (object.getProperties().size() == 2) {
Element firstElem = object.getProperties().get(0).getProperty().getElement();
if (firstElem instanceof PropertyAssociation) {
PropertyAssociation pa = (PropertyAssociation) firstElem;
if (pa.getProperty().getName().equals("Enumerators")) {
Element secondElem = object.getProperties().get(1).getProperty().getElement();
if (secondElem instanceof StringLiteral) {
// TODO can we trust BA that this a valid enum value
StringLiteral sl = ((StringLiteral) secondElem);
BTSNameExp ne = BTSNameExp$.MODULE$.apply(toSimpleName(object.getClassifier().getQualifiedName()), toNone());
push(BTSAccessExp$.MODULE$.apply(ne, sl.getValue(), toNone()));
} else {
throw new RuntimeException("Looks like an enum ref but second element isn't a string lit");
}
}
} else {
throw new RuntimeException("What is this " + object);
}
} else {
throw new RuntimeException("Need to handle this case " + object);
}
return false;
}
use of org.sireum.hamr.ir.BTSNameExp in project osate-plugin by sireum.
the class BAVisitor method caseDataComponentReference.
@Override
public Boolean caseDataComponentReference(DataComponentReference object) {
// name exp followed by access ??
assert (object.getData().size() >= 2);
visit(object.getData().get(0));
BTSNameExp exp = pop();
visit(object.getData().get(1));
String attributeName = pop();
BTSAccessExp bts = BTSAccessExp$.MODULE$.apply(exp, attributeName, toNone());
for (int i = 2; i < object.getData().size(); i++) {
visit(object.getData().get(i));
attributeName = pop();
bts = BTSAccessExp$.MODULE$.apply(bts, attributeName, toNone());
}
push(bts);
return false;
}
Aggregations