当前位置: 首页>>代码示例>>Java>>正文


Java UnionBranch类代码示例

本文整理汇总了Java中com.sun.tools.corba.se.idl.UnionBranch的典型用法代码示例。如果您正苦于以下问题:Java UnionBranch类的具体用法?Java UnionBranch怎么用?Java UnionBranch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UnionBranch类属于com.sun.tools.corba.se.idl包,在下文中一共展示了UnionBranch类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unionLabelSize

import com.sun.tools.corba.se.idl.UnionBranch; //导入依赖的package包/类
/**
 *
 **/

// Computes the total number of labels in the union, which is the sum
// of the number of labels in each branch of the union.  Note that the
// label for the default branch has size 0, but still counts in the total
// size.
private int unionLabelSize( UnionEntry un )
{
  int size = 0 ;
  Vector branches = un.branches() ;
  for (int i = 0; i < branches.size (); ++i) {
      UnionBranch branch = (UnionBranch)(branches.get(i)) ;
      int branchSize = branch.labels.size() ;
      size += ((branchSize == 0) ? 1 : branchSize) ;
  }
  return size ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:UnionGen.java

示例2: vectorizeLabels

import com.sun.tools.corba.se.idl.UnionBranch; //导入依赖的package包/类
/**
 *
 **/
private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums )
{
  Vector mergedLabels = new Vector ();
  Enumeration branches = branchVector.elements ();
  while (branches.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)branches.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression expr = (Expression)labels.nextElement ();
      String str ;

      if (unionIsEnum)
        if (useIntsForEnums)
          str = typePackage + "_" + Util.parseExpression( expr ) ;
        else
          str = typePackage + Util.parseExpression( expr ) ;
      else
        str = Util.parseExpression( expr ) ;

      mergedLabels.addElement (str);
    }
  }
  return mergedLabels;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:UnionGen.java

示例3: safeName

import com.sun.tools.corba.se.idl.UnionBranch; //导入依赖的package包/类
/**
 *
 **/
private String safeName (UnionEntry u, String name)
{
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
    if (((UnionBranch)e.nextElement ()).typedef.name ().equals (name))
    {
      name = '_' + name;
      break;
    }
  return name;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:UnionGen.java

示例4: writeNonBoolean

import com.sun.tools.corba.se.idl.UnionBranch; //导入依赖的package包/类
/**
 *
 **/
private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
{
  SymtabEntry utype = Util.typeOf (u.type ());
  if (utype instanceof EnumEntry)
    stream.println (indent + "switch (" + name + ".discriminator ().value ())");
  else
    stream.println (indent + "switch (" + name + ".discriminator ())");
  stream.println (indent + "{");
  String typePackage = Util.javaQualifiedName (utype) + '.';
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)e.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression label = (Expression)labels.nextElement ();
      if (utype instanceof EnumEntry)
      {
        String key = Util.parseExpression (label);
        stream.println (indent + "  case " + typePackage + '_' + key + ":");
      }
      else
        stream.println (indent + "  case " + cast (label, utype) + ':');
    }
    if (!branch.typedef.equals (u.defaultBranch ()))
    {
      index = writeBranch (index, indent + "    ", name, branch.typedef, stream);
      stream.println (indent + "    break;");
    }
  }
  if (u.defaultBranch () != null) {
    stream.println (indent + "  default:");
    index = writeBranch (index, indent + "    ", name, u.defaultBranch (), stream);
    stream.println (indent + "    break;");
  }
  stream.println (indent + "}");
  return index;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:UnionGen.java


注:本文中的com.sun.tools.corba.se.idl.UnionBranch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。