예제 #1
0
 private void addRowStatusSetter(
     Context ctxt,
     MibNode node,
     String description,
     String syntax,
     String var,
     StringBuffer buff) {
   buff.append(
       Def.TAB
           + "/**\n"
           + Def.TAB
           + " * "
           + MessageHandler.getMessage("generate.mbean.comment.setter", var)
           + "\n"
           + Def.TAB
           + " * "
           + MessageHandler.getMessage("generate.mbean.comment." + "setter.rs.nochecker")
           + "\n"
           + Def.TAB
           + " * "
           + MessageHandler.getMessage("generate.mbean.comment." + "checker.rs.override")
           + "\n"
           + Def.TAB
           + " */\n");
   buff.append(
       Def.TAB + Def.PUBLIC + Def.VOID + Def.SET + var + "(" + syntax + "x) " + accessThrows);
   buff.append(Def.TAB2 + var + " = x" + Def.SEMICOLON);
   buff.append(Def.TAB + Def.RBRACE + "\n");
 }
 public java.lang.String toString() {
   java.lang.StringBuffer __s = new java.lang.StringBuffer();
   __s.append(posX);
   __s.append(":");
   __s.append(posY);
   return __s.toString();
 }
예제 #3
0
 /** Generates the code for the checker. */
 protected void addChecker(
     Context ctxt,
     MibNode node,
     String description,
     String syntax,
     String var,
     StringBuffer buff) {
   buff.append(
       Def.TAB
           + "/**\n"
           + Def.TAB
           + " * "
           + MessageHandler.getMessage("generate.mbean.comment.checker", var)
           + "\n"
           + Def.TAB
           + " */\n");
   buff.append(
       Def.TAB + Def.PUBLIC + Def.VOID + Def.CHECK + var + "(" + syntax + "x) " + accessThrows);
   buff.append(
       Def.TAB2
           + "//\n"
           + Def.TAB2
           + "// "
           + MessageHandler.getMessage("generate.mbean.comment.checker.policy")
           + "\n"
           + Def.TAB2
           + "//\n");
   buff.append(Def.TAB + Def.RBRACE + "\n");
 }
예제 #4
0
  public String getUserSerial(String operID) {

    ConnectionManager cm = ConnectionManager.getInstance();

    String userSerial = Util.getUserSerial(cm.getConnection(), operID);

    StringBuffer StrBuf = new StringBuffer();

    StrBuf.append("<root>");
    StrBuf.append("<action type=\"1\" result=\"true\">");

    StrBuf.append("<record> ");

    StrBuf.append("<field ");
    StrBuf.append(" name =\"userserial\"");
    StrBuf.append(" type =\"text\"");
    StrBuf.append("  value =\"" + userSerial + "\"");
    StrBuf.append(" />");
    StrBuf.append("</record>");
    StrBuf.append("</action>");

    StrBuf.append("</root>");

    cm.release();
    return StrBuf.toString();
  }
예제 #5
0
  /**
   * Flatten an input 2D string/double map into a delimited string array
   *
   * @param map2DSD 2D String/Double map
   * @param strKVDelimiter Element delimiter
   * @param strRecordDelimiter Record delimiter
   * @return Flattened map string
   */
  public static final java.lang.String TwoDSDMapToFlatString(
      final org.drip.analytics.support.CaseInsensitiveTreeMap<java.lang.Double> map2DSD,
      final java.lang.String strKVDelimiter,
      final java.lang.String strRecordDelimiter) {
    if (null == map2DSD
        || 0 == map2DSD.size()
        || null == map2DSD.entrySet()
        || null == strKVDelimiter
        || strKVDelimiter.isEmpty()
        || null == strRecordDelimiter
        || strRecordDelimiter.isEmpty()) return "";

    boolean bFirstEntry = true;

    java.lang.StringBuffer sb = new java.lang.StringBuffer();

    for (java.util.Map.Entry<java.lang.String, java.lang.Double> me : map2DSD.entrySet()) {
      if (null == me || null == me.getKey() || me.getKey().isEmpty()) continue;

      if (bFirstEntry) bFirstEntry = false;
      else sb.append(strRecordDelimiter);

      sb.append(me.getKey() + strKVDelimiter + me.getValue());
    }

    return sb.toString();
  }
예제 #6
0
 /**
  * Renvoie une <code>String</code> décrivant <code>this</code> à des fin de débogage.
  *
  * @return une valeur <code>String</code> décrivant <code>this</code>.
  */
 public String toString() {
   StringBuffer ret = new StringBuffer();
   ret.append("[convexPolygonalZone=");
   ret.append(convexPolygonalZone.toString());
   ret.append("]");
   return ret.toString();
 }
예제 #7
0
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append(this.key);
   if (this.hasValue()) {
     sb.append("=").append(this.val);
   }
   return sb.toString();
 }
예제 #8
0
파일: uva706.java 프로젝트: de-yu/uva
  public static void main(String[] args) throws IOException {
    Scanner scanner = new Scanner(new BufferedInputStream(System.in));

    int num[][] = {
      {0, 2, 3, 5, 6, 7, 8, 9},
      {2, 3, 4, 5, 6, 8, 9},
      {0, 2, 3, 5, 6, 8, 9},
      {0, 4, 5, 6, 8, 9},
      {0, 1, 2, 3, 4, 7, 8, 9},
      {0, 2, 6, 8},
      {0, 1, 3, 4, 5, 6, 7, 8, 9}
    };

    while (scanner.hasNextInt()) {
      int a = scanner.nextInt();
      String b = scanner.next();
      if (a == 0) break;
      String data[][] = new String[5 + (a - 1) * 2][(3 + (a - 1)) * b.length()];

      for (int i = 0; i < 5 + (a - 1) * 2; i++)
        for (int j = 0; j < (3 + (a - 1)) * b.length(); j++) data[i][j] = " ";

      for (int i = 0; i < b.length(); i++) {
        for (int j = 0; j < 3; j++) {
          for (int k = 0; k < num[j].length; k++) {
            if ((int) b.charAt(i) - 48 == num[j][k]) {
              for (int h = 0; h < a; h++) data[(a + 1) * j][1 + i * (a + 2) + h] = "-";
            }
          }
        }
        for (int j = 3; j < 5; j++) {
          for (int k = 0; k < num[j].length; k++) {
            if ((int) b.charAt(i) - 48 == num[j][k]) {
              for (int h = 0; h < a; h++) data[1 + h][(j - 3) * (a + 1) + (i * (a + 2))] = "|";
            }
          }
        }
        for (int j = 5; j < 7; j++) {
          for (int k = 0; k < num[j].length; k++) {
            if ((int) b.charAt(i) - 48 == num[j][k]) {
              for (int h = 0; h < a; h++) data[a + 2 + h][(j - 5) * (a + 1) + (i * (a + 2))] = "|";
            }
          }
        }
      }
      StringBuffer sb = new StringBuffer("");
      for (int i = 0; i < 5 + (a - 1) * 2; i++) {
        for (int j = 0; j < (3 + (a - 1)) * b.length(); j++) {
          if ((j - (a + 1)) % (a + 2) == 0 && (j + 1) != (3 + (a - 1)) * b.length())
            sb.append(data[i][j] + " ");
          else sb.append(data[i][j]);
        }
        sb.append("\n");
      }
      System.out.println(sb);
    }
  }
예제 #9
0
파일: URIArg.java 프로젝트: colima/OpenDMTP
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append(this.key);
   String v = this.val;
   if ((v != null) && !v.equals("")) {
     sb.append("=").append(v);
   }
   return sb.toString();
 }
예제 #10
0
  public String toString() {

    StringBuffer buf = new StringBuffer();
    for (Cell i = head; i != null; i = i.getNext()) {
      buf.append(i.getElement().toString());
      buf.append(" ");
    }

    return buf.toString();
  }
예제 #11
0
 EncodedTextField(String textField) {
   StringBuffer b = new StringBuffer();
   int p = 0;
   while (textField.indexOf("\n", p) > -1) {
     b.append(textField.substring(p, textField.indexOf("\n", p)));
     b.append("<br />");
     p = textField.indexOf("\n", p) + 1;
   }
   b.append(textField.substring(p));
   text = b.toString();
 }
  public String __invoke_user_code__(
      final com.mia.formation.mvc.View current,
      final com.mia.openapi.gen.Context context,
      final com.mia.openapi.gen.GenerationServicesManager manager) {

    java.lang.StringBuffer _template_buffer = new java.lang.StringBuffer();
    _template_buffer.append("src/com/mia/banque/ui/view/swt/");
    _template_buffer.append(manager.action(current, "name"));
    _template_buffer.append(".java");
    return _template_buffer.toString();
  }
예제 #13
0
파일: URIArg.java 프로젝트: colima/OpenDMTP
 /**
  * ** Returns a String representation of all key/values ** @param sbuff The StringBuffer to write
  * the key/values to, or null ** for a new one ** @return A String representation of all
  * key/values
  */
 public StringBuffer getArgString(StringBuffer sbuff) {
   StringBuffer sb = (sbuff != null) ? sbuff : new StringBuffer();
   for (Iterator i = this.getKeyValList().iterator(); i.hasNext(); ) {
     KeyVal kv = (KeyVal) i.next();
     sb.append(kv.toString());
     if (i.hasNext()) {
       sb.append("&");
     }
   }
   return sb;
 }
예제 #14
0
  public static java.lang.String escapeString(java.lang.String s) {
    java.lang.StringBuffer stringbuffer = new StringBuffer();
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '/' || c == '\\') {
        stringbuffer.append('\\');
      }
      stringbuffer.append(c);
    }

    return stringbuffer.toString();
  }
예제 #15
0
 public static javax.net.SocketFactory getSSLFactory(
     java.lang.String s, java.lang.String s1, java.lang.StringBuffer stringbuffer) {
   javax.net.ssl.SSLSocketFactory sslsocketfactory = null;
   try {
     if (!(new File(s)).exists()) {
       throw new Exception("certificate not found");
     }
     java.security.KeyStore keystore;
     if (s.endsWith(".pfx")) {
       keystore = java.security.KeyStore.getInstance("PKCS12");
     } else {
       keystore = java.security.KeyStore.getInstance("JKS");
     }
     java.io.FileInputStream fileinputstream = new FileInputStream(s);
     char ac[] = s1.toCharArray();
     char ac1[] = s1.toCharArray();
     keystore.load(fileinputstream, ac);
     java.util.Enumeration enumeration = keystore.aliases();
     while (enumeration.hasMoreElements()) {
       java.lang.String s2 = (java.lang.String) enumeration.nextElement();
       certificateDescription = certificateDescription + " (" + s2;
       java.security.cert.Certificate acertificate[] = keystore.getCertificateChain(s2);
       if (acertificate != null) {
         int i = 0;
         while (i < acertificate.length) {
           java.security.cert.X509Certificate x509certificate =
               (java.security.cert.X509Certificate) acertificate[i];
           certificateDescription =
               certificateDescription
                   + " (cert "
                   + x509certificate.getSubjectDN()
                   + ", "
                   + x509certificate.getSigAlgName()
                   + ")";
           i++;
         }
       }
     }
     stringbuffer.append("certs: " + certificateDescription + "\n");
     com.sun.net.ssl.KeyManagerFactory keymanagerfactory =
         com.sun.net.ssl.KeyManagerFactory.getInstance("SunX509");
     keymanagerfactory.init(keystore, ac1);
     com.sun.net.ssl.KeyManager akeymanager[] = keymanagerfactory.getKeyManagers();
     com.sun.net.ssl.SSLContext sslcontext = com.sun.net.ssl.SSLContext.getInstance("SSL");
     sslcontext.init(akeymanager, null, randomGenerator);
     sslsocketfactory = sslcontext.getSocketFactory();
   } catch (java.lang.Throwable throwable) {
     throwable.printStackTrace();
     stringbuffer.append("error: " + throwable.toString());
   }
   return sslsocketfactory;
 }
  @Override
  public byte[] serialize() {
    java.lang.StringBuffer sb = new java.lang.StringBuffer();

    sb.append(
        org.drip.service.stream.Serializer.VERSION
            + getFieldDelimiter()
            + _iRollMode
            + getFieldDelimiter()
            + _strCalendar);

    return sb.append(getObjectTrailer()).toString().getBytes();
  }
예제 #17
0
  @Override
  public org.drip.state.identifier.LatentStateLabel label() {
    java.lang.StringBuffer sb = new java.lang.StringBuffer();

    sb.append("FXFWDBASIS[" + _cp.code() + "]=");

    for (int i = 0; i < _adblDate.length; ++i) {
      if (0 != i) sb.append(";");

      sb.append(_adblDate[i] + ":" + _adblFXBasis[i]);
    }

    return org.drip.state.identifier.CustomMetricLabel.Standard(sb.toString());
  }
예제 #18
0
  public String propertiesToString() {
    StringBuffer sb = new StringBuffer();

    sb.append(super.propertiesToString());
    boolean listStarted = !sb.toString().equals("");
    if (rot != null) {
      if (listStarted) sb.append(", ");
      sb.append("Team=");
      sb.append(team);
      listStarted = true;
    }

    return sb.toString();
  }
예제 #19
0
 /**
  * ** Returns a String representation of all key/values ** @param sbuff The StringBuffer to write
  * the key/values to, or null for a new one ** @param includeBlankValues True to include keys for
  * blank values. ** @return A String representation of all key/values
  */
 public StringBuffer getArgString(StringBuffer sbuff, boolean includeBlankValues) {
   StringBuffer sb = (sbuff != null) ? sbuff : new StringBuffer();
   int argCnt = 0;
   for (Iterator i = this.getKeyValList().iterator(); i.hasNext(); ) {
     KeyVal kv = (KeyVal) i.next();
     if (includeBlankValues || kv.hasValue()) {
       if (argCnt > 0) {
         sb.append("&");
       }
       sb.append(kv.toString());
       argCnt++;
     }
   }
   return sb;
 }
  @Override
  public byte[] serialize() {
    java.lang.StringBuffer sb = new java.lang.StringBuffer();

    sb.append(
        org.drip.service.stream.Serializer.VERSION
            + getFieldDelimiter()
            + _bIsPerpetual
            + getFieldDelimiter()
            + _bIsDefaulted
            + getFieldDelimiter()
            + _bHasBeenExercised);

    return sb.append(getObjectTrailer()).toString().getBytes();
  }
예제 #21
0
 /**
  * ** Returns a string representation of this object ** @return The string representation of this
  * object
  */
 public String toString() {
   DBField kf[] = this.getKeyFields();
   if (kf.length == 0) {
     return "<null>";
   } else {
     DBFieldValues fv = this.getFieldValues();
     StringBuffer sb = new StringBuffer();
     for (int i = 0; i < kf.length; i++) {
       if (i > 0) {
         sb.append(",");
       }
       sb.append(fv.getFieldValueAsString(kf[i].getName()));
     }
     return sb.toString();
   }
 }
예제 #22
0
  public void reduce(LongWritable key, Iterable<Text> values, Context context)
      throws IOException, InterruptedException {
    double sumOfRankValues = 0.0;
    String targetUrlsList = "";

    int sourceUrl = (int) key.get();
    int numUrls = context.getConfiguration().getInt("numUrls", 1);

    // hints each tuple may include: rank value tuple or link relation tuple
    for (Text value : values) {
      String[] strArray = value.toString().split("#");
      // sourceUrl = Integer.parseInt(strArray[0].split("\t")[1]);
      if (strArray.length == 1) {
        sumOfRankValues += Double.parseDouble(strArray[0]);
      } else {
        StringBuffer sb = new StringBuffer();
        for (int i = 1; i < strArray.length; i++) {
          sb.append("#" + strArray[i]);
        }
        targetUrlsList = sb.toString();
      }
    }
    sumOfRankValues = 0.85 * sumOfRankValues + 0.15 * (1.0) / (double) numUrls;
    context.write(key, new Text(sumOfRankValues + targetUrlsList));
  }
예제 #23
0
  @Override
  public byte[] serialize() {
    java.lang.StringBuffer sb = new java.lang.StringBuffer();

    sb.append(
        org.drip.service.stream.Serializer.VERSION
            + getFieldDelimiter()
            + _strTradeDiscountCurve
            + getFieldDelimiter()
            + _strCouponDiscountCurve
            + getFieldDelimiter()
            + _strPrincipalDiscountCurve
            + getFieldDelimiter()
            + _strRedemptionDiscountCurve);

    return sb.append(getObjectTrailer()).toString().getBytes();
  }
예제 #24
0
파일: URIArg.java 프로젝트: colima/OpenDMTP
 /**
  * ** A String reperesentation of this URI (with arguments) ** @return A String representation of
  * this URI
  */
 public String toString() {
   StringBuffer sb = new StringBuffer(this.getURI());
   if (!ListTools.isEmpty(this.getKeyValList())) {
     sb.append("?");
     this.getArgString(sb);
   }
   return sb.toString();
 }
예제 #25
0
 /**
  * ** A String reperesentation of this URI (with arguments) ** @param includeBlankValues True to
  * include keys for blank values. ** @return A String representation of this URI
  */
 public String toString(boolean includeBlankValues) {
   StringBuffer sb = new StringBuffer(this.getURI());
   if (!ListTools.isEmpty(this.getKeyValList())) {
     sb.append("?");
     this.getArgString(sb, includeBlankValues);
   }
   return sb.toString();
 }
예제 #26
0
    private void toXML(java.lang.StringBuffer stringbuffer, int i) {
      java.lang.StringBuffer stringbuffer1 = new StringBuffer();
      for (int j = 0; j < i; j++) {
        stringbuffer1.append("  ");
      }

      if (cls == null) {
        stringbuffer.append(stringbuffer1 + "<" + keys.get("root") + ">\n");
      } else {
        java.lang.String s = (java.lang.String) keys.get(cls);
        if (s == null) {
          s = cls;
        }
        stringbuffer.append(
            stringbuffer1
                + "<"
                + keys.get("object")
                + " "
                + keys.get("class")
                + "=\""
                + s
                + "\" "
                + keys.get("name")
                + "=\""
                + escape(name)
                + "\">\n");
        if (hasCounters) {
          stringbuffer.append(
              stringbuffer1
                  + "  <"
                  + keys.get("counter")
                  + " "
                  + keys.get("name")
                  + "=\"HPS\" "
                  + keys.get("enabled")
                  + "=\"1\"/>\n");
          stringbuffer.append(
              stringbuffer1
                  + "  <"
                  + keys.get("counter")
                  + " "
                  + keys.get("name")
                  + "=\"ART\" "
                  + keys.get("enabled")
                  + "=\"1\"/>\n");
        }
      }
      TreeNode treenode;
      for (java.util.Iterator iterator = children.values().iterator();
          iterator.hasNext();
          treenode.toXML(stringbuffer, i + 1)) {
        treenode = (TreeNode) iterator.next();
      }

      if (cls == null) {
        stringbuffer.append(stringbuffer1 + "</" + keys.get("root") + ">");
      } else {
        stringbuffer.append(stringbuffer1 + "</" + keys.get("object") + ">\n");
      }
    }
  private void writeQNames(
      javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter)
      throws javax.xml.stream.XMLStreamException {
    if (qnames != null) {
      // we have to store this data until last moment since it is not possible to write any
      // namespace data after writing the charactor data
      java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
      java.lang.String namespaceURI = null;
      java.lang.String prefix = null;

      for (int i = 0; i < qnames.length; i++) {
        if (i > 0) {
          stringToWrite.append(" ");
        }

        namespaceURI = qnames[i].getNamespaceURI();

        if (namespaceURI != null) {
          prefix = xmlWriter.getPrefix(namespaceURI);

          if ((prefix == null) || (prefix.length() == 0)) {
            prefix = generatePrefix(namespaceURI);
            xmlWriter.writeNamespace(prefix, namespaceURI);
            xmlWriter.setPrefix(prefix, namespaceURI);
          }

          if (prefix.trim().length() > 0) {
            stringToWrite
                .append(prefix)
                .append(":")
                .append(
                    org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
          } else {
            stringToWrite.append(
                org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
          }
        } else {
          stringToWrite.append(
              org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
        }
      }

      xmlWriter.writeCharacters(stringToWrite.toString());
    }
  }
예제 #28
0
 private void addRowStatusChecker(
     Context ctxt,
     MibNode node,
     String description,
     String syntax,
     String var,
     StringBuffer buff) {
   buff.append(
       Def.TAB
           + "/**\n"
           + Def.TAB
           + " * "
           + MessageHandler.getMessage("generate.mbean.comment.checker", var)
           + "\n"
           + Def.TAB
           + " * "
           + MessageHandler.getMessage("generate.mbean.comment.checker.rs.deprecated")
           + "\n"
           + Def.TAB
           + " * "
           + MessageHandler.getMessage("generate.mbean.comment.checker.rs.override")
           + "\n"
           + Def.TAB
           + " */\n");
   buff.append(
       Def.TAB
           + Def.PUBLIC
           + Def.VOID
           + Def.CHECK
           + var
           + "("
           + syntax
           + "x) "
           + BeanGenerator.accessThrows);
   buff.append(
       Def.TAB2
           + "//\n"
           + Def.TAB2
           + "// "
           + MessageHandler.getMessage("generate.mbean.comment.checker.rs.policy")
           + "\n"
           + Def.TAB2
           + "//\n");
   buff.append(Def.TAB + Def.RBRACE + "\n");
 }
 /** Override toString method to provide information on nested exceptions. */
 public synchronized String toString() {
   String s = super.toString();
   Exception n = next;
   if (n == null) return s;
   StringBuffer sb = new StringBuffer(s == null ? "" : s);
   while (n != null) {
     sb.append(";\n  nested exception is:\n\t");
     if (n instanceof MessagingException) {
       MessagingException mex = (MessagingException) n;
       sb.append(mex.superToString());
       n = mex.next;
     } else {
       sb.append(n.toString());
       n = null;
     }
   }
   return sb.toString();
 }
예제 #30
0
  // ask user for script file and name of new profile
  // return false if user cancelled operation
  private boolean getNewWkldInput(
      JFileChooser chooser, Object[] optionDlgMsg, StringBuffer name, StringBuffer scriptFile) {
    // let user select script file with queries
    boolean fileOk = false;
    int retval;
    File file = null;
    FileReader reader = null;
    while (!fileOk) {
      if ((retval = chooser.showDialog(this, "Ok")) != 0) {
        return false;
      }
      file = chooser.getSelectedFile();
      try {
        reader = new FileReader(file.getPath());
        fileOk = true;
        scriptFile.append(file.getPath());
      } catch (FileNotFoundException e) {
        JOptionPane.showMessageDialog(
            this,
            "Selected script file does not exist",
            "Error: New Profile",
            JOptionPane.ERROR_MESSAGE);
      }
    }

    // let user select filename for profile
    int response =
        JOptionPane.showOptionDialog(
            this,
            optionDlgMsg,
            "New Profile",
            JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.PLAIN_MESSAGE,
            null,
            null,
            null);
    if (response != JOptionPane.OK_OPTION) {
      return false;
    }
    JTextField textFld = (JTextField) optionDlgMsg[1];
    name.append(file.getParent() + "/" + textFld.getText());
    return true;
  }