public abstract class Tag
extends java.lang.Object
implements java.util.Iterator
Tags are labels associated to objects or animations.
A tag is an object corresponding to a set of objects that can be browsed (i.e. a collection and an iterator on it).
Some tags are extensional
(CExtensionalTag
and JExtensionalTag
),
they can be explicitely attached to and detached from an object,
i.e. an object can be added to or removed from the tag's collection.
Some other tags are intentional and can not be explicitely added or removed,
they tag objects that verify a given property.
Thus, the collection of objects tagged by an intentional tag
is computed at each use of this tag.
A tag can be attached to any number of objects. An object have any number of tags attached to it.
Tags are used for two main purposes : grouping and interaction.
ClickOnTag(BUTTON1, movable)
that will fire only when the user is clicking on an
object with tag "movable".
Transition onAnyColor = new Press(ColoredTag.class, BUTTON1) { public void action() { System.out.println("This object has a "+((ColoredTag)getTag()).color+" tag"); } };can be used in a state machine.
Constructor and Description |
---|
Tag() |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<java.lang.Object> |
getCollection() |
abstract boolean |
hasNext()
Tests if there is other objects tagged by this tag.
|
abstract java.lang.Object |
next() |
void |
remove()
This methods is not supported by a Tag.
|
abstract void |
reset()
Inits the tag's iterator.
|
int |
size()
Counts how many objects are tagged by this tag.
|
public java.util.Collection<java.lang.Object> getCollection()
public abstract void reset()
public abstract boolean hasNext()
hasNext
in interface java.util.Iterator
Iterator.hasNext()
public abstract java.lang.Object next()
next
in interface java.util.Iterator
public final void remove()
removeFrom
remove
in interface java.util.Iterator
CExtensionalTag.removeFrom(fr.lri.swingstates.canvas.CShape)
public final int size()