示例#1
0
 /**
  * This converts the float to text and then to byte[FLOAT_LENGTH] then writes it to the file.
  * Later, use readFloat to read the value from the file.
  */
 public void writeFloat(int col, int row, float f) throws IOException {
   write(col, row, String2.toByteArray(String2.right("" + f, FLOAT_LENGTH)));
 }
示例#2
0
 /**
  * This converts the double to text and then to byte[DOUBLE_LENGTH] then writes it to the file.
  * Later, use readDouble to read the value from the file.
  */
 public void writeDouble(int col, int row, double d) throws IOException {
   write(col, row, String2.toByteArray(String2.right("" + d, DOUBLE_LENGTH)));
 }
示例#3
0
 /**
  * This converts the long to text and then to byte[LONG_LENGTH] then writes it to the file. Later,
  * use readLong to read the value from the file.
  */
 public void writeLong(int col, int row, long i) throws IOException {
   write(col, row, String2.toByteArray(String2.right("" + i, LONG_LENGTH)));
 }
示例#4
0
 /**
  * This converts the int to text and then to byte[INT_LENGTH] then writes it to the file. Later,
  * use readInt to read the value from the file.
  */
 public void writeInt(int col, int row, int i) throws IOException {
   write(col, row, String2.toByteArray(String2.right("" + i, INT_LENGTH)));
 }
示例#5
0
 /**
  * This converts the short to text and then to byte[SHORT_LENGTH] then writes it to the file.
  * Later, use readShort to read the value from the file.
  */
 public void writeShort(int col, int row, short s) throws IOException {
   write(col, row, String2.toByteArray(String2.right("" + s, SHORT_LENGTH)));
 }
示例#6
0
 /**
  * This converts the byte to text and then to byte[BYTE_LENGTH] then writes it to the file. Later,
  * use readByte to read the value from the file.
  */
 public void writeByte(int col, int row, byte b) throws IOException {
   write(col, row, String2.toByteArray(String2.right("" + b, BYTE_LENGTH)));
 }
示例#7
0
  /**
   * This gets the data from CWDataBrowserReset (if any is available)
   *
   * @return true if reset info was successfully retrieved
   */
  public boolean getDataFromReset() {
    // is there no resetThread?
    if (resetThread == null) return false;

    // is the resetThread still running?
    if (resetThread.isAlive()) return false;

    // did the resetThread throw an exception?
    String2.log(cwDataBrowserReset.runInfo.toString());
    if (cwDataBrowserReset.runError.length() > 0) {
      // error already printed to Tomcat's log
      // there is nothing more to be done
      // keep using old data
      // send email to Bob Simons?
      cwDataBrowserReset = null;
      resetThread = null;
      return false;
    }

    // store dataSet info
    activeDataSetOptions = cwDataBrowserReset.activeDataSetOptions;
    activeDataSetTitles = cwDataBrowserReset.activeDataSetTitles;
    activeDataSetContents = cwDataBrowserReset.activeDataSetContents;
    dataSet.setOptions(activeDataSetOptions); // 1 time only; doesn't change till next reset()
    dataSet.setTitles(activeDataSetTitles); // 1 time only; doesn't change till next reset()
    if (verbose)
      String2.log("activeDataSetTitles: " + String2.toNewlineString(activeDataSetTitles));

    // print lots of useful information
    String2.log(
        "\n"
            + String2.makeString('*', 80)
            + "\nCWDataBrowser.getDataFromReset "
            + Calendar2.getCurrentISODateTimeStringLocal());
    String2.log("CWDataBrowser construction was at " + constructorDateTime + ".  Since then...\n");
    String2.log("Data files found which have matching .gif files:");
    String2.log(getUsageStatistics());
    String2.log("  number of page requests initiated since construction: " + nRequestsInitiated);
    String2.log("  number of page requests completed since construction: " + nRequestsCompleted);
    if (nRequestsInitiated > 0) {
      DecimalFormat percent = new DecimalFormat("##0.000");
      double nRequests = nRequestsInitiated / 100.0;
      String2.log("Data Set Usage:");
      for (int i = 0; i < dataSetOptions.length; i++)
        String2.log(
            String2.right(percent.format(dataSetRequests[i] / nRequests), 9)
                + "% were for "
                + dataSetOptions[i]);
      String2.log("Time Period Usage:");
      for (int i = 0; i < timePeriodOptions.length; i++)
        String2.log(
            String2.right(percent.format(timePeriodRequests[i] / nRequests), 9)
                + "% were for "
                + timePeriodOptions[i]);
      String2.log("Region Usage:");
      for (int i = 0; i < regionOptions.length; i++)
        String2.log(
            String2.right(percent.format(regionRequests[i] / nRequests), 9)
                + "% were for "
                + regionOptions[i]);
    }

    String2.log(
        SSR.getTopN(printTopNMostRequested, " Most Requested .gif files", requestedFilesMap));

    // data was successfully gathered from CWDataBrowserReset
    resetThread = null;
    cwDataBrowserReset = null;
    return true;
  }