Class SimpleRevisionCompareModel

java.lang.Object
org.tweetyproject.lp.asp.beliefdynamics.gui.SimpleRevisionCompareModel

public class SimpleRevisionCompareModel extends Object
The data-model used to compare two different revision approaches. Based on RevisionCompareModel in the beliefdynamics.gui package.
Author:
Sebastian Homann, Tim Janus
  • Constructor Details

    • SimpleRevisionCompareModel

      public SimpleRevisionCompareModel()
      Constructs a SimpleRevisionCompareModel instance with default settings.
    • SimpleRevisionCompareModel

      public SimpleRevisionCompareModel(ASPSolver solver)
      Constructs a SimpleRevisionCompareModel instance with the specified ASP solver.
      Parameters:
      solver - the ASPSolver to be used for solving logic programs
      Throws:
      NullPointerException - if solver is null
  • Method Details

    • setSolver

      public void setSolver(ASPSolver solver)
      Sets the ASPSolver instance for this SimpleRevisionCompareModel instance.
      Parameters:
      solver - the ASPSolver to be used for solving logic programs
      Throws:
      NullPointerException - if solver is null
    • addListener

      public void addListener(PropertyChangeListener listener)
      Adds a property change listener to this model.
      Parameters:
      listener - the PropertyChangeListener to be added
    • removeListener

      public void removeListener(PropertyChangeListener listener)
      Removes a property change listener from this model.
      Parameters:
      listener - the PropertyChangeListener to be removed
    • setLeftOperator

      public void setLeftOperator(BaseRevisionOperator<?> left)
      Selects the left revision method.
      Parameters:
      left - the revision method as an operator reference
      Throws:
      IllegalArgumentException - if the provided operator is not in the list of selectable operators
    • setRightOperator

      public void setRightOperator(BaseRevisionOperator<?> right)
      Selects the right revision method.
      Parameters:
      right - the revision method as an operator reference
      Throws:
      IllegalArgumentException - if the provided operator is not in the list of selectable operators
    • setBeliefbase

      public void setBeliefbase(String beliefBase) throws ParseException
      Sets the belief base from a string representation.
      Parameters:
      beliefBase - the string representation of the belief base
      Throws:
      ParseException - if parsing fails
    • setBeliefbase

      public void setBeliefbase(Reader beliefBase) throws ParseException
      Sets the belief base from a reader.
      Parameters:
      beliefBase - the reader providing the belief base
      Throws:
      ParseException - if parsing fails
    • setNewBeliefs

      public void setNewBeliefs(String newBeliefs) throws ParseException
      Sets the new beliefs from a string representation.
      Parameters:
      newBeliefs - the string representation of the new beliefs
      Throws:
      ParseException - if parsing fails
    • setNewBeliefs

      public void setNewBeliefs(Reader newBeliefs) throws ParseException
      Sets the new beliefs from a reader.
      Parameters:
      newBeliefs - the reader providing the new beliefs
      Throws:
      ParseException - if parsing fails
    • addOperator

      public void addOperator(BaseRevisionOperator<?> op)
      Adds the given revision operator to the set of selectable revision methods.
      Parameters:
      op - Reference to the operator, if the operator is in the set nothing happens
    • removeOperator

      public void removeOperator(BaseRevisionOperator<?> op)
      Removes the given revision operator from the set of selectable revision methods.
      Parameters:
      op - Reference to the operator which is removed if it is member of the set of revision methods.
    • runRevisions

      public void runRevisions()
      Executes the revision operations using the selected left and right revision operators.

      This method checks if both the belief base and new beliefs are non-null. If the left operator is not null, it performs the revision using the left operator and updates the `leftResult` with the result. Similarly, it performs the revision using the right operator and updates the `rightResult`. Property change events are fired to notify listeners of any changes to `leftResult`, `rightResult`, or errors encountered during the revision process.

    • calculateResultingAnswersets

      public void calculateResultingAnswersets()
      Calculates and updates the resulting answer sets from the revision results.

      This method uses the `ASPSolver` to compute the answer sets based on the `leftResult` and `rightResult` obtained from the revision process. It then fires property change events to notify listeners of the resulting answer sets for both left and right revisions. If an error occurs during parsing, an error property change event is fired.