Package com.sun.tools.corba.se.idl

Examples of com.sun.tools.corba.se.idl.UnionBranch


    int size = u.branches ().size () + 1;
    Enumeration e = u.branches ().elements ();
    int i = 0;
    while (e.hasMoreElements ())
    {
      UnionBranch branch = (UnionBranch)e.nextElement ();
      Util.fillInfo (branch.typedef);
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //stream.println ("  private " + Util.javaStatefulName (branch.typedef) + " ___" + branch.typedef.name () + ";");
      stream.println ("  private " + Util.javaName (branch.typedef) + " ___" + branch.typedef.name () + ";");
      ++i;
    }
    stream.println ("  private " + Util.javaName (utype) + " __discriminator;");
    stream.println ("  private boolean __uninitialized = true;");

    // Write ctor
    stream.println ();
    stream.println ("  public " + u.name () + " ()");
    stream.println ("  {");
    stream.println ("  }");

    // Write discriminator
    stream.println ();
    stream.println ("  public " + Util.javaName (utype) + " " + safeName (u, "discriminator") + " ()");
    stream.println ("  {");
    stream.println ("    if (__uninitialized)");
    stream.println ("      throw new org.omg.CORBA.BAD_OPERATION ();");
    stream.println ("    return __discriminator;");
    stream.println ("  }");

    // Write for each branch:
    // - setter
    // - getter
    // - private verifyXXX
    e = u.branches ().elements ();
    i = 0;
    while (e.hasMoreElements ())
    {
      UnionBranch branch = (UnionBranch)e.nextElement ();
      writeBranchMethods (stream, u, branch, i++);
    }
    if (u.defaultBranch () == null && !coversAll (u))
    {
      stream.println ();
View Full Code Here


  {
    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 ;
View Full Code Here

      if (branch.isDefault)
      {
        Enumeration eBranches = u.branches ().elements ();
        while (eBranches.hasMoreElements ())
        {
          UnionBranch b = (UnionBranch)eBranches.nextElement ();
          if (b != branch)
          {
            Enumeration eLabels = b.labels.elements ();
            while (eLabels.hasMoreElements ())
            {
View Full Code Here

  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 ;
  }
View Full Code Here

    innerOffsets = new TCOffsets ();
    innerOffsets.set (entry);
    int offsetForUnion = innerOffsets.currentOffset ();
    for (int i = 0; i < u.branches ().size (); ++i) {
        UnionBranch branch = (UnionBranch)u.branches ().elementAt (i);
        TypedefEntry member = branch.typedef;
        Vector labels = branch.labels;
        String memberName = Util.stripLeadingUnderscores (member.name ());

        if (labels.size() == 0) {
View Full Code Here

    }

    private int readBoolean (String disName, int index, String indent,
        String name, UnionEntry u, PrintWriter stream)
    {
        UnionBranch firstBranch = (UnionBranch)u.branches ().firstElement ();
        UnionBranch secondBranch;

        if (u.branches ().size () == 2)
            secondBranch = (UnionBranch)u.branches ().lastElement ();
        else
            secondBranch = null;

        boolean firstBranchIsTrue = false;
        boolean noCases = false;
        try {
            if (u.branches ().size () == 1 &&
                (u.defaultBranch () != null || firstBranch.labels.size () == 2)) {
                noCases = true;
            } else {
                Expression expr = (Expression)(firstBranch.labels.firstElement()) ;
                Boolean bool = (Boolean)(expr.evaluate()) ;
                firstBranchIsTrue = bool.booleanValue ();
            }
        } catch (EvaluationException ex) {
            // no action
        }

        if (noCases) {
            // There is only a default label.  Since there are no cases,
            // there is no need for if...else branches.
            index = readBranch (index, indent, firstBranch.typedef.name (), "",  firstBranch.typedef, stream);
        } else {
            // If first branch is false, swap branches
            if (!firstBranchIsTrue) {
                UnionBranch tmp = firstBranch;
                firstBranch = secondBranch;
                secondBranch = tmp;
            }

            stream.println (indent + "if (" + disName + ')');
View Full Code Here

        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 ();
View Full Code Here

   *
   **/
  private int writeBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
  {
    SymtabEntry utype = Util.typeOf (u.type ());
    UnionBranch firstBranch = (UnionBranch)u.branches ().firstElement ();
    UnionBranch secondBranch;
    if (u.branches ().size () == 2)
      secondBranch = (UnionBranch)u.branches ().lastElement ();
    else
      secondBranch = null;
    boolean firstBranchIsTrue = false;
    boolean noCases = false;
    try
    {
      if (u.branches ().size () == 1 && (u.defaultBranch () != null || firstBranch.labels.size () == 2))
        noCases = true;
      else
        firstBranchIsTrue = ((Boolean)((Expression)firstBranch.labels.firstElement ()).evaluate ()).booleanValue ();
    }
    catch (EvaluationException ex)
    {}

    if (noCases)
    {
      // There is only a default label.  Since there are no cases,
      // there is no need for if...else branches.
      index = writeBranch (index, indent, name, firstBranch.typedef, stream);
    }
    else
    {
      // If first branch is false, swap branches
      if (!firstBranchIsTrue)
      {
        UnionBranch tmp = firstBranch;
        firstBranch = secondBranch;
        secondBranch = tmp;
      }
      stream.println (indent + "if (" + disName + ')');
      if (firstBranch == null)
View Full Code Here

    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)
View Full Code Here

      // Look through the branches
      Enumeration branches = u.branches ().elements ();
      while (branches.hasMoreElements ())
      {
        UnionBranch branch = (UnionBranch)branches.nextElement ();
        SymtabEntry branchEntry = typeOf (branch.typedef);
        if (importTypes.contains (branchEntry))
        {
          addTo (importList, branchEntry.name ());
          if (type == HelperFile)
View Full Code Here

TOP

Related Classes of com.sun.tools.corba.se.idl.UnionBranch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.