Ejemplo n.º 1
0
  /**
   * Probe a port
   *
   * @param port The port to probe.
   * @return The probe report.
   */
  public static String portInfo(TypedIOPort port) {

    String width = "";
    try {
      width = Integer.valueOf(port.getWidth()).toString();
    } catch (IllegalActionException ex) {
      width = "Failed to get width of port " + port.getFullName() + ex;
    }

    String description = "";
    try {
      description = port.description();
    } catch (IllegalActionException ex) {
      description = "Failed to get the description of port " + port.getFullName() + ": " + ex;
    }
    String msg = "Port Info: \n";

    msg += "    getName():         " + port.getName() + "\n";
    msg += "    getWidth():        " + width + "\n";
    msg += "    isInput():         " + port.isInput() + "\n";
    msg += "    isOutput():        " + port.isOutput() + "\n";
    msg += "    isMultiport():     " + port.isMultiport() + "\n";
    msg += "    className():       " + port.getClassName() + "\n";
    msg += "    getDisplayName():  " + port.getDisplayName() + "\n";
    msg += "    getElementName():  " + port.getElementName() + "\n";
    msg += "    getFullName():     " + port.getFullName() + "\n";
    msg += "    getSource():       " + port.getSource() + "\n";
    msg += "    description():     " + description + "\n";
    msg += "    toString():        " + port + "\n";

    return msg;
  }