001: package org.drools.spi;
002:
003: /*
004: * Copyright 2005 JBoss Inc
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */
018:
019: import java.io.Serializable;
020:
021: import org.drools.common.ActivationGroupNode;
022: import org.drools.common.LogicalDependency;
023: import org.drools.common.RuleFlowGroupNode;
024: import org.drools.rule.GroupElement;
025: import org.drools.rule.Rule;
026: import org.drools.util.LinkedList;
027:
028: /**
029: * When a <code>Tuple</code> fully matches a rule it is added to the <code>Agenda</code>
030: * As an <code>Activation</code>. Each <code>Activation</code> is assigned a number, this
031: * number is determined by the <code>WorkingMemory</code> all <code>Activations</code> created
032: * from a single insert, update, retract are assgigned the same Activation number.
033: *
034: * @author <a href="mailto:mark.proctor@jboss.com">Mark Proctor</a>
035: * @author <a href="mailto:bob@werken.com">Bob McWhirter</a>
036: */
037: public interface Activation extends Serializable {
038: /**
039: * Retrieve the <code>Rule</code> that was activated.
040: *
041: * @return The rule.
042: */
043: Rule getRule();
044:
045: int getSalience();
046:
047: /**
048: * Retrieve the subrule that was activated.
049: *
050: * @return
051: */
052: GroupElement getSubRule();
053:
054: /**
055: * Retrieve the <code>Tuple</code> that was activated.
056: *
057: * @return The tuple.
058: */
059: Tuple getTuple();
060:
061: /**
062: * Retrieve the <code>PropagationContext</code> for the <code>Activation</code>
063: *
064: * @return The propagation context
065: */
066: PropagationContext getPropagationContext();
067:
068: /**
069: * Retrieve the activation number.
070: *
071: * @return The activation number
072: */
073: long getActivationNumber();
074:
075: /**
076: * Cancel the <code>Activation</code> by removing it from the <code>Agenda</code>.
077: */
078: void remove();
079:
080: public void addLogicalDependency(LogicalDependency node);
081:
082: public LinkedList getLogicalDependencies();
083:
084: public void setLogicalDependencies(LinkedList justified);
085:
086: public boolean isActivated();
087:
088: public void setActivated(boolean activated);
089:
090: public AgendaGroup getAgendaGroup();
091:
092: public ActivationGroupNode getActivationGroupNode();
093:
094: public void setActivationGroupNode(
095: ActivationGroupNode activationGroupNode);
096:
097: public RuleFlowGroupNode getRuleFlowGroupNode();
098:
099: public void setRuleFlowGroupNode(RuleFlowGroupNode ruleFlowGroupNode);
100:
101: }
|