Exemplo n.º 1
0
  public int populateNamesAndIDs(
      COM.dragonflow.Properties.StringProperty astringproperty[],
      COM.dragonflow.Properties.StringProperty astringproperty1[],
      COM.dragonflow.SiteView.Monitor monitor,
      java.lang.StringBuffer stringbuffer) {
    if (!$assertionsDisabled && astringproperty.length != astringproperty1.length) {
      throw new AssertionError();
    }
    stringbuffer.setLength(0);
    int i = 0;
    for (int j = 0; j < metrics.size() && i < astringproperty1.length; j++) {
      COM.dragonflow.Utils.Snmp.Monitoring.Metric metric =
          (COM.dragonflow.Utils.Snmp.Monitoring.Metric) metrics.get(j);
      java.lang.String as[] = metric.getInstanceOIDs(stringbuffer);
      java.lang.String as1[] = metric.getInstanceNames(stringbuffer);
      if (stringbuffer.length() > 0) {
        return i;
      }
      for (int k = 0; k < as.length && i < astringproperty1.length; k++) {
        monitor.setProperty(astringproperty1[i], as[k]);
        if (as1.length == as.length) {
          monitor.setProperty(astringproperty[i], as1[k]);
        } else {
          monitor.setProperty(astringproperty[i], as1[0]);
        }
        i++;
      }
    }

    return i;
  }
Exemplo n.º 2
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");
 }
Exemplo n.º 3
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();
  }
  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));
  }
 public java.lang.String toString() {
   java.lang.StringBuffer __s = new java.lang.StringBuffer();
   __s.append(posX);
   __s.append(":");
   __s.append(posY);
   return __s.toString();
 }
Exemplo n.º 6
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");
 }
Exemplo n.º 7
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();
 }
Exemplo n.º 8
0
 /**
  * ** 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();
 }
 /**
  * Appends the contents of the specified {@code StringBuffer}. If the StringBuffer is {@code
  * null}, then the string {@code "null"} is appended.
  *
  * @param sb the {@code StringBuffer} to append.
  * @return this builder.
  */
 public StringBuilder append(StringBuffer sb) {
   if (sb == null) {
     appendNull();
   } else {
     append0(sb.getValue(), 0, sb.length());
   }
   return this;
 }
Exemplo n.º 10
0
 public TextState copyAll() {
   TextState tmp = copyState();
   if (s.length() == 0) return tmp;
   for (int i = 0; i < s.length(); i++) {
     tmp.s.append(s.charAt(i));
   }
   return tmp;
 }
Exemplo n.º 11
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();
 }
Exemplo n.º 12
0
  /**
   * Flushes any buffered but not yet written characters. Subclasses which override this method
   * should call this method <em>before</em> flushing any of their own buffers.
   */
  public void flush() throws IOException {
    super.flush();

    if (state == S_text && currentCharacters.length() > 0) {
      handleText(currentCharacters.toString());
      currentCharacters = new StringBuffer();
    }
  }
Exemplo n.º 13
0
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append(this.key);
   if (this.hasValue()) {
     sb.append("=").append(this.val);
   }
   return sb.toString();
 }
Exemplo n.º 14
0
 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();
 }
Exemplo n.º 15
0
  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);
    }
  }
Exemplo n.º 16
0
 public String nextString() throws Exception {
   StringBuffer sb = new StringBuffer("");
   byte c = read();
   while (c <= ' ') c = read();
   do {
     sb.append((char) c);
     c = read();
   } while (c > ' ');
   return sb.toString();
 }
Exemplo n.º 17
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();
  }
Exemplo n.º 18
0
 protected java.lang.String doRequest(java.lang.String s, boolean flag, java.lang.String s1)
     throws java.lang.Exception {
   if (s == null) {
     throw new Exception("Paramater uri cannot be null");
   }
   com.dragonflow.Utils.SocketSession socketsession =
       com.dragonflow.Utils.SocketSession.getSession(null);
   java.lang.StringBuffer stringbuffer = new StringBuffer(10000);
   java.lang.String s2 = "http://" + getConnID() + s;
   jgl.Array array = null;
   if (s1 != null) {
     array = new Array();
     array.add("Custom-Content: " + s1);
   }
   long al[] =
       com.dragonflow.StandardMonitor.URLMonitor.checkURL(
           socketsession,
           s2,
           null,
           null,
           null,
           null,
           null,
           array,
           null,
           null,
           null,
           stringbuffer,
           0x989680L,
           null,
           0,
           60000,
           null);
   java.lang.String s3 =
       com.dragonflow.StandardMonitor.URLMonitor.getHTTPContent(stringbuffer.toString());
   if (al[0] == 200L) {
     s3 = s3.trim();
     if (s3.startsWith("<") && flag) {
       java.lang.String s5 = s3.substring(0, 50);
       java.lang.String s4;
       if (s3.indexOf("<P>") >= 0) {
         xmlKeys = xmlShortKeys;
         s4 = "J2EEGetListShort.xsl";
       } else {
         xmlKeys = xmlLongKeys;
         s4 = "J2EEGetList.xsl";
       }
       return J2EEConnection.transform(s3, "templates.applications/" + s4);
     } else {
       return s3;
     }
   } else {
     throw new Exception(com.dragonflow.StandardMonitor.URLMonitor.lookupStatus(al[0]));
   }
 }
  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();
  }
Exemplo n.º 20
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 ** @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;
 }
Exemplo n.º 21
0
  /** Reads caracters in the middle of tags */
  @Override
  public void characters(char[] ch, int start, int length) throws SAXException {

    // tempTitle = new String(ch, start, length);
    int l = bufferString.length();
    bufferString.insert(l, new String(ch, start, length)); // Inserts
    // characters as
    // string in end
    // of buffer

  }
Exemplo n.º 22
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();
 }
Exemplo n.º 23
0
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append(this.getAccountID());
   sb.append("/");
   sb.append(this.getDeviceID());
   sb.append(" ");
   sb.append(this.getStatusCode());
   sb.append("[");
   sb.append(this.getDescription());
   sb.append("]");
   return sb.toString();
 }
Exemplo n.º 24
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();
  }
 /**
  * This function attempts to convert the text to a double. It returns a valid double if
  * successful, NaN otherwise.
  */
 protected double getDouble(boolean insert, FilterBypass fb, int offs, String str, int length)
     throws BadLocationException {
   StringBuffer sb = getTextPrototype(insert, fb, offs, str, length);
   if (sb.toString().isEmpty()) {
     return 0; // We treat an empty string as 0.
   }
   try {
     return Double.parseDouble(sb.toString());
   } catch (NumberFormatException ex) {
     return Double.NaN; // String was not a number.
   }
 } // End of get double
Exemplo n.º 26
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;
 }
Exemplo n.º 27
0
  public boolean refreshMetrics(java.lang.StringBuffer stringbuffer) {
    stringbuffer.setLength(0);
    for (int i = 0; i < metrics.size(); i++) {
      COM.dragonflow.Utils.Snmp.Monitoring.Metric metric =
          (COM.dragonflow.Utils.Snmp.Monitoring.Metric) metrics.get(i);
      metric.refresh(stringbuffer);
      if (stringbuffer.length() > 0) {
        return false;
      }
    }

    return true;
  }
 /**
  * This function inserts or replaces the user's input in a string buffer, to create the text
  * which would be on screen if we allowed it. We declare to throw bad location due to
  * doc.getText, but since the paramters are coming from the farmework, that should never
  * happen.... in theory. If insert is true we insert, if false we replace. Length parameter only
  * used when replacing.
  */
 private StringBuffer getTextPrototype(
     boolean insert, FilterBypass fb, int offs, String str, int length)
     throws BadLocationException {
   Document doc = fb.getDocument();
   String text = doc.getText(0, doc.getLength());
   StringBuffer sb = new StringBuffer(text);
   if (insert) {
     sb.insert(offs, str);
   } else {
     sb.replace(offs, offs + length, str);
   }
   return sb;
 } // end of getTextPrototype
Exemplo n.º 29
0
  /** Called automatically every time and end-tag is discovered */
  public void endElement(String uri, String localName, String element) {

    if (element.equalsIgnoreCase("title")) {
      snippets.add(bufferString.toString());
    }

    if (element.equalsIgnoreCase("str")) {
      snippets.add(bufferString.toString());
    }
    if (element.equalsIgnoreCase("field")) {
      snippets.add(bufferString.toString());
    }
  }
  @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();
  }