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.base.ValueType;
22: import org.drools.base.evaluators.Operator;
23: import org.drools.common.InternalWorkingMemory;
24: import org.drools.rule.VariableRestriction.VariableContextEntry;
25:
26: public interface Evaluator extends Serializable {
27:
28: public ValueType getValueType();
29:
30: public Operator getOperator();
31:
32: /**
33: * This method will extract the value from the object1 using the
34: * extractor and compare it with the object2.
35: * @param workingMemory TODO
36: * @param extractor
37: * The extractor used to get the source value from the object
38: * @param object1
39: * The source object to evaluate
40: * @param object2
41: * The actual value to compare to
42: *
43: * @return Returns true if evaluation is successfull. false otherwise.
44: */
45: public boolean evaluate(InternalWorkingMemory workingMemory,
46: Extractor extractor, Object object1, FieldValue value);
47:
48: public boolean evaluate(InternalWorkingMemory workingMemory,
49: Extractor leftExtractor, Object left,
50: Extractor rightExtractor, Object right);
51:
52: public boolean evaluateCachedLeft(
53: InternalWorkingMemory workingMemory,
54: VariableContextEntry context, Object object1);
55:
56: public boolean evaluateCachedRight(
57: InternalWorkingMemory workingMemory,
58: VariableContextEntry context, Object object2);
59:
60: }
|