private String safe(String src) {
   StringBuffer sb = new StringBuffer();
   for (int i = 0; i < src.length(); i++) {
     char c = src.charAt(i);
     if (c >= 32 && c < 128) {
       sb.append(c);
     } else {
       sb.append("<" + (int) c + ">");
     }
   }
   return sb.toString();
 }
  /**
   * Escapes brackets in the string with backslashes.
   *
   * @param s the string to escape
   * @return the escaped string
   */
  protected String escape(String s) {
    StringBuffer result;
    int i;

    result = new StringBuffer();

    for (i = 0; i < s.length(); i++) {
      if ((s.charAt(i) == '(') || (s.charAt(i) == ')')) result.append('\\');
      result.append(s.charAt(i));
    }

    return result.toString();
  }
示例#3
0
 /**
  * Get the <code>String</code> that represents this <code>MetSymbol</code>.
  *
  * @return <code>String</code> representation.
  */
 public String toString() {
   StringBuffer sb = new StringBuffer(super.toString());
   for (String s : paramIds) {
     sb.append(" param:" + s);
   }
   return sb.toString();
 }
示例#4
0
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append("polygon(");
   sb.append(fillValue);
   sb.append(")[\n");
   PathIterator iterator = path.getPathIterator(null);
   float[] values = new float[2];
   while (!iterator.isDone()) {
     int type = iterator.currentSegment(values);
     Point2D pt = new Point2D.Double(values[0], values[1]);
     sb.append("\t");
     sb.append(pt);
     sb.append("\n");
     iterator.next();
   }
   //        sb.append(iterator);
   //        for(Point2D pt : point2Ds) {
   //            sb.append("\t");
   //            sb.append(pt);
   //            sb.append("\n");
   //        }
   //        sb.append(path.toString());
   sb.append("]");
   return sb.toString();
 }
 @Override
 public String getToolTipText(MouseEvent e) {
   BddtHistoryItem itm = getItemAtPoint(e.getX(), e.getY());
   if (itm != null) {
     StringBuffer buf = new StringBuffer();
     BumpThreadStack stk = itm.getStack();
     BumpStackFrame frm = stk.getFrame(0);
     if (frm == null) return null;
     buf.append(frm.getMethod() + " at " + frm.getLineNumber());
     return buf.toString();
   }
   GraphObject go = getObjectAtPoint(e.getX(), e.getY());
   if (go != null) {
     return go.getName();
   }
   return null;
 }