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
right way to add outputports to multiply operator
simon_knoll
Member Posts: 40 Contributor II
Hello there,
im using the multiply operator in my java application.
to add a output port i wrote a small helper method
greetings
simon
im using the multiply operator in my java application.
to add a output port i wrote a small helper method
now im asking me if im using it the right way, because i think that ive done just a workaround.
private static void addport(String input, String output, Operator operator)
throws OperatorException {
InputPort inputPort = operator.getInputPorts().getPortByName(input);
OutputPort outputPort = operator.getOutputPorts().createPort(output);
outputPort.deliver(inputPort.getData());
}
greetings
simon
Tagged:
0
Answers
private final OutputPortExtender outPort = new OutputPortExtender("port name", getOutputPorts());
Every time you connect this output port, a new port would be created automatically.
be aware though that every created port would have name of the form "port name #" where # is an index of port in order of creation.
regards simon
In addition to what timur explained perfectly, let me say that if you use the regular multiply operator, you will not need to create a PortExtender yourself since the multiply operator already uses one. Just connect your ports one after another to getPortByIndex(numOfPorts - 1) and you will always have a new port created automatically for you.
Cheers,
Simon