Search in sources :

Example 1 with GetMachineOperationInfos

use of de.prob.animator.command.GetMachineOperationInfos in project prob2 by bendisposto.

the class GetMachineOperationInfosCommandTest method testGetMachineOperationInfosCommand.

@Test
public void testGetMachineOperationInfosCommand() throws IOException, ModelTranslationError {
    System.out.println(Main.getProBDirectory());
    System.out.println(api.getVersion());
    s = api.b_load("src" + File.separator + "test" + File.separator + "resources" + File.separator + "b" + File.separator + "ExampleMachine.mch");
    assertNotNull(s);
    GetMachineOperationInfos command = new GetMachineOperationInfos();
    s.execute(command);
    System.out.println(command.getOperationInfos());
    OperationInfo operationInfo = command.getOperationInfos().get(0);
    assertEquals("Foo", operationInfo.getOperationName());
    assertEquals("p1", operationInfo.getParameterNames().get(0));
    assertEquals("p2", operationInfo.getParameterNames().get(1));
    assertEquals("out1", operationInfo.getOutputParameterNames().get(0));
    assertEquals("out2", operationInfo.getOutputParameterNames().get(1));
}
Also used : OperationInfo(de.prob.animator.command.GetMachineOperationInfos.OperationInfo) GetMachineOperationInfos(de.prob.animator.command.GetMachineOperationInfos) Test(org.junit.Test)

Example 2 with GetMachineOperationInfos

use of de.prob.animator.command.GetMachineOperationInfos in project prob2 by bendisposto.

the class LoadedMachine method getOperations.

private Map<String, OperationInfo> getOperations() {
    if (this.machineOperationInfos == null) {
        GetMachineOperationInfos command = new GetMachineOperationInfos();
        this.stateSpace.execute(command);
        this.machineOperationInfos = command.getOperationInfos().stream().collect(Collectors.toMap(OperationInfo::getOperationName, i -> i));
    }
    return this.machineOperationInfos;
}
Also used : OperationInfo(de.prob.animator.command.GetMachineOperationInfos.OperationInfo) GetMachineOperationInfos(de.prob.animator.command.GetMachineOperationInfos)

Aggregations

GetMachineOperationInfos (de.prob.animator.command.GetMachineOperationInfos)2 OperationInfo (de.prob.animator.command.GetMachineOperationInfos.OperationInfo)2 Test (org.junit.Test)1