|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<Sense> cz.cuni.amis.pogamut.sposh.elements.Trigger<OWNER>
public final class Trigger<OWNER extends PoshElement>
Trigger of an element. Trigger is basically a collection of senses, when all senses are evaluated to be true, the trigger is true, otherwise trigger is false. Note, that trigger can be empty, i.e. contain no senses.
Things are little more interesting how should trigger behave when it doesn't contain any senses. That depends if trigger is used as a goal or trigger. When goal is true, it means that the element is finished and is no longer necessary to execute it, thus it is false. Trigger is used to determine if some element should be traversed and thus it is true. As you can see, default behavior of trigger is specified in a way that encourages tree traversal (because default goal result is by false, traversal won't stop prematurely and because default trigger result is true, traversal will use the node triggered by the trigger).
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Method Summary | |
---|---|
void |
add(int index,
Sense newSense)
Insert sense at specified index and owner will emit new child. |
boolean |
add(Sense sense)
Add sense to this trigger and emit news about addition. |
Sense |
get(int index)
Get sense stored at indexed position in the trigger. |
void |
moveSense(int newIndex,
Sense movedSense)
Move sense so that after move, it is at newIndex + emit event. |
Sense |
remove(int index)
Remove sense from specified position and the removed sense will emit node deleted. |
int |
size()
How many senses are there in the trigger |
String |
toString()
Serialize the trigger as serialization of its senses surrounded by braces. |
Methods inherited from class java.util.AbstractList |
---|
addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Method Detail |
---|
public String toString()
toString
in class AbstractCollection<Sense>
public boolean add(Sense sense)
add
in interface Collection<Sense>
add
in interface List<Sense>
add
in class AbstractList<Sense>
sense
- sense to be added.public Sense get(int index)
get
in interface List<Sense>
get
in class AbstractList<Sense>
index
- index of searched trigger.
public void add(int index, Sense newSense)
add
in interface List<Sense>
add
in class AbstractList<Sense>
index
- index where to insert new sensenewSense
- sense to insert into the triggerpublic Sense remove(int index)
remove
in interface List<Sense>
remove
in class AbstractList<Sense>
index
- position which sense in the trigger to remove.
public int size()
size
in interface Collection<Sense>
size
in interface List<Sense>
size
in class AbstractCollection<Sense>
public void moveSense(int newIndex, Sense movedSense)
newIndex
- New index of the sense. Once move is done, sense will be
at this index and the rest will somehow manage.movedSense
- Sense that is being moved from its original position to
the @index. The sense must be part of this trigger.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |