Example #1
0
 public void locationUsage(STEntry entry, int fromContext) {
   if (entry != null) {
     currentCode.append(entry.contextualName(fromContext));
   }
 }
Example #2
0
 public void enum_use(STEntry ste, int fromContext) {
   if (ste != null && ste.getType() instanceof EnumType)
     EnumDeclaration.generate((EnumType) (ste.getType()));
 }
Example #3
0
 public void channel(STEntry entry) {
   IDeclarationContainer container = findEnclosingDelcarationContainer();
   if (currentCode instanceof Component) { // Usual case
     if (entry.getType() instanceof ChannelType) {
       ((IComponent) currentCode).addChannel(entry.getName(), (ChannelType) entry.getType());
     } else if (entry.getType() instanceof InterfaceType) {
       ((IComponent) currentCode).addInterface(entry.getName(), (InterfaceType) entry.getType());
     } else {
       throw new RuntimeException(
           "unknown type encountered in channel definition"
               + entry.getType().getClass().getName());
     }
   } else if (container instanceof Component) {
     if (entry.getType() instanceof ChannelType) {
       ((IComponent) container).addChannel(entry.getName(), (ChannelType) entry.getType());
     } else if (entry.getType() instanceof InterfaceType) {
       ((IComponent) container).addInterface(entry.getName(), (InterfaceType) entry.getType());
     } else {
       throw new RuntimeException(
           "unknown type encountered in channel definition"
               + entry.getType().getClass().getName());
     }
   } else if (currentCode
       instanceof
       CompilationUnit) { // this is a top level interface definition - no code generation needed
     // do nothing
   } else { // error situation
     throw new RuntimeException(
         "unknown context for channel definition" + currentCode.getClass().getName());
   }
 }