001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id: AbstractOperation.java 9372 2007-09-29 08:06:00Z lzheng $
023: */
024:
025: package com.bostechcorp.cbesb.common.trn.compiler;
026:
027: import com.bostechcorp.cbesb.common.util.TabbingPrintWriter;
028:
029: /**
030: * This abstract class represents an operaion at complie time.
031: * This implements the IOperation interface,
032: * and it's a parent class for the operation class.
033: * It defines some common properties for all operations,
034: * and defines the get and set methods for each property.
035: * It also provides default implementations for all methods in the interface.
036: *
037: */
038: abstract class AbstractOperation implements IOperation {
039: protected short type = OpType.OPTYPE_UNDEFINED;
040: protected String name;
041: protected IOperation nestedOperations;
042: protected IOperation lastNested;
043: protected IOperation nextOperation;
044:
045: // sources and targets
046: protected DataAddress[] sources;
047: protected DataAddress[] targets;
048:
049: // special parameters for built-in operations
050: protected short builtinType = OpType.BUILTIN_OP_UNDEFINED;
051:
052: protected int childCount = 0;
053: private String temp;
054:
055: /**
056: *
057: * @param name
058: */
059: public AbstractOperation(String name) {
060: super ();
061: this .name = name;
062:
063: }
064:
065: /**
066: * Get the builtinType
067: */
068:
069: public short getBuiltinType() {
070: return builtinType;
071: }
072:
073: /**
074: * Set the builtinType
075: */
076:
077: public void setBuiltinType(short builtinType) {
078: this .builtinType = builtinType;
079: }
080:
081: /**
082: * Get the last nested operation
083: * return IOpeation
084: */
085: public IOperation getLastNested() {
086: return lastNested;
087: }
088:
089: /**
090: * Set the next operation
091: *
092: */
093: public void setLastNested(IOperation lastNested) {
094: this .lastNested = lastNested;
095: }
096:
097: /**
098: * get the name
099: */
100: public String getName() {
101: return name;
102: }
103:
104: /**
105: * set the name
106: */
107: public void setName(String name) {
108: this .name = name;
109: }
110:
111: /**
112: * get the nested opetaions
113: * @return IOpeation
114: */
115: public IOperation getNestedOperations() {
116: return nestedOperations;
117: }
118:
119: /**
120: * Set the nested operations
121: * @param nestedOperations: type IOperation
122: */
123:
124: public void setNestedOperations(IOperation nestedOperations) {
125: this .nestedOperations = nestedOperations;
126: }
127:
128: /* (non-Javadoc)
129: * @see com.bostechcorp.cbesb.common.trn.compiler.IOperation#getNextOperation()
130: */
131: public IOperation getNextOperation() {
132: return nextOperation;
133: }
134:
135: /*
136: * (non-Javadoc)
137: * @see com.bostechcorp.cbesb.common.trn.compiler.IOperation#setNextOperation(com.bostechcorp.cbesb.common.trn.compiler.IOperation)
138: */
139: public void setNextOperation(IOperation nextOperation) {
140: this .nextOperation = nextOperation;
141: }
142:
143: public DataAddress[] getSources() {
144: return sources;
145: }
146:
147: /*
148: * (non-Javadoc)
149: * @see com.bostechcorp.cbesb.common.trn.compiler.IOperation#setSources(com.bostechcorp.cbesb.common.trn.compiler.DataAddress[])
150: */
151: public void setSources(DataAddress[] sources) {
152: this .sources = sources;
153: }
154:
155: /* (non-Javadoc)
156: * @see com.bostechcorp.cbesb.common.trn.compiler.IOperation#getTargets()
157: */
158: public DataAddress[] getTargets() {
159: return targets;
160: }
161:
162: public void setTargets(DataAddress[] targets) {
163: this .targets = targets;
164: }
165:
166: public short getType() {
167: return type;
168: }
169:
170: public void setType(short type) {
171: this .type = type;
172: }
173:
174: public void endCode(TabbingPrintWriter javaWriter) {
175:
176: }
177:
178: public void handleProperty(String propertyName, String propertyValue) {
179:
180: }
181:
182: public void handlePropertyList(String propertyListName,
183: String propertyName, String propertyValue) {
184:
185: }
186:
187: public void makeClassInstances(TabbingPrintWriter javaWriter,
188: String saName) {
189:
190: }
191:
192: /* (non-Javadoc)
193: * @see com.bostechcorp.cbesb.common.trn.compiler.IOperation#startCode(com.bostechcorp.cbesb.common.trn.compiler.TransformerCompiler)
194: */
195: public void startCode(TransformerCompiler compiler) {
196:
197: }
198:
199: /**
200: * @return the temp
201: */
202: public String getTemp() {
203: return temp;
204: }
205:
206: /**
207: * @param temp the temp to set
208: */
209: public void setTemp(String temp) {
210: this .temp = temp;
211: }
212:
213: public int getChildCount() {
214: return childCount;
215: }
216:
217: public void setChildCount(int childCount) {
218: this.childCount = childCount;
219: }
220:
221: }
|