KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > idl > SymbolList


1 package org.jacorb.idl;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2004 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 import java.io.PrintWriter JavaDoc;
24 import java.util.*;
25
26 /**
27  * @author Gerald Brose
28  * @version $Id: SymbolList.java,v 1.15 2004/05/06 12:39:59 nicolas Exp $
29  */

30
31 public class SymbolList
32     extends IdlSymbol
33 {
34     Vector v;
35
36     public SymbolList( int num )
37     {
38         super( num );
39         v = new Vector();
40     }
41
42     public void setPackage( String JavaDoc s )
43     {
44         s = parser.pack_replace( s );
45         if( pack_name.length() > 0 )
46             pack_name = s + "." + pack_name;
47         else
48             pack_name = s;
49         Enumeration e = v.elements();
50         for( ; e.hasMoreElements(); )
51             ( (IdlSymbol)e.nextElement() ).setPackage( s );
52     }
53
54
55     public int size()
56     {
57         return v.size();
58     }
59
60     public Enumeration elements()
61     {
62         return v.elements();
63     }
64
65     public void parse()
66     {
67         Enumeration e = v.elements();
68         for( ; e.hasMoreElements(); )
69             ( (IdlSymbol)e.nextElement() ).parse();
70     }
71
72     public void print( PrintWriter JavaDoc ps )
73     {
74         Enumeration e = v.elements();
75         if( e.hasMoreElements() )
76             ( (IdlSymbol)e.nextElement() ).print( ps );
77
78         for( ; e.hasMoreElements(); )
79         {
80             ps.print( "," );
81             ( (IdlSymbol)e.nextElement() ).print( ps );
82         }
83     }
84
85     public String JavaDoc toString()
86     {
87         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
88         Enumeration e = v.elements();
89
90         if( e.hasMoreElements() )
91             sb.append( (IdlSymbol)e.nextElement() );
92
93         for( ; e.hasMoreElements(); )
94         {
95             sb.append( "," + (IdlSymbol)e.nextElement() );
96         }
97         return sb.toString();
98     }
99 }
100
101
102
103
Popular Tags