Class SimpleRevisionCompareModel
- Author:
- Sebastian Homann, Tim Janus
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aSimpleRevisionCompareModelinstance with default settings.SimpleRevisionCompareModel(ASPSolver solver) Constructs aSimpleRevisionCompareModelinstance with the specified ASP solver. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(PropertyChangeListener listener) Adds a property change listener to this model.voidaddOperator(BaseRevisionOperator<?> op) Adds the given revision operator to the set of selectable revision methods.voidCalculates and updates the resulting answer sets from the revision results.voidremoveListener(PropertyChangeListener listener) Removes a property change listener from this model.voidRemoves the given revision operator from the set of selectable revision methods.voidExecutes the revision operations using the selected left and right revision operators.voidsetBeliefbase(Reader beliefBase) Sets the belief base from a reader.voidsetBeliefbase(String beliefBase) Sets the belief base from a string representation.voidsetLeftOperator(BaseRevisionOperator<?> left) Selects the left revision method.voidsetNewBeliefs(Reader newBeliefs) Sets the new beliefs from a reader.voidsetNewBeliefs(String newBeliefs) Sets the new beliefs from a string representation.voidsetRightOperator(BaseRevisionOperator<?> right) Selects the right revision method.voidSets theASPSolverinstance for thisSimpleRevisionCompareModelinstance.
-
Constructor Details
-
SimpleRevisionCompareModel
public SimpleRevisionCompareModel()Constructs aSimpleRevisionCompareModelinstance with default settings. -
SimpleRevisionCompareModel
Constructs aSimpleRevisionCompareModelinstance with the specified ASP solver.- Parameters:
solver- theASPSolverto be used for solving logic programs- Throws:
NullPointerException- ifsolverisnull
-
-
Method Details
-
setSolver
Sets theASPSolverinstance for thisSimpleRevisionCompareModelinstance.- Parameters:
solver- theASPSolverto be used for solving logic programs- Throws:
NullPointerException- ifsolverisnull
-
addListener
Adds a property change listener to this model.- Parameters:
listener- thePropertyChangeListenerto be added
-
removeListener
Removes a property change listener from this model.- Parameters:
listener- thePropertyChangeListenerto be removed
-
setLeftOperator
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
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
Sets the belief base from a string representation.- Parameters:
beliefBase- the string representation of the belief base- Throws:
ParseException- if parsing fails
-
setBeliefbase
Sets the belief base from a reader.- Parameters:
beliefBase- the reader providing the belief base- Throws:
ParseException- if parsing fails
-
setNewBeliefs
Sets the new beliefs from a string representation.- Parameters:
newBeliefs- the string representation of the new beliefs- Throws:
ParseException- if parsing fails
-
setNewBeliefs
Sets the new beliefs from a reader.- Parameters:
newBeliefs- the reader providing the new beliefs- Throws:
ParseException- if parsing fails
-
addOperator
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
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.
-