Logo Search packages:      
Sourcecode: rserve version File versions  Download package

String org::rosuda::JRclient::REXP::toString (  )  [inline]

displayable contents of the expression. The expression is traversed recursively if aggregation types are used (Vector, List, etc.)

Returns:
String descriptive representation of the xpression

Definition at line 567 of file REXP.java.

References attr, org::rosuda::JRclient::RList::body, cont, org::rosuda::JRclient::RList::head, org::rosuda::JRclient::RFactor::toString(), Xt, XT_ARRAY_BOOL, XT_ARRAY_DOUBLE, XT_ARRAY_INT, XT_BOOL, XT_DOUBLE, XT_FACTOR, XT_INT, XT_LANG, XT_LIST, XT_STR, XT_SYM, XT_UNKNOWN, XT_VECTOR, and xtName().

Referenced by parseREXP().

                             {
      StringBuffer sb=
          new StringBuffer("["+xtName(Xt)+" ");
      if (attr!=null) sb.append("\nattr="+attr+"\n ");
      if (Xt==XT_DOUBLE) sb.append((Double)cont);
      if (Xt==XT_INT) sb.append((Integer)cont);
      if (Xt==XT_BOOL) sb.append((RBool)cont);
      if (Xt==XT_FACTOR) sb.append((RFactor)cont);
      if (Xt==XT_ARRAY_DOUBLE) {
          double[] d=(double[])cont;
          sb.append("(");
          for(int i=0; i<d.length; i++) {
            sb.append(d[i]);
            if (i<d.length-1) sb.append(", ");
                if (i==99) {
                    sb.append("... ("+(d.length-100)+" more values follow)");
                    break;
                }
          };
          sb.append(")");
      };
      if (Xt==XT_ARRAY_INT) {
          int[] d=(int[])cont;
          sb.append("(");
          for(int i=0; i<d.length; i++) {
            sb.append(d[i]);
            if (i<d.length-1) sb.append(", ");
                if (i==99) {
                    sb.append("... ("+(d.length-100)+" more values follow)");
                    break;
                }
            };
          sb.append(")");
      };
      if (Xt==XT_ARRAY_BOOL) {
          RBool[] d=(RBool[])cont;
          sb.append("(");
          for(int i=0; i<d.length; i++) {
            sb.append(d[i]);
            if (i<d.length-1) sb.append(", ");
          };
          sb.append(")");
      };
      if (Xt==XT_VECTOR) {
          Vector v=(Vector)cont;
          sb.append("(");
          for(int i=0; i<v.size(); i++) {
            sb.append(((REXP)v.elementAt(i)).toString());
            if (i<v.size()-1) sb.append(", ");
          };
          sb.append(")");
      };
      if (Xt==XT_STR) {
          sb.append("\"");
          sb.append((String)cont);
          sb.append("\"");
      };
      if (Xt==XT_SYM) {
          sb.append((String)cont);
      };
      if (Xt==XT_LIST || Xt==XT_LANG) {
          RList l=(RList)cont;
          sb.append(l.head); sb.append(" <-> ");
          sb.append(l.body);
      };
      if (Xt==XT_UNKNOWN) sb.append((Integer)cont);
      sb.append("]");
      return sb.toString();
    };


Generated by  Doxygen 1.6.0   Back to index