1 package org.jacorb.idl; 2 3 22 23 import java.io.PrintWriter ; 24 import java.util.*; 25 26 30 31 class ValueInheritanceSpec 32 extends SymbolList 33 { 34 36 38 39 Vector supports; 40 41 43 Truncatable truncatable = null; 44 45 public ValueInheritanceSpec( int num ) 46 { 47 super( num ); 48 supports = new Vector(); 50 } 51 52 public String getTruncatableId() 53 { 54 if( truncatable == null ) 55 { 56 return null; 57 } 58 else 59 { 60 return truncatable.getId(); 61 } 62 } 63 64 public boolean isEmpty() 65 { 66 return ( v.size() == 0 && truncatable == null ); 67 } 68 69 public Enumeration getValueTypes() 70 { 71 return v.elements(); 72 } 73 74 public Enumeration getSupportedInterfaces() 75 { 76 return supports.elements(); 77 } 78 79 public void setPackage( String s ) 80 { 81 s = parser.pack_replace( s ); 82 if( pack_name.length() > 0 ) 83 pack_name = s + "." + pack_name; 84 else 85 pack_name = s; 86 87 if( truncatable != null ) 88 truncatable.scopedName.setPackage( s ); 89 90 for( Enumeration e = v.elements(); e.hasMoreElements(); ) 91 ( (IdlSymbol)e.nextElement() ).setPackage( s ); 92 93 for( Enumeration e = supports.elements(); e.hasMoreElements(); ) 94 ( (IdlSymbol)e.nextElement() ).setPackage( s ); 95 } 96 97 public void parse() 98 { 99 if( truncatable != null ) 100 { 101 ScopedName s = truncatable.scopedName; 102 Value v = (Value)((ConstrTypeSpec)s.resolvedTypeSpec()).c_type_spec; 103 if( v instanceof ValueAbsDecl ) 104 { 105 parser.error( "truncatable base value " + 106 s.toString() + " must not be abstract", token ); 107 } 108 } 109 Enumeration e = v.elements(); 110 for( ; e.hasMoreElements(); ) 111 { 112 ( (IdlSymbol)e.nextElement() ).parse(); 113 } 114 115 } 116 117 public void print( PrintWriter ps ) 118 { 119 ps.print( toString() ); 120 } 121 122 public String toString() 123 { 124 StringBuffer sb = new StringBuffer (); 125 126 if( truncatable != null ) 127 sb.append( truncatable.toString() + " " ); 128 129 Enumeration e = v.elements(); 130 131 if( e.hasMoreElements() ) 132 sb.append( (IdlSymbol)e.nextElement() + " " ); 133 134 for( ; e.hasMoreElements(); ) 135 { 136 sb.append( "," + (IdlSymbol)e.nextElement() + " " ); 137 } 138 139 Enumeration s = supports.elements(); 140 if( s.hasMoreElements() ) 141 { 142 sb.append( "supports " ); 143 ( (IdlSymbol)s.nextElement() ).toString(); 144 } 145 146 for( ; s.hasMoreElements(); ) 147 { 148 sb.append( "," ); 149 ( (IdlSymbol)s.nextElement() ).toString(); 150 } 151 152 return sb.toString(); 153 } 154 } 155 156 157 158 | Popular Tags |