Ejemplo n.º 1
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();
 }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 3
0
  @SuppressWarnings("unchecked")
  public void _addRandomSampleData(int setCount, int tempCount) throws Exception {
    long sts = this.minDateTS;
    long ets = this.maxDateTS;
    Random ran = new Random(sts);

    /* init datasets */
    if (setCount <= 0) {
      setCount = 1;
    }
    java.util.List<Data> dataSet[] = new java.util.List[setCount];
    for (int d = 0; d < dataSet.length; d++) {
      dataSet[d] = new Vector<Data>();
    }

    /* populate random temperature data */
    double rangeC = this.maxTempC - this.minTempC;
    long deltaSize = (ets - sts) / (long) tempCount;
    long deltaRangeTS = DateTime.HourSeconds(3);
    long ts = sts + (deltaSize / 2L);
    double Cs = (ran.nextDouble() * rangeC * 0.10) + (rangeC * 0.05);
    for (int t = 0; t < tempCount; t++) {
      double C[] = new double[dataSet.length];
      for (int d = 0; d < dataSet.length; d++) {
        C[d] = (ran.nextDouble() * 7.0) + ((d == 0) ? Cs : C[d - 1]) - 2.5;
        if (C[d] < this.minTempC) {
          C[d] = this.minTempC;
        }
        if (C[d] > this.maxTempC) {
          C[d] = this.maxTempC;
        }
        dataSet[d].add(new Data(ts, C[d]));
      }
      ts =
          sts
              + ((long) (t + 1) * deltaSize)
              + (long) ran.nextInt((int) deltaRangeTS)
              + (deltaRangeTS / 2L);
      if (ts > ets) {
        ts = ets - 1L;
      }
      // ts = sts + ((t==0)?DateTime.HourSeconds(1):(long)ran.nextInt((int)(ets - sts)));
      Cs = C[0];
    }

    /* add datasets */
    for (int d = 0; d < dataSet.length; d++) {
      ListTools.sort(dataSet[d], null);
      Color color = TEMP_COLOR[d % TEMP_COLOR.length];
      this.addDataSet(color, "Temp " + (d + 1), dataSet[d].toArray(new Data[dataSet[d].size()]));
    }
  }
Ejemplo n.º 4
0
 /**
  * ** Returns a new URIArg with this URIArg's arguments encoded into a ** single RTProperties
  * added with a specified key [CHECK] ** @param rtpKey The key to add the encoded args at
  * ** @param exclKeys keys to exclude from encoding ** @return A new URIArg with non excluded
  * arguments encoded
  */
 public URIArg rtpEncode(String rtpKey, String... exclKeys) {
   URIArg rtpUrl = new URIArg(this.getURI());
   RTProperties rtp = new RTProperties();
   for (KeyVal kv : this.getKeyValList()) {
     String kn = kv.getKey();
     if (ListTools.contains(exclKeys, kn)) {
       rtpUrl.addArg(kv);
     } else {
       rtp.setString(kn, kv.getValue());
     }
   }
   rtpUrl.addArg(rtpKey, rtp);
   return rtpUrl;
 }
Ejemplo n.º 5
0
 /**
  * ** Sets the specified argument key to the specified String value. ** @param key The key of the
  * agrument ** @param value The value to set ** @param obfuscate True if the value should be
  * obfuscated ** @return True if the argument existed, else false
  */
 public boolean setArgValue(String key[], String value, boolean obfuscate) {
   if (ListTools.size(key) >= 1) {
     boolean hadArg = this.hasArg(key);
     // remove all but the first key
     for (int i = 1; i < key.length; i++) {
       this.removeArg(key[i]);
     }
     // set the first key
     this.setArgValue(key[0], value, obfuscate);
     return hadArg;
   } else {
     return false;
   }
 }