01: package org.drools.spi;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.io.Serializable;
20:
21: import org.drools.common.InternalFactHandle;
22: import org.drools.rule.Declaration;
23:
24: /**
25: * Partial matches are propagated through the Rete network as <code>Tuple</code>s. Each <code>Tuple</code>
26: * Is able to return the <code>FactHandleImpl</code> members of the partial match for the requested pattern.
27: * The pattern refers to the index position of the <code>FactHandleImpl</code> in the underlying implementation.
28: *
29: * @see FactHandle;
30: *
31: * @author <a href="mailto:mark.proctor@jboss.com">Mark Proctor</a>
32: * @author <a href="mailto:bob@werken.com">Bob McWhirter</a>
33: *
34: */
35: public interface Tuple extends Serializable {
36: /**
37: * Returns the <code>FactHandle</code> for the given pattern index. If the pattern is empty
38: * It returns null.
39: *
40: * @param pattern
41: * The index of the pattern from which the <code>FactHandleImpl</code> is to be returned
42: * @return
43: * The <code>FactHandle</code>
44: */
45: InternalFactHandle get(int pattern);
46:
47: /**
48: * Returns the <code>FactHandle</code> for the given <code>Declaration</code>, which in turn
49: * specifcy the <code>Pattern</code> that they depend on.
50: *
51: * @param declaration
52: * The <code>Declaration</code> which specifies the <code>Pattern</code>
53: * @return
54: * The <code>FactHandle</code>
55: */
56: InternalFactHandle get(Declaration declaration);
57:
58: InternalFactHandle[] getFactHandles();
59:
60: /**
61: * Returns the tuple recency
62: * @return
63: */
64: long getRecency();
65:
66: /**
67: * Returns the size of this tuple in number of elements (patterns)
68: * @return
69: */
70: int size();
71:
72: }
|