Exemplo n.º 1
0
  /**
   * Add connection port depending on the type of the source.
   *
   * @param source the type of the split
   */
  public void addConnection(BasicPort source) {
    if (source.getType() == Type.EXPLICIT) {
      addPort(new ExplicitInputPort());
      addPort(new ExplicitOutputPort());
      addPort(new ExplicitOutputPort());

      setInterfaceFunctionName("SPLIT_f");
    } else if (source.getType() == Type.IMPLICIT) {
      addPort(new ImplicitInputPort());
      addPort(new ImplicitOutputPort());
      addPort(new ImplicitOutputPort());

      setInterfaceFunctionName("IMPSPLIT_f");
    } else {
      addPort(new ControlPort());
      addPort(new CommandPort());
      addPort(new CommandPort());

      setInterfaceFunctionName("CLKSPLIT_f");
    }

    getChildAt(0).setVisible(false);
    getChildAt(1).setVisible(false);
    getChildAt(2).setVisible(false);
  }
Exemplo n.º 2
0
    /** @return the port on the parent diagram */
    public BasicPort getParentPort() {
      if (parentPort == null) {
        try {
          if (containsSource) {
            parentPort = IOBlocks.getOpposite(target.getClass()).newInstance();
          } else {
            parentPort = IOBlocks.getOpposite(source.getClass()).newInstance();
          }
        } catch (InstantiationException e) {
          Logger.getLogger(RegionToSuperblockAction.class.getName()).severe(e.toString());
        } catch (IllegalAccessException e) {
          Logger.getLogger(RegionToSuperblockAction.class.getName()).severe(e.toString());
        }
      }

      return parentPort;
    }