Package tools.refinery.interpreter.api
Class MatchUpdateAdapter<Match extends IPatternMatch>
java.lang.Object
tools.refinery.interpreter.api.MatchUpdateAdapter<Match>
- All Implemented Interfaces:
IMatchUpdateListener<Match>
public class MatchUpdateAdapter<Match extends IPatternMatch>
extends Object
implements IMatchUpdateListener<Match>
A default implementation of
IMatchUpdateListener
that contains two match processors, one for appearance, one
for disappearance. Any of the two can be null; in this case, corresponding notifications will be ignored.
Instantiate using either constructor.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an instance without any match processors registered yet.MatchUpdateAdapter
(Consumer<Match> appearCallback, Consumer<Match> disappearCallback) Constructs an instance by specifying match processors. -
Method Summary
Modifier and TypeMethodDescriptionvoid
notifyAppearance
(Match match) Will be invoked on each new match that appears.void
notifyDisappearance
(Match match) Will be invoked on each existing match that disappears.void
setAppearCallback
(Consumer<Match> appearCallback) void
setDisappearCallback
(Consumer<Match> disappearCallback)
-
Constructor Details
-
MatchUpdateAdapter
public MatchUpdateAdapter()Constructs an instance without any match processors registered yet. UsesetAppearCallback(Consumer)
andsetDisappearCallback(Consumer)
to specify optional match processors for match appearance and disappearance, respectively. -
MatchUpdateAdapter
Constructs an instance by specifying match processors.- Parameters:
appearCallback
- a match processor that will be invoked on each new match that appears. If null, no callback will be executed on match appearance. SeeConsumer
for details on how to implement.disappearCallback
- a match processor that will be invoked on each existing match that disappears. If null, no callback will be executed on match disappearance. SeeConsumer
for details on how to implement.- Since:
- 2.0
-
-
Method Details
-
getAppearCallback
- Returns:
- the match processor that will be invoked on each new match that appears. If null, no callback will be executed on match appearance.
- Since:
- 2.0
-
setAppearCallback
- Parameters:
appearCallback
- a match processor that will be invoked on each new match that appears. If null, no callback will be executed on match appearance. SeeConsumer
for details on how to implement.- Since:
- 2.0
-
getDisappearCallback
- Returns:
- the match processor that will be invoked on each existing match that disappears. If null, no callback will be executed on match disappearance.
- Since:
- 2.0
-
setDisappearCallback
- Parameters:
disappearCallback
- a match processor that will be invoked on each existing match that disappears. If null, no callback will be executed on match disappearance. SeeConsumer
for details on how to implement.- Since:
- 2.0
-
notifyAppearance
Description copied from interface:IMatchUpdateListener
Will be invoked on each new match that appears.- Specified by:
notifyAppearance
in interfaceIMatchUpdateListener<Match extends IPatternMatch>
- Parameters:
match
- the match that has just appeared.
-
notifyDisappearance
Description copied from interface:IMatchUpdateListener
Will be invoked on each existing match that disappears.- Specified by:
notifyDisappearance
in interfaceIMatchUpdateListener<Match extends IPatternMatch>
- Parameters:
match
- the match that has just disappeared.
-