Package org.eclipse.jface.bindings
Class TriggerSequence
- java.lang.Object
-
- org.eclipse.jface.bindings.TriggerSequence
-
- Direct Known Subclasses:
KeySequence
public abstract class TriggerSequence extends Object
A sequence of one or more triggers. None of these triggers may be
null
.- Since:
- 3.1
-
-
Constructor Summary
Constructors Constructor Description TriggerSequence(Trigger[] triggers)
Constructs a new instance ofTriggerSequence
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
endsWith(TriggerSequence triggerSequence, boolean equals)
Returns whether or not this key sequence ends with the given key sequence.boolean
equals(Object object)
abstract String
format()
Formats this trigger sequence into the current default look.abstract TriggerSequence[]
getPrefixes()
Returns a list of prefixes for the current sequence.Trigger[]
getTriggers()
Returns the list of triggers.int
hashCode()
boolean
isEmpty()
Returns whether or not this trigger sequence is empty.boolean
startsWith(TriggerSequence triggerSequence, boolean equals)
Returns whether or not this trigger sequence starts with the given trigger sequence.
-
-
-
Field Detail
-
hashCode
protected transient int hashCode
The hash code for this object. This value is computed lazily, and marked as invalid when one of the values on which it is based changes. This values isHASH_CODE_NOT_COMPUTED
iff the hash code has not yet been computed.
-
triggers
protected final Trigger[] triggers
The list of trigger in this sequence. This value is nevernull
, and never containsnull
elements.
-
-
Constructor Detail
-
TriggerSequence
public TriggerSequence(Trigger[] triggers)
Constructs a new instance ofTriggerSequence
.- Parameters:
triggers
- The triggers contained within this sequence; must not benull
or containnull
elements. May be empty.
-
-
Method Detail
-
endsWith
public final boolean endsWith(TriggerSequence triggerSequence, boolean equals)
Returns whether or not this key sequence ends with the given key sequence.- Parameters:
triggerSequence
- a trigger sequence. Must not benull
.equals
- whether or not an identical trigger sequence should be considered as a possible match.- Returns:
true
, iff the given trigger sequence ends with this trigger sequence.
-
format
public abstract String format()
Formats this trigger sequence into the current default look.- Returns:
- A string representation for this trigger sequence using the
default look; never
null
.
-
getPrefixes
public abstract TriggerSequence[] getPrefixes()
Returns a list of prefixes for the current sequence. A prefix is any leading subsequence in a
TriggerSequence
. A prefix is also an instance ofTriggerSequence
.For example, consider a trigger sequence that consists of four triggers: A, B, C and D. The prefixes would be "", "A", "A B", and "A B C". The list of prefixes must always be the same as the size of the trigger list.
- Returns:
- The array of possible prefixes for this sequence. This array must
not be
null
, but may be empty. It must only contains instances ofTriggerSequence
.
-
getTriggers
public final Trigger[] getTriggers()
Returns the list of triggers.- Returns:
- The triggers; never
null
and guaranteed to only contain instances ofTrigger
.
-
isEmpty
public final boolean isEmpty()
Returns whether or not this trigger sequence is empty.- Returns:
true
, iff the trigger sequence is empty.
-
startsWith
public final boolean startsWith(TriggerSequence triggerSequence, boolean equals)
Returns whether or not this trigger sequence starts with the given trigger sequence.- Parameters:
triggerSequence
- a trigger sequence. Must not benull
.equals
- whether or not an identical trigger sequence should be considered as a possible match.- Returns:
true
, iff the given trigger sequence starts with this key sequence.
-
-