|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hermes.GenericGroup<A,B>
A
- the type of the objects in the groupB
- the type of underlying collection usedpublic class GenericGroup<A extends HObject,B extends java.util.Collection<A>>
Groups together generic HObject
s using the specified collection
that share common attributes and interact with another group of HObject
s.
Like Being
s, GenericGroup
s can have their own update methods.
The primary purpose of grouping is for use in interactions.
However, GenericGroup
s can also be used to store data about or provide
access to the contained objects.
For example, groups can keep track of the ages of the objects it contains
and direct messages to either the oldest or the newest object.
See World
for more details on registering interactions or Updates.
Interactor
,
HObject
Field Summary | |
---|---|
protected World |
_world
|
Constructor Summary | |
---|---|
GenericGroup(B objects,
World world)
Instantiates a group storing HObjects in the given collection. |
Method Summary | |
---|---|
A |
add(A being)
Adds a being to the group at the end of the next update loop. |
void |
addAll(GenericGroup<A,?> group)
Adds the contents of another group to this group. |
void |
clear()
Clears everything from the group at the end of the update. |
void |
destroy()
Deletes everything in the group from the world at the end of the update. |
B |
getObjects()
Returns the underlying collection containing all objects in the group. |
World |
getWorld()
|
boolean |
hasNeedsMoreSamples()
Used internally. |
java.util.Iterator<A> |
iterator()
An iterator over the underlying collection. |
void |
receive(KeyMessage m)
Override if you want your group to handle Key messages |
void |
receive(MouseMessage m)
Override if you want your group to handle Mouse messages |
void |
receive(MouseWheelMessage m)
Override if you want your group to handle Mouse Wheel messages |
void |
receive(OscMessage m)
Override if you want your group to handle OSC messages |
A |
remove(A object)
Removes an object from the group at the end of the next update loop. |
void |
removeAll(GenericGroup<A,?> group)
Removes the contents of a group from this group. |
void |
setWorld(World world)
|
int |
size()
|
void |
update()
Performs an update on the group. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected World _world
Constructor Detail |
---|
public GenericGroup(B objects, World world)
objects
- the collection objects will be stored inworld
- the world where the group will be usedMethod Detail |
---|
public B getObjects()
public java.util.Iterator<A> iterator()
public void update()
public A add(A being)
being
- the being to add
public A remove(A object)
object
- the object to remove
public void addAll(GenericGroup<A,?> group)
group
- the objects to addpublic void removeAll(GenericGroup<A,?> group)
group
- the objects to removepublic void clear()
public void destroy()
public int size()
public void setWorld(World world)
world
- the world the group should be contained bypublic World getWorld()
public boolean hasNeedsMoreSamples()
public void receive(KeyMessage m)
receive
in interface KeySubscriber
m
- the message sent by the PostOfficepublic void receive(MouseMessage m)
receive
in interface MouseSubscriber
m
- the message sent by the PostOfficepublic void receive(MouseWheelMessage m)
receive
in interface MouseWheelSubscriber
m
- the message sent by the PostOfficepublic void receive(OscMessage m)
receive
in interface OscSubscriber
m
- the message sent by the PostOffice
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |