01: /*
02: * JacORB - a free Java ORB
03: *
04: * Copyright (C) 1997-2004 Gerald Brose.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Library General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Library General Public License for more details.
15: *
16: * You should have received a copy of the GNU Library General Public
17: * License along with this library; if not, write to the Free
18: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19: */
20:
21: package org.jacorb.idl;
22:
23: /**
24: * @author Gerald Brose
25: * @version $Id: InitParamDecl.java,v 1.7 2006/06/19 10:34:57 alphonse.bendt Exp $
26: */
27:
28: import java.io.PrintWriter;
29:
30: public class InitParamDecl extends ParamDecl {
31: public InitParamDecl(int num) {
32: super (num);
33: }
34:
35: public void setPackage(String s) {
36: s = parser.pack_replace(s);
37: if (pack_name.length() > 0)
38: pack_name = s + "." + pack_name;
39: else
40: pack_name = s;
41: paramTypeSpec.setPackage(s);
42: }
43:
44: public void parse() {
45: while (paramTypeSpec.typeSpec() instanceof ScopedName) {
46: TypeSpec ts = ((ScopedName) paramTypeSpec.typeSpec())
47: .resolvedTypeSpec();
48:
49: if (ts != null)
50: paramTypeSpec = ts;
51: }
52: }
53:
54: public void print(PrintWriter ps) {
55: ps.print(paramTypeSpec.toString() + " " + simple_declarator);
56: }
57:
58: public String printWriteStatement(String ps) {
59: return printWriteStatement(simple_declarator.toString(), ps);
60: }
61:
62: public String printWriteStatement(String name, String ps) {
63: return paramTypeSpec.typeSpec().printWriteStatement(name, ps);
64: }
65:
66: public String printReadExpression(String ps) {
67: return paramTypeSpec.typeSpec().printReadExpression(ps);
68: }
69: }
|