use of de.be4.classicalb.core.parser.node.AEqualPredicate in project probparsers by bendisposto.
the class ASTBuilder method createEqualPredicate.
public static AEqualPredicate createEqualPredicate(TIdentifierLiteral old, final String value) {
TIdentifierLiteral e = NodeCloner.cloneNode(old);
AIdentifierExpression aIdentifier = createAIdentifierExpression(e);
final AEqualPredicate equal = new AEqualPredicate(aIdentifier, new AStringExpression(new TStringLiteral(value)));
equal.setStartPos(e.getStartPos());
equal.setEndPos(e.getEndPos());
return equal;
}
use of de.be4.classicalb.core.parser.node.AEqualPredicate in project probparsers by bendisposto.
the class BMachine method addPropertiesPredicates.
public void addPropertiesPredicates(Map<String, String> constantStringValues) {
if (constantStringValues.size() == 0) {
return;
}
APropertiesMachineClause clause = new APropertiesMachineClause();
this.parseUnit.getMachineClauses().add(clause);
List<PPredicate> predList = new ArrayList<>();
for (Entry<String, String> entry : constantStringValues.entrySet()) {
AIdentifierExpression identifier = createIdentifier(entry.getKey());
AStringExpression value = new AStringExpression(new TStringLiteral(entry.getValue()));
AEqualPredicate equal = new AEqualPredicate(identifier, value);
predList.add(equal);
}
clause.setPredicates(createConjunction(predList));
}
use of de.be4.classicalb.core.parser.node.AEqualPredicate in project probparsers by bendisposto.
the class ASTPrologTest method testEvent.
@Test
public void testEvent() throws BCompoundException {
final AEventBModelParseUnit model = new AEventBModelParseUnit();
model.setName(new TIdentifierLiteral("mm"));
final AEventsModelClause events = new AEventsModelClause();
model.setModelClauses(Arrays.asList((PModelClause) events));
AEvent event = new AEvent();
events.setEvent(Arrays.asList((PEvent) event));
event.setEventName(new TIdentifierLiteral("testevent"));
event.setVariables(Arrays.asList(createId("param")));
event.setGuards(Arrays.asList((PPredicate) new ATruthPredicate()));
PSubstitution subst1 = new AAssignSubstitution(Arrays.asList(createId("x")), Arrays.asList(createId("param")));
event.setAssignments(Arrays.asList(subst1));
PWitness witness = new AWitness(new TIdentifierLiteral("ab"), new AEqualPredicate(createId("ab"), createId("y")));
event.setWitness(Arrays.asList(witness));
event.setRefines(Arrays.asList(new TIdentifierLiteral("abstract1"), new TIdentifierLiteral("abstract2")));
checkAST(0, "event_b_model($,mm,[events($,[" + "event($,testevent,[abstract1,abstract2],[identifier($,param)],[truth($)],[]," + "[assign($,[identifier($,x)],[identifier($,param)])]," + "[witness($,identifier(%,ab),equal($,identifier($,ab),identifier($,y)))])])])", model);
}
Aggregations