The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Problem when adding Operators in code
Imbafestor
Member Posts: 2 Contributor I
Hey,
i am writing an extension in which i implement a own super operator. Now i want to fill a subprocess with an operator in code, but the problem is, that the operator keeps getting added two times (Even the constructor of my superoperator is called several times when adding only one instance in rm).
Here is my code:
Best regards
i am writing an extension in which i implement a own super operator. Now i want to fill a subprocess with an operator in code, but the problem is, that the operator keeps getting added two times (Even the constructor of my superoperator is called several times when adding only one instance in rm).
Here is my code:
I found a topic with the same problem (https://rapid-i.com/rapidforum/index.php/topic,3549.0.html) but no answers. Is it a bug or am I missing something?
public MySuperOperator(OperatorDescription description)
{
super(description, "SubProcess 0", "SubProcess 1");
createSubProcess();
}
private void createSubProcess()
{
ExecutionUnit sub = getSubprocess(0);
try {
if(sub.getOperators().size() < 1) // doesn't prevent adding two operators
{
sub.addOperator(OperatorService.createOperator(MultiplyLabelBy.class));
}
} catch (OperatorCreationException e) {
e.printStackTrace();
}
}
Best regards
Tagged:
0
Answers