001: package org.drools.lang.descr;
002:
003: /*
004: * Copyright 2005 JBoss Inc
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */
018:
019: import java.util.ArrayList;
020: import java.util.Collections;
021: import java.util.List;
022:
023: import org.drools.compiler.Dialect;
024:
025: public class RuleDescr extends BaseDescr {
026:
027: private static final long serialVersionUID = 400L;
028: private String name;
029: private String documentation;
030:
031: private AndDescr lhs;
032: private Object consequence;
033: private int consequenceLine;
034: private int consequencePattern;
035: private int offset;
036: private List attributes = Collections.EMPTY_LIST;
037: private String salience;
038:
039: private String className;
040:
041: //MVEL: Compiler change
042: private Dialect dialect;
043:
044: public RuleDescr(final String name) {
045: this (name, "");
046: }
047:
048: public RuleDescr(final String ruleName, final String documentation) {
049: this .name = ruleName;
050: this .documentation = documentation;
051: }
052:
053: public String getName() {
054: return this .name;
055: }
056:
057: public String getSalience() {
058: return salience;
059: }
060:
061: public void setSalience(String salience) {
062: this .salience = salience;
063: }
064:
065: public String getClassName() {
066: return this .className;
067: }
068:
069: public void setClassName(final String className) {
070: this .className = className;
071: }
072:
073: public String getDocumentation() {
074: return this .documentation;
075: }
076:
077: public List getAttributes() {
078: return this .attributes;
079: }
080:
081: public void addAttribute(final AttributeDescr attribute) {
082: if (this .attributes == Collections.EMPTY_LIST) {
083: this .attributes = new ArrayList();
084: }
085: this .attributes.add(attribute);
086: }
087:
088: public void setAttributes(final List attributes) {
089: this .attributes = new ArrayList(attributes);
090: }
091:
092: public AndDescr getLhs() {
093: return this .lhs;
094: }
095:
096: public void setLhs(final AndDescr lhs) {
097: this .lhs = lhs;
098: }
099:
100: public Object getConsequence() {
101: return this .consequence;
102: }
103:
104: public void setConsequence(final Object consequence) {
105: this .consequence = consequence;
106: }
107:
108: public void setConsequenceLocation(final int line, final int pattern) {
109: this .consequenceLine = line;
110: this .consequencePattern = pattern;
111: }
112:
113: public void setConsequenceOffset(final int offset) {
114: this .offset = offset;
115: }
116:
117: public int getConsequenceOffset() {
118: return this .offset;
119: }
120:
121: public int getConsequenceLine() {
122: return this .consequenceLine;
123: }
124:
125: public int getConsequencePattern() {
126: return this .consequencePattern;
127: }
128:
129: public void setDialect(Dialect dialect) {
130: this .dialect = dialect;
131: }
132:
133: public Dialect getDialect() {
134: return this.dialect;
135: }
136: }
|