public abstract class Trigger<E> extends Object
Trigger
stores a set cut states indicating whether
specific cut conditions associated with a trigger were met or not as
well as the state of the overall trigger. It is the responsibility of
implementing classes to specify the supported cut states and also
to define when the trigger conditions are met.Modifier and Type | Field and Description |
---|---|
private Map<String,Boolean> |
passMap |
private boolean |
passTrigger |
private E |
source |
private int |
triggerNum |
Modifier | Constructor and Description |
---|---|
protected |
Trigger(E source)
Creates a new
Trigger object with the argument
specifying the object from whence the trigger state is derived. |
protected |
Trigger(E source,
int triggerNum)
Creates a new
Trigger object with the argument
specifying the object from whence the trigger state is derived. |
Modifier and Type | Method and Description |
---|---|
protected void |
addValidCut(String cut)
Adds a cut to the set of cuts tracked by this trigger.
|
protected boolean |
getCutState(String cut)
Gets the state of the specified cut.
|
int |
getTriggerNumber()
Gets the number of the trigger.
|
E |
getTriggerSource()
Gets the object to which the trigger cuts are applied.
|
boolean |
getTriggerState()
Gets whether the conditions for the trigger were met.
|
private boolean |
isValidTrigger()
Checks whether the all of the trigger cut conditions were met.
|
protected void |
removeValidCut(String cut)
Removes a cut from the set of cuts tracked by the trigger.
|
protected void |
setCutState(String cut,
boolean state)
Sets whether the conditions for the specified cut were met.
|
protected boolean |
supportsCut(String cut)
Indicates whether the specified cut state is tracked by this
object or not.
|
private boolean passTrigger
private final E source
private final int triggerNum
protected Trigger(E source)
Trigger
object with the argument
specifying the object from whence the trigger state is derived.source
- - The trigger source object.protected Trigger(E source, int triggerNum)
Trigger
object with the argument
specifying the object from whence the trigger state is derived.source
- - The trigger source object.triggerNum
- - The number of the trigger.protected void addValidCut(String cut)
cut
- - The identifier for the cut.protected boolean getCutState(String cut) throws IllegalArgumentException
cut
- - The identifier for the cut.true
if the conditions for the
specified cut were met and false
otherwise.IllegalArgumentException
- Occurs if the specified cut
is not supported by the object.public int getTriggerNumber()
-1
.int
.public E getTriggerSource()
public boolean getTriggerState()
true
if the conditions for the
trigger were met and false
if they were not.protected void removeValidCut(String cut)
cut
- - The identifier for the cut.private boolean isValidTrigger()
true
if all of the cut conditions
were met and false
otherwise.protected void setCutState(String cut, boolean state) throws IllegalArgumentException
cut
- - The identifier for the cut.state
- - true
indicates that the conditions
for the cut were met and false
that they were not.IllegalArgumentException
- Occurs if the specified cut
is not supported by the object.protected boolean supportsCut(String cut)
cut
- - The identifier for the cut.true
if the cut state is tracked
by this object and false
otherwise.Copyright © 2019. All rights reserved.