Class PluginOutput

java.lang.Object
org.tweetyproject.plugin.PluginOutput

public class PluginOutput extends Object
This class provides the output for each plugin to be used in the CLI. Only meant for command line output, not for writing into output files (those are handled within each project as well as parsing input files)
Author:
Bastian Wolf
  • Constructor Details

    • PluginOutput

      public PluginOutput()
      Constructs an empty `PluginOutput` object.

      This constructor initializes the `fields` list to an empty `ArrayList` and sets the `output` string to an empty string. It is useful when starting with an empty output that will be populated later.

    • PluginOutput

      public PluginOutput(ArrayList<OutputField> fields)
      Constructs a `PluginOutput` object with a predefined list of `OutputField` objects.

      This constructor initializes the `PluginOutput` with a provided list of `OutputField` objects. The `output` string is not immediately merged; it can be generated later using the `mergeFields` method.

      Parameters:
      fields - an `ArrayList` of `OutputField` objects to initialize the `PluginOutput`.
  • Method Details

    • addField

      public void addField(OutputField field)
      Adds a new `OutputField` to the list of fields.

      This method appends a new `OutputField` object to the `fields` list. It allows dynamically adding fields to the `PluginOutput` after it has been created.

      Parameters:
      field - the `OutputField` object to be added.
    • addField

      public void addField(String description, String value)
      Adds a new `OutputField` to the list of fields with the specified description and value.

      This method creates a new `OutputField` object with the given description and value, and then appends it to the `fields` list. It provides a convenient way to add fields without explicitly creating `OutputField` objects.

      Parameters:
      description - a `String` representing the description of the output field.
      value - a `String` representing the value of the output field.
    • mergeFields

      public void mergeFields()
      Merges all fields into a single output string.

      This method concatenates the merged output of each `OutputField` in the `fields` list into a single `output` string, separated by new lines. This merged string can then be retrieved using the `getOutput` method.

    • getOutput

      public String getOutput()
      Retrieves the merged output string.

      This method first calls `mergeFields` to ensure the output string is up-to-date, then returns the merged output string that contains the content of all fields.

      Returns:
      a `String` containing the merged output from all fields.