01: /*
02: * Copyright 2005 JBoss Inc
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://www.apache.org/licenses/LICENSE-2.0
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.lang.descr;
18:
19: import java.util.Collections;
20: import java.util.List;
21:
22: /**
23: * An AST class to describe "collect" conditional element
24: *
25: * @author etirelli
26: *
27: */
28: public class CollectDescr extends PatternSourceDescr implements
29: ConditionalElementDescr, PatternDestinationDescr {
30:
31: private static final long serialVersionUID = 400L;
32:
33: private PatternDescr inputPattern;
34: private String classMethodName;
35:
36: public int getLine() {
37: return this .inputPattern.getLine();
38: }
39:
40: public String getClassMethodName() {
41: return this .classMethodName;
42: }
43:
44: public void setClassMethodName(final String classMethodName) {
45: this .classMethodName = classMethodName;
46: }
47:
48: public String toString() {
49: return "[Collect: input=" + this .inputPattern.getIdentifier()
50: + "; objectType=" + this .inputPattern.getObjectType()
51: + "]";
52: }
53:
54: public void addDescr(final BaseDescr patternDescr) {
55: throw new UnsupportedOperationException(
56: "Can't add descriptors to " + this .getClass().getName());
57: }
58:
59: public void insertBeforeLast(final Class clazz,
60: final BaseDescr baseDescr) {
61: throw new UnsupportedOperationException(
62: "Can't add descriptors to " + this .getClass().getName());
63: }
64:
65: public List getDescrs() {
66: // nothing to do
67: return Collections.EMPTY_LIST;
68: }
69:
70: public void addOrMerge(BaseDescr baseDescr) {
71: throw new UnsupportedOperationException(
72: "Can't add descriptors to " + this .getClass().getName());
73: }
74:
75: public PatternDescr getInputPattern() {
76: return this .inputPattern;
77: }
78:
79: public void setInputPattern(final PatternDescr inputPattern) {
80: this.inputPattern = inputPattern;
81: }
82:
83: }
|