01: /*
02: * Copyright 2002-2005 Peter Lin & RuleML.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://ruleml-dev.sourceforge.net/
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: *
16: */
17: package org.drools.facttemplates;
18:
19: import java.io.Serializable;
20:
21: import org.drools.rule.Package;
22:
23: /**
24: * @author Peter Lin
25: *
26: * Template defines the methods to access an object, which is the
27: * equivalent of un-ordered facts. It defines all the necessary
28: * methods for Deftemplate.
29: */
30: public interface FactTemplate extends Serializable {
31:
32: Package getPackage();
33:
34: /**
35: * The name of the template may be the fully qualified
36: * class name, or an alias.
37: * @return
38: */
39: String getName();
40:
41: /**
42: * templates may have 1 or more slots. A slot is a named
43: * pattern with a specific type of value.
44: * @return
45: */
46: int getNumberOfFields();
47:
48: /**
49: * Return an array of all the slots.
50: * @return
51: */
52: FieldTemplate[] getAllFieldTemplates();
53:
54: /**
55: * Return the slot with the String name
56: * @return
57: */
58: FieldTemplate getFieldTemplate(String name);
59:
60: /**
61: * Get the Slot at the given pattern id
62: * @param index
63: * @return
64: */
65: FieldTemplate getFieldTemplate(int index);
66:
67: /**
68: * Get the pattern index with the given name
69: * @param name
70: * @return
71: */
72: int getFieldTemplateIndex(String name);
73:
74: Fact createFact(long id);
75: }
|