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

ImbafestorImbafestor Member Posts: 2 Contributor I
edited November 2018 in Help
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:

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();
}
}
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?

Best regards
Tagged:

Answers

Sign In or Register to comment.