Esempio n. 1
0
  public static void writeArrayToFile(double[] array, String fileName, String headerLine) {
    double matrix[][] = new double[array.length][1];

    for (int i = 0; i < array.length; i++) {
      matrix[i][0] = array[i];
    }

    GeneralLib.writeMatrix(matrix, fileName, headerLine);
  }
Esempio n. 2
0
  public static void writeHashMapToFile(HashMap hm, String headerLine, String fileName) {
    ArrayList<String> list = new ArrayList<String>();
    list.add(headerLine);

    for (Object key : hm.keySet()) {
      StringBuffer stringBuffer = new StringBuffer();
      stringBuffer.append(key.toString());
      stringBuffer.append("\t");
      stringBuffer.append(hm.get(key).toString());
      list.add(stringBuffer.toString());
    }

    GeneralLib.writeList(list, fileName);
  }
Esempio n. 3
0
  public static int getTimeBinIndex(double time, double binSizeInSeconds) {

    time = GeneralLib.projectTimeWithin24Hours(time);

    return Math.round((float) Math.floor(time / binSizeInSeconds));
  }
Esempio n. 4
0
 public static double getDistance(Coord coord, Link link) {
   return GeneralLib.getDistance(coord, link.getCoord());
 }