01: /*
02: * Copyright 2006 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: * Created on Jun 18, 2007
17: */
18: package org.drools.rule.builder.dialect.java;
19:
20: import java.util.ArrayList;
21: import java.util.Collections;
22: import java.util.List;
23: import java.util.Map;
24:
25: import org.drools.compiler.Dialect.AnalysisResult;
26: import org.drools.rule.builder.dialect.java.parser.JavaLocalDeclarationDescr;
27:
28: /**
29: * An analysis result implementation for the java dialect
30: *
31: * @author etirelli
32: */
33: public class JavaAnalysisResult implements AnalysisResult {
34: private static final List[] EMPTY_ARRAY_OF_LISTS = new List[0];
35:
36: private List[] boundIdentifiers = EMPTY_ARRAY_OF_LISTS;
37: private List identifiers = Collections.EMPTY_LIST;
38: private Map localVariables = Collections.EMPTY_MAP;
39: private List notBoundedIdentifiers = Collections.EMPTY_LIST;
40:
41: public List[] getBoundIdentifiers() {
42: return boundIdentifiers;
43: }
44:
45: public void setBoundIdentifiers(List[] boundIdentifiers) {
46: this .boundIdentifiers = boundIdentifiers;
47: }
48:
49: public List getIdentifiers() {
50: return identifiers;
51: }
52:
53: public void setIdentifiers(List identifiers) {
54: this .identifiers = identifiers;
55: }
56:
57: public List getLocalVariables() {
58: return new ArrayList(localVariables.keySet());
59: }
60:
61: public Map getLocalVariablesMap() {
62: return this .localVariables;
63: }
64:
65: public void setLocalVariables(Map localVariables) {
66: this .localVariables = localVariables;
67: }
68:
69: public void addLocalVariable(String identifier,
70: JavaLocalDeclarationDescr descr) {
71: this .localVariables.put(identifier, descr);
72: }
73:
74: public List getNotBoundedIdentifiers() {
75: return notBoundedIdentifiers;
76: }
77:
78: public void setNotBoundedIdentifiers(List notBoundedIdentifiers) {
79: this.notBoundedIdentifiers = notBoundedIdentifiers;
80: }
81: }
|