Class SimpleRevisionCompareModel
- Author:
- Sebastian Homann, Tim Janus
-
Constructor Summary
ConstructorDescriptionConstructs aSimpleRevisionCompareModel
instance with default settings.SimpleRevisionCompareModel
(ASPSolver solver) Constructs aSimpleRevisionCompareModel
instance with the specified ASP solver. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(PropertyChangeListener listener) Adds a property change listener to this model.void
addOperator
(BaseRevisionOperator<?> op) Adds the given revision operator to the set of selectable revision methods.void
Calculates and updates the resulting answer sets from the revision results.void
removeListener
(PropertyChangeListener listener) Removes a property change listener from this model.void
Removes the given revision operator from the set of selectable revision methods.void
Executes the revision operations using the selected left and right revision operators.void
setBeliefbase
(Reader beliefBase) Sets the belief base from a reader.void
setBeliefbase
(String beliefBase) Sets the belief base from a string representation.void
setLeftOperator
(BaseRevisionOperator<?> left) Selects the left revision method.void
setNewBeliefs
(Reader newBeliefs) Sets the new beliefs from a reader.void
setNewBeliefs
(String newBeliefs) Sets the new beliefs from a string representation.void
setRightOperator
(BaseRevisionOperator<?> right) Selects the right revision method.void
Sets theASPSolver
instance for thisSimpleRevisionCompareModel
instance.
-
Constructor Details
-
SimpleRevisionCompareModel
public SimpleRevisionCompareModel()Constructs aSimpleRevisionCompareModel
instance with default settings. -
SimpleRevisionCompareModel
Constructs aSimpleRevisionCompareModel
instance with the specified ASP solver.- Parameters:
solver
- theASPSolver
to be used for solving logic programs- Throws:
NullPointerException
- ifsolver
isnull
-
-
Method Details
-
setSolver
Sets theASPSolver
instance for thisSimpleRevisionCompareModel
instance.- Parameters:
solver
- theASPSolver
to be used for solving logic programs- Throws:
NullPointerException
- ifsolver
isnull
-
addListener
Adds a property change listener to this model.- Parameters:
listener
- thePropertyChangeListener
to be added
-
removeListener
Removes a property change listener from this model.- Parameters:
listener
- thePropertyChangeListener
to 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.
-