01: package org.drools.lang.descr;
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: /**
20: * This represents a literal node in the rule language. This is
21: * a constraint on a single field of a pattern.
22: * The "text" contains the content.
23: */
24: public class LiteralRestrictionDescr extends RestrictionDescr {
25: public static final int TYPE_NULL = 1;
26: public static final int TYPE_NUMBER = 2;
27: public static final int TYPE_STRING = 3;
28: public static final int TYPE_BOOLEAN = 4;
29:
30: /**
31: *
32: */
33: private static final long serialVersionUID = 400L;
34: private String evaluator;
35: private String text;
36: private int type;
37:
38: public LiteralRestrictionDescr(final String evaluator,
39: final String text) {
40: this (evaluator, text, TYPE_STRING);// default type is string if not specified
41: }
42:
43: public LiteralRestrictionDescr(final String evaluator,
44: final String text, final int type) {
45: this .text = text;
46: this .evaluator = evaluator;
47: this .type = type;
48: }
49:
50: public String getEvaluator() {
51: return this .evaluator;
52: }
53:
54: public String getText() {
55: return this .text;
56: }
57:
58: public String toString() {
59: return "[LiteralRestriction: " + this .evaluator + " "
60: + this .text + "]";
61:
62: }
63:
64: public int getType() {
65: return type;
66: }
67:
68: public void setType(int type) {
69: this.type = type;
70: }
71: }
|