01: package org.drools.common;
02:
03: import org.drools.spi.Activation;
04: import org.drools.spi.ActivationGroup;
05: import org.drools.util.LinkedList;
06:
07: public class ActivationGroupImpl implements ActivationGroup {
08: private String name;
09:
10: private final LinkedList list;
11:
12: public ActivationGroupImpl(final String name) {
13: this .name = name;
14: this .list = new LinkedList();
15: }
16:
17: public String getName() {
18: return this .name;
19: }
20:
21: public void addActivation(final Activation activation) {
22: final ActivationGroupNode node = new ActivationGroupNode(
23: activation, this );
24: activation.setActivationGroupNode(node);
25: this .list.add(node);
26: }
27:
28: public void removeActivation(final Activation activation) {
29: final ActivationGroupNode node = activation
30: .getActivationGroupNode();
31: this .list.remove(node);
32: activation.setActivationGroupNode(null);
33: }
34:
35: public java.util.Iterator iterator() {
36: return this .list.javaUtilIterator();
37: }
38:
39: public boolean isEmpty() {
40: return this .list.isEmpty();
41: }
42:
43: public int size() {
44: return this .list.size();
45: }
46:
47: public void clear() {
48: this.list.clear();
49: }
50:
51: }
|