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 org.drools.WorkingMemory;
20: import org.drools.common.InternalFactHandle;
21: import org.drools.common.InternalWorkingMemory;
22: import org.drools.reteoo.ReteTuple;
23: import org.drools.rule.ContextEntry;
24: import org.drools.rule.Declaration;
25:
26: public class MockConstraint implements BetaNodeFieldConstraint {
27:
28: /**
29: *
30: */
31: private static final long serialVersionUID = 400L;
32:
33: public Declaration[] declarations;
34:
35: public boolean isAllowed = true;
36:
37: public boolean isAllowed(final Object object, final Tuple tuple,
38: final WorkingMemory workingMemory) {
39: return this .isAllowed;
40: }
41:
42: public Declaration[] getRequiredDeclarations() {
43: return this .declarations;
44: }
45:
46: public ContextEntry getContextEntry() {
47: return new ContextEntry() {
48: private static final long serialVersionUID = 400L;
49: private ContextEntry next;
50:
51: public ContextEntry getNext() {
52: return this .next;
53: }
54:
55: public void setNext(final ContextEntry entry) {
56: this .next = entry;
57: }
58:
59: public void updateFromFactHandle(
60: final InternalWorkingMemory workingMemory,
61: final InternalFactHandle handle) {
62: }
63:
64: public void updateFromTuple(
65: final InternalWorkingMemory workingMemory,
66: final ReteTuple tuple) {
67: }
68: };
69: }
70:
71: public boolean isAllowedCachedLeft(final ContextEntry context,
72: final Object object) {
73: return this .isAllowed;
74: }
75:
76: public boolean isAllowedCachedRight(final ReteTuple tuple,
77: final ContextEntry context) {
78: return this.isAllowed;
79: }
80:
81: }
|