Generating port code in Java

The following operations are used for working with ports and events in Java:

About this task

  • Calling an operation:
    • for port called MyPort and operation called myop:
      getMyPort().myop();
    • for port called MyPort, operation called myop, and multiplicity greater than 1: getMyPortAt(port index).myop(), for example,
      getMyPortAt(2).myop();
  • Generating and sending an event through a port:
    • for port called MyPort and event called evt:
      getMyPort().gen(new evt());
    • for port called MyPort, event called e2, and multiplicity greater than 1: getMyPortAt(port index).gen(new e2()), for example,
      getMyPortAt(2).gen(new e2());
  • Detecting the input port through which an event has been sent:
    • for port called MyPort:
      isPort(getMyPort())
    • for port called MyPort, and multiplicity greater than 1: isPort(getMyPort(port index)), for example,
      isPort(getMyPort(3))