1
2 package org.drools.spi;
3
4 import org.drools.rule.Declaration;
5
6 import java.util.Set;
7 import java.util.HashSet;
8 import java.util.Iterator;
9
10 public class InstrumentedExtractor implements Extractor
11 {
12 private Object value;
13 private Set decls;
14
15 public InstrumentedExtractor()
16 {
17 this.value = null;
18 this.decls = new HashSet();
19 }
20
21 public InstrumentedExtractor(Object value)
22 {
23 this.value = value;
24 }
25
26 public Declaration[] getRequiredTupleMembers()
27 {
28 Declaration[] declArray = new Declaration[ this.decls.size() ];
29
30 Iterator declIter = this.decls.iterator();
31
32 int i = 0;
33
34 while ( declIter.hasNext() )
35 {
36 declArray[i++] = (Declaration) declIter.next();
37 }
38
39 return declArray;
40 }
41
42 public void addDeclaration(Declaration decl)
43 {
44 this.decls.add( decl );
45 }
46
47 public Set getDeclarations()
48 {
49 return this.decls;
50 }
51
52 public Object extractFact(Tuple tuple)
53 {
54 return this.value;
55 }
56 }
This page was automatically generated by Maven