コード例 #1
0
  /**
   * The pigeonize/2 method visualizes a list of solutions and a list of interactions using Pigeon.
   *
   * <p>Therefore, we first compile the solutions and the interactions into a Pigeon script, send
   * the script to the Pigeon server, which returns an URL of the resulting Pigeon image.
   *
   * <p>The pigeonize/2 method returns the URL of the Pigeon image that resides on the Pigeon
   * server.
   *
   * @param solutions ... a list of solutions
   * @param interactions ... a list of interactions (i.e. the # Arcs)
   * @return ... a URI of the Pigeon image
   * @throws MiniEugeneException
   */
  public URI pigeonize(List<Component[]> solutions, Set<Interaction> interactions)
      throws MiniEugeneException {

    /*
     * Compilation to Pigeon script
     */

    // SOLUTIONS
    StringBuilder sb = new StringBuilder();

    // components of every solution
    sb.append(this.pigeonizeSolutions(solutions));

    // INTERACTIONS
    sb.append(this.toPigeon(interactions));

    /*
     * Sending the script to the Pigeon server.
     */
    WeyekinPoster.setPigeonText(sb.toString());

    /*
     * return the resulting URL
     */
    return WeyekinPoster.getMyBirdsURL();
  }
コード例 #2
0
  /**
   * The pigeonizeSingle/2 method visualizes one single solution using Pigeon.
   *
   * <p>It takes as input the solution as Component array (Component[]) and a set of interactions
   * among the solution's components.
   *
   * @param solution ... a Component[] representing the solution
   * @param interactions ... a set of interactions representing the Arcs
   * @return
   * @throws MiniEugeneException
   */
  public URI pigeonizeSingle(Component[] solution, Set<Interaction> interactions)
      throws MiniEugeneException {

    /*
     * COMPILATION into a Pigeon script
     */
    StringBuilder sb = new StringBuilder();
    sb.append("fontsize 2.0\r\n");
    for (Component symbol : solution) {
      sb.append(toPigeon(symbol)).append("\r\n");
    }

    // INTERACTIONS
    sb.append(this.toPigeon(interactions));

    /*
     * sending the Pigeon script to the Pigeon server
     */
    WeyekinPoster.setPigeonText(sb.toString());

    /*
     * returning the URL of the Pigeon image
     */
    return WeyekinPoster.getMyBirdsURL();
  }