Example #1
0
  private int[] applyNewFeatures(List<RankList> samples, int[] features) {
    int totalFeatureCount = samples.get(0).get(0).getFeatureCount();
    int[] newFeatures = new int[features.length + lcList.size()];
    System.arraycopy(features, 0, newFeatures, 0, features.length);
    // for(int i=0;i<features.length;i++)
    // newFeatures[i] = features[i];
    for (int k = 0; k < lcList.size(); k++)
      newFeatures[features.length + k] = totalFeatureCount + k + 1;

    float[] addedFeatures = new float[lcList.size()];
    for (int i = 0; i < samples.size(); i++) {
      RankList rl = samples.get(i);
      for (int j = 0; j < rl.size(); j++) {
        DataPoint p = rl.get(j);
        for (int k = 0; k < lcList.size(); k++)
          addedFeatures[k] = lcList.get(k).compute(p.getExternalFeatureVector());

        p.addFeatures(addedFeatures);
      }
    }

    int[] newFeatures2 = new int[lcList.size()];
    for (int i = 0; i < lcList.size(); i++) newFeatures2[i] = newFeatures[i + features.length];

    if (keepOrigFeatures) return newFeatures;
    return newFeatures2;
  }
Example #2
0
 @Override
 protected void doReset() {
   currentX = initialState.getX();
   currentY = initialState.getY();
   currentZ = initialState.getZ();
   currentT = 0.0;
 }
Example #3
0
 public int[] getFeatureFromSampleVector(List<RankList> samples) {
   DataPoint dp = samples.get(0).get(0);
   int fc = dp.getFeatureCount();
   int[] features = new int[fc];
   for (int i = 0; i < fc; i++) features[i] = i + 1;
   return features;
 }
Example #4
0
    /**
     * Find the record with the specified primary keys
     *
     * @return DataPoint or null if no record is found
     */
    public DataPoint find(int id) {
      DataPoint rec = new DataPoint();

      // Create temp object and look in cache for it
      ((DataPoint_base) rec).initialize(id);
      rec = (DataPoint) GenOrmDataSource.getGenOrmConnection().getCachedRecord(rec.getRecordKey());

      java.sql.PreparedStatement genorm_statement = null;
      java.sql.ResultSet genorm_rs = null;

      if (rec == null) {
        try {
          // No cached object so look in db
          genorm_statement = GenOrmDataSource.prepareStatement(SELECT + FROM + KEY_WHERE);
          genorm_statement.setInt(1, id);

          s_logger.debug(genorm_statement.toString());

          genorm_rs = genorm_statement.executeQuery();
          if (genorm_rs.next()) rec = newDataPoint(genorm_rs);
        } catch (java.sql.SQLException sqle) {
          throw new GenOrmException(sqle);
        } finally {
          try {
            if (genorm_rs != null) genorm_rs.close();

            if (genorm_statement != null) genorm_statement.close();
          } catch (java.sql.SQLException sqle2) {
            throw new GenOrmException(sqle2);
          }
        }
      }

      return (rec);
    }
Example #5
0
    /** Creates a new entry with the specified primary keys. */
    public DataPoint create(int id) {
      DataPoint rec = new DataPoint();
      rec.m_isNewRecord = true;

      ((DataPoint_base) rec).setId(id);

      return ((DataPoint) GenOrmDataSource.getGenOrmConnection().getUniqueRecord(rec));
    }
Example #6
0
 private int getNextYForEnemy(int x, int y, DataPoint dp) {
   double dist = computeDistance(x, y, dp.getCoordX(), dp.getCoordY());
   if (dist <= ENEMY_DIST_BY_TURN) {
     return dp.getCoordY();
   } else {
     return (int) (y + ((dp.getCoordY() - y) * ENEMY_DIST_BY_TURN / dist));
   }
 }
  public void printDataPoints() {

    System.out.println("****************DATA********************");
    for (DataPoint data : datapoints) {

      System.out.println(data.toString());
    }
    System.out.println("*****************************************");
  }
Example #8
0
 private int getNextYForEnemy(Enemy en, DataPoint dp) {
   double dist = computeDistance(en.getCoordX(), en.getCoordY(), dp.getCoordX(), dp.getCoordY());
   if (dist <= ENEMY_DIST_BY_TURN) {
     return dp.getCoordY();
   } else {
     return (int)
         (en.getCoordY() + ((dp.getCoordY() - en.getCoordY()) * ENEMY_DIST_BY_TURN / dist));
   }
 }
Example #9
0
 private double distance(DataPoint a, DataPoint b) {
   double d = 0;
   float[] a1 = a.getDataLocation();
   float[] b1 = b.getDataLocation();
   for (int i = 0; i < a1.length; i++) {
     d += (a1[i] - b1[i]) * (a1[i] - b1[i]);
   }
   return d;
 }
Example #10
0
  public DataPoint<T> get(final DataPoint<T> dataPoint) {
    DataPoint<T> returnDataPoint = null;

    final DataPoint<T> inSpaceDataPoint = this.get(dataPoint.getCoordinates());
    if (inSpaceDataPoint.getData().compareTo(dataPoint.getData()) == 0) {
      returnDataPoint = inSpaceDataPoint;
    }

    return returnDataPoint;
  }
Example #11
0
    /**
     * If the table has a primary key that has a key generator this method will return a new table
     * entry with a generated primary key.
     *
     * @return DataPoint with generated primary key
     */
    public DataPoint createWithGeneratedKey() {
      DataPoint rec = new DataPoint();

      rec.m_isNewRecord = true;

      GenOrmKeyGenerator keyGen = GenOrmDataSource.getKeyGenerator("data_point");
      if (keyGen != null) {
        rec.setId((Integer) keyGen.generateKey());
      }

      return ((DataPoint) GenOrmDataSource.getGenOrmConnection().getUniqueRecord(rec));
    }
 /**
  * turns database cursor into object
  *
  * @param cursor cursor to database entry which should be returned into an object
  * @return object containing the database data
  */
 public static DataPoint cursorToDataPoint(Cursor cursor) {
   DataPoint datapoint = new DataPoint();
   datapoint.set_id(cursor.getLong(0));
   datapoint.setChannel_type(cursor.getString(1));
   datapoint.setName(cursor.getString(2));
   datapoint.setType(cursor.getString(3));
   datapoint.setAccess_type(cursor.getString(4));
   datapoint.setMin(cursor.getString(5));
   datapoint.setMax(cursor.getString(6));
   datapoint.setUnit(cursor.getString(7));
   datapoint.setStdValue(cursor.getString(8));
   return datapoint;
 }
Example #13
0
  @Override
  public DataSource clone() throws CloneNotSupportedException {
    DataSource dataSource = (DataSource) super.clone();
    dataSource.setId(null);

    dataSource.dataPoints = new HashSet<DataPoint>();
    for (DataPoint dataPoint : this.dataPoints) {
      DataPoint dp = dataPoint.clone();
      dp.setDataSource(this);
      dataSource.dataPoints.add(dp);
    }
    return dataSource;
  }
 @Override
 public void add(DataPoint datapoint) {
   overviewHandler.add(datapoint);
   if (lockSelection && selection[1] < datapoint.getX()) {
     double diff = datapoint.getX() - lastDataPoint.getX();
     double x1 = selection[0] + diff;
     double x2 = selection[1] + diff;
     setSelection(Math.max(x1, selection[0]), Math.max(x2, selection[1]));
   }
   if (firstDataPoint == null) {
     firstDataPoint = datapoint;
   }
   lastDataPoint = datapoint;
 }
Example #15
0
  public RandomWalker(String name, DataPoint initialState) {
    super(name);

    if (initialState == null) throw new IllegalArgumentException("initialState cannot be null");

    this.initialState = initialState;
    this.bounds = new DataBox(initialState, 2.0);
    this.rng = new Random();
    this.stepSize = DEFAULT_STEP_SIZE;
    this.timeStep = DEFAULT_TIME_STEP;
    this.currentX = initialState.getX();
    this.currentY = initialState.getY();
    this.currentZ = initialState.getZ();
    this.currentT = 0.0;
  }
 private double getWindowMinX() {
   double x = selection[0];
   if (x == overviewHandler.getData().getX(0)) {
     return firstDataPoint.getX();
   }
   return x;
 }
  @Test(expected = OutOfRangeException.class) // no intersection
  public void noIntersetction() throws OutOfRangeException {
    DataPoint a = new DataPoint(51, 0.25, 270);
    DataPoint b = new DataPoint(49, 2.5, 90);

    @SuppressWarnings("unused")
    Coordinate intersection = DataPoint.triangulate(a, b);
  }
  @Test(expected = OutOfRangeException.class) // same point
  public void samePoint() throws OutOfRangeException {
    DataPoint a = new DataPoint(51, 0.25, 108);
    DataPoint b = new DataPoint(51, 0.25, 32);

    @SuppressWarnings("unused")
    Coordinate intersection = DataPoint.triangulate(a, b);
  }
 private double getWindowMaxX() {
   double x = selection[1];
   SeriesData data = overviewHandler.getData();
   int size = data.length();
   if (size > 0 && x == data.getX(size - 1)) {
     return lastDataPoint.getX();
   }
   return x;
 }
Example #20
0
 private DataPoint findClosestDPForEnemy(Enemy en) {
   DataPoint closestDataPoint = null;
   int closestDistanceFromDP = 0;
   for (DataPoint dp : dataPointList) {
     int dist =
         computeDistance(
             getNextXForEnemy(en, dp), getNextYForEnemy(en, dp), dp.getCoordX(), dp.getCoordY());
     if (closestDistanceFromDP == 0) {
       closestDistanceFromDP = dist;
       closestDataPoint = dp;
     } else {
       if (dist < closestDistanceFromDP) {
         closestDistanceFromDP = dist;
         closestDataPoint = dp;
       }
     }
   }
   return closestDataPoint;
 }
  @Test
  public void triangulate2() throws OutOfRangeException {
    DataPoint a = new DataPoint(43.074553, -75.759592, 62.583);
    DataPoint b = new DataPoint(43.134420, -75.228998, 302.2);
    Coordinate intersection = DataPoint.triangulate(a, b);

    double expectedLat = 43.211699;
    double expectedLon = -75.397193;
    double calculatedLat = intersection.getLatitude();
    double calculatedLon = intersection.getLongitude();

    double faultLat = Math.abs(expectedLat - calculatedLat);
    double faultLon = Math.abs(expectedLon - calculatedLon);

    assertTrue(faultLat < TRIANGULATE_TOLERANCE && faultLon < TRIANGULATE_TOLERANCE);
  }
  @Test
  public void triangulate1() throws OutOfRangeException {
    DataPoint a = new DataPoint(51, 0.25, 108);
    DataPoint b = new DataPoint(49, 2.5, 32);
    Coordinate intersection = DataPoint.triangulate(a, b);

    double expectedLat = 50.23;
    double expectedLon = 3.7075;
    double calculatedLat = intersection.getLatitude();
    double calculatedLon = intersection.getLongitude();

    double faultLat = Math.abs(expectedLat - calculatedLat);
    double faultLon = Math.abs(expectedLon - calculatedLon);

    assertTrue(faultLat < TRIANGULATE_TOLERANCE && faultLon < TRIANGULATE_TOLERANCE);
  }
Example #23
0
    /**
     * Deletes the record with the specified primary keys. The point of this api is to prevent a hit
     * on the db to see if the record is there. This call will add a record to the next transaction
     * that is marked for delete.
     *
     * @return Returns true if the record was previous created and existed either in the transaction
     *     cache or the db.
     */
    public boolean delete(int id) {
      boolean ret = false;
      DataPoint rec = new DataPoint();

      ((DataPoint_base) rec).initialize(id);
      GenOrmConnection con = GenOrmDataSource.getGenOrmConnection();
      DataPoint cachedRec = (DataPoint) con.getCachedRecord(rec.getRecordKey());

      if (cachedRec != null) {
        ret = true;
        cachedRec.delete();
      } else {
        rec = (DataPoint) con.getUniqueRecord(rec); // This adds the record to the cache
        rec.delete();
        ret = rec.flush();
        rec.setIgnored(true); // So the system does not try to delete it again at commmit
      }

      return (ret);
    }
Example #24
0
  // methods
  public Detector calibrateParameters(Detector d) {

    if (d.getHealthStatus() != 100) { // assign NaN if detector is bad
      vf = Double.NaN;
      w = Double.NaN;
      q_max = Double.NaN;
    } else {
      // organize into an array of DataPoint
      ArrayList<DataPoint> datavec = new ArrayList<DataPoint>();
      int i;
      for (i = 0; i < d.getDensityData().size(); i++)
        datavec.add(
            new DataPoint(
                d.getDensityData().get(i), d.getFlowData().get(i), d.getSpeedData().get(i)));

      // maximum flow and its corresponding density
      DataPoint maxflw = new DataPoint(0, Double.NEGATIVE_INFINITY, 0);
      for (i = 0; i < d.getFlowData().size(); i++)
        if (datavec.get(i).flw > maxflw.flw) maxflw.setval(datavec.get(i));

      q_max = maxflw.flw;

      // split data into congested and freeflow regimes ...............
      ArrayList<DataPoint> congestion = new ArrayList<DataPoint>(); // congestion states
      ArrayList<DataPoint> freeflow = new ArrayList<DataPoint>(); // freeflow states
      for (i = 0; i < d.getDensityData().size(); i++)
        if (datavec.get(i).dty >= maxflw.dty) congestion.add(datavec.get(i));
        else freeflow.add(datavec.get(i));

      // vf is the average freeflow speed
      vf = percentile("spd", freeflow, 0.5f);

      // compute critical density
      rho_crit = q_max / vf;

      // BINNING
      ArrayList<DataPoint> supercritical = new ArrayList<DataPoint>(); // data points above rho_crit
      for (i = 0; i < d.getDensityData().size(); i++)
        if (datavec.get(i).dty >= rho_crit) supercritical.add(datavec.get(i));

      // sort supercritical w.r.t. density
      Collections.sort(supercritical);

      int numsupercritical = supercritical.size();
      int Bin_width = 10;
      int step = Bin_width;
      ArrayList<DataPoint> BinData = new ArrayList<DataPoint>();
      for (i = 0; i < numsupercritical; i += Bin_width) {

        if (i + Bin_width >= numsupercritical) step = numsupercritical - i;

        if (step != 0) {
          List<DataPoint> Bin = (List<DataPoint>) supercritical.subList(i, i + step);
          if (!Bin.isEmpty()) {
            double a = 2.5f * percentile("flw", Bin, 0.75f) - 1.5f * percentile("flw", Bin, 0.25f);
            double b = percentile("flw", Bin, 1f);
            BinData.add(new DataPoint(percentile("dty", Bin, 0.5f), Math.min(a, b), Float.NaN));
          }
        }
      }

      // Do constrained LS
      ArrayList<Double> ai = new ArrayList<Double>();
      ArrayList<Double> bi = new ArrayList<Double>();
      for (i = 0; i < BinData.size(); i++) {
        bi.add(q_max - BinData.get(i).flw);
        ai.add(BinData.get(i).dty - rho_crit);
      }

      if (BinData.size() > 0) {
        float sumaibi = 0;
        float sumaiai = 0;
        for (i = 0; i < BinData.size(); i++) {
          sumaibi += ai.get(i) * bi.get(i);
          sumaiai += ai.get(i) * ai.get(i);
        }
        w = (double) (sumaibi / sumaiai);
        w = Math.max(w, w_min);
        w = Math.min(w, w_max);
      } else {
        w = Double.NaN;
      }
    }
    // store parameters in sensor
    d.setFdParams(new FDParameters()); // assigns nominal
    d.getFdParams().setFD(vf, w, q_max); // assigns calculated values, keeps nominals if NaN
    return d;
  }
Example #25
0
 @Override
 public void cluster(ArrayList<? extends DataPoint> dataPoints) {
   {
     // Initalize the clusters.
     for (DataPoint dp : dataPoints) {
       dp.setClusterId(-1);
     }
   }
   {
     // Main process
     ArrayList<DataPoint> plane = new ArrayList(dataPoints.size());
     ArrayList<DataPoint> neighbors = new ArrayList(16);
     ArrayList<Integer> nearbyClusters = new ArrayList(4);
     float e2 = epsilon * epsilon;
     double d;
     int lastClusterUsed = 0;
     int id;
     main:
     for (DataPoint dp : dataPoints) {
       // Check for neighbors.
       neighbors.clear();
       for (DataPoint other : plane) {
         d = distance(dp, other);
         if (d <= e2) {
           neighbors.add(other);
         }
       }
       if (neighbors.isEmpty()) {
         // New Cluster
         dp.setClusterId(lastClusterUsed++);
       } else {
         // Add to cluster.
         nearbyClusters.clear();
         for (DataPoint n : neighbors) {
           nearbyClusters.add(n.getClusterId());
         }
         if (nearbyClusters.size() == 1) {
           // Only near 1 cluster.
           dp.setClusterId(nearbyClusters.get(0));
         } else {
           // Combine multiple clusters.
           id = nearbyClusters.remove(0);
           dp.setClusterId(id);
           for (DataPoint other : plane) {
             if (nearbyClusters.contains(other.getClusterId())) {
               other.setClusterId(id);
             }
           }
         }
       }
       plane.add(dp);
     }
   }
   {
     // Condense the cluster ids.
     ArrayList<Integer> clusterIdsUsed = new ArrayList(16);
     int id;
     for (DataPoint dp : dataPoints) {
       id = dp.getClusterId();
       if (!clusterIdsUsed.contains(id)) {
         clusterIdsUsed.add(id);
       }
     }
     for (DataPoint dp : dataPoints) {
       dp.setClusterId(clusterIdsUsed.indexOf(dp.getClusterId()));
     }
   }
 }
Example #26
0
 private int getLeftTurnNumberBeforeEnemyReachData(Enemy en, DataPoint dp) {
   int dist =
       computeDistance(
           getNextXForEnemy(en, dp), getNextYForEnemy(en, dp), dp.getCoordX(), dp.getCoordY());
   return Math.round(dist / ENEMY_DIST_BY_TURN);
 }
  /**
   * Output the finalized report
   *
   * @param result an integer that doesn't get used for anything
   */
  public void onTraversalDone(Integer result) {
    logger.info("Finalizing variant report");

    for (StateKey stateKey : evaluationContexts.keySet()) {
      NewEvaluationContext nec = evaluationContexts.get(stateKey);

      for (VariantEvaluator ve : nec.getEvaluationClassList().values()) {
        ve.finalizeEvaluation();

        AnalysisModuleScanner scanner = new AnalysisModuleScanner(ve);
        Map<Field, DataPoint> datamap = scanner.getData();

        for (Field field : datamap.keySet()) {
          try {
            field.setAccessible(true);

            if (field.get(ve) instanceof TableType) {
              TableType t = (TableType) field.get(ve);

              String subTableName = ve.getClass().getSimpleName() + "." + field.getName();
              final DataPoint dataPointAnn = datamap.get(field);

              GATKReportTable table;
              if (!report.hasTable(subTableName)) {
                report.addTable(subTableName, dataPointAnn.description());
                table = report.getTable(subTableName);

                table.addPrimaryKey("entry", false);
                table.addColumn(subTableName, subTableName);

                for (VariantStratifier vs : stratificationObjects) {
                  table.addColumn(vs.getName(), "unknown");
                }

                table.addColumn("row", "unknown");

                for (Object o : t.getColumnKeys()) {
                  String c;

                  if (o instanceof String) {
                    c = (String) o;
                  } else {
                    c = o.toString();
                  }

                  table.addColumn(c, 0.0);
                }
              } else {
                table = report.getTable(subTableName);
              }

              for (int row = 0; row < t.getRowKeys().length; row++) {
                String r = (String) t.getRowKeys()[row];

                for (VariantStratifier vs : stratificationObjects) {
                  final String columnName = vs.getName();
                  table.set(stateKey.toString() + r, columnName, stateKey.get(columnName));
                }

                for (int col = 0; col < t.getColumnKeys().length; col++) {
                  String c;
                  if (t.getColumnKeys()[col] instanceof String) {
                    c = (String) t.getColumnKeys()[col];
                  } else {
                    c = t.getColumnKeys()[col].toString();
                  }

                  String newStateKey = stateKey.toString() + r;
                  table.set(newStateKey, c, t.getCell(row, col));

                  table.set(newStateKey, "row", r);
                }
              }
            } else {
              GATKReportTable table = report.getTable(ve.getClass().getSimpleName());

              for (VariantStratifier vs : stratificationObjects) {
                String columnName = vs.getName();

                table.set(stateKey.toString(), columnName, stateKey.get(vs.getName()));
              }

              table.set(stateKey.toString(), field.getName(), field.get(ve));
            }
          } catch (IllegalAccessException e) {
            throw new StingException("IllegalAccessException: " + e);
          }
        }
      }
    }

    report.print(out);
  }
Example #28
0
 public boolean contains(final DataPoint<T> dataPoint) {
   final DataPoint<T> inSpaceDataPoint = this.get(dataPoint.getCoordinates());
   return inSpaceDataPoint.getData().compareTo(dataPoint.getData()) == 0;
 }
Example #29
0
    /** Creates a new entry that is empty */
    public DataPoint createRecord() {
      DataPoint rec = new DataPoint();
      rec.m_isNewRecord = true;

      return ((DataPoint) GenOrmDataSource.getGenOrmConnection().getUniqueRecord(rec));
    }
Example #30
0
  public static void main(String[] args) {
    String one = "", two = "";
    try {
      one = args[0];
      two = args[1];
    } catch (ArrayIndexOutOfBoundsException e) {
      // System.out.println("Kaput, tik viena siusti!.");
    }
    if (one.equals("sulaikais")) {
      fullOuput = true;
    }
    if (two.equals("tikfound")) {
      onlyFound = true;
    }
    Vector<DataPoint> data = new Vector<DataPoint>();
    // Read stuff
    FileReader fr;
    try {
      // loads file with channel names
      Renamer channelNames = new Renamer();
      // load file with packets and codes
      LabelCounters labelCounter = new LabelCounters();

      // fr = new FileReader(args[0]);
      fr = new FileReader("cs_syslog");

      BufferedReader br = new BufferedReader(fr);
      String s;
      // looping through log file

      int debug = 0;
      boolean firstEntry = false;

      while ((s = br.readLine()) != null) {
        debug++;
        if (debug > 100) {
          // System.exit(1);
        }
        if (!firstEntry && s.split(" +").length >= 12) {
          firstEntry = true;
        } else if (s.split(" +").length >= 12 && s.contains("ms")) {
          // Crash check
          /*
          System.out.println(s);
          if(s.split(" +").length < 6 || s.split(" +")[5].split("/").length < 3){
          	System.out.println(s);
          	System.out.println(s.split(" +")[5]);
          	System.out.println(s.split(" +")[5].split("/").length );
          	System.out.println("Klaida");
          	System.exit(1);
          }
          */
          boolean cardRequest = false;
          String entry = "None";
          int timeEntry = -1;
          if ((s.contains("found") && !s.contains("not found"))) {
            // System.out.println(s);
            // System.out.println(s.split(" +")[7]);
            timeEntry = Integer.valueOf(s.split(" +")[7].replaceAll("\\(", "").trim());
            entry = s.split(" +")[5].replaceAll("\\(", "").replaceAll("\\):", "").trim();
            entry = entry.split("/")[1];
            cardRequest = true;
          }
          if (!onlyFound) {
            if (s.contains("cache")) {
              // System.out.println(s);
              // System.out.println(s.split(" +")[7]);
              timeEntry = Integer.valueOf(s.split(" +")[7].replaceAll("\\(", "").trim());
              entry = s.split(" +")[5].replaceAll("\\(", "").replaceAll("\\):", "").trim();
              entry = entry.split("/")[1];
              cardRequest = true;
              // System.out.println(s);
            }
          }
          // else{
          //	System.out.println(s);
          // }

          /*
           * System.out.println(Math.ceil(501/500));
          System.exit(1);
          */
          if (cardRequest) {
            boolean check = false;
            for (int i = 0; i < data.size(); i++) {
              if (data.elementAt(i).data.equals(entry)) {
                check = true;
                data.elementAt(i).count++;
                if (timeEntry > 0) {
                  int index = (int) Math.ceil(timeEntry / 500);
                  if (index > 10) {
                    index = 10;
                  }
                  data.elementAt(i).timeIntervals[index]++;
                }
                // Increase delay point
                break;
              }
            }
            if (!check) {
              DataPoint t = new DataPoint(entry);
              // Increase delay point
              if (timeEntry > 0) {
                int index = (int) Math.ceil(timeEntry / 500);
                if (index > 10) {
                  index = 10;
                }
                t.timeIntervals[index]++;
              }
              data.addElement(t);
            }
          }
        }
      }
      fr.close();
      // sorting log entries
      for (int z = 0; z < data.size() - 1; z++) {
        for (int x = z + 1; x < data.size(); x++) {
          if (data.elementAt(z).count < data.elementAt(x).count) {
            DataPoint newbase = data.elementAt(z);
            data.setElementAt(data.elementAt(x), z);
            data.setElementAt(newbase, x);
          }
        }
      }
      // sort to packets
      for (LabelPoint pause : labelCounter.list) {
        for (DataPoint labelEntry : pause.list) {
          for (DataPoint stop : data) {
            if (labelEntry.data.equals(stop.data)) {

              labelEntry.count += stop.count;
              pause.counter += stop.count;
              // Copy lag data
              for (int i = 0; i < 11; i++) {
                pause.timeIntervals[i] += stop.timeIntervals[i];
              }
            }
          }
        }
      }

      // sort data
      for (LabelPoint pause : labelCounter.list) {
        for (int a = 0; a < pause.list.size() - 1; a++) {
          for (int b = a; b < pause.list.size(); b++) {
            if (pause.list.elementAt(a).count < pause.list.elementAt(b).count) {
              DataPoint newbase = pause.list.elementAt(a);
              pause.list.setElementAt(pause.list.elementAt(b), a);
              pause.list.setElementAt(newbase, b);
            }
          }
        }
      }
      // produce log output file
      FileWriter writer = null;
      if (onlyFound) {
        writer = new FileWriter("SIDstatistics_" + one + "_tik_found.rtf");
      } else {
        writer = new FileWriter("SIDstatistics_" + one + "_found_ir_cache.rtf");
      }

      for (LabelPoint pause : labelCounter.list) {
        System.out.println("---------" + pause.name + " total:" + pause.counter + "-----------");
        writer.append("---------" + pause.name + " total:" + pause.counter + "-----------");
        writer.append('\n');
        for (DataPoint labelEntry : pause.list) {
          for (RenamerLabel name : channelNames.list) {
            if (name.code.equals(labelEntry.data)) {
              labelEntry.nameFound = true;
              System.out.println(labelEntry.count + "\t" + name.code + "\t" + name.name);
              writer.append(labelEntry.count + "\t" + name.code + "\t" + name.name);
              writer.append('\n');
            }
          }
        }
        for (DataPoint labelEntry : pause.list) {
          if (!labelEntry.nameFound) {
            System.out.println(labelEntry.count + "\t" + labelEntry.data + "\t\t");
            writer.append(labelEntry.count + "\t" + labelEntry.data + "\t\t");
            writer.append('\n');
          }
        }
        writer.append('\n');
      }
      if (fullOuput) {
        // Put delays intevals
        writer.append(
            "------------------------------------------------------------------------------------------");
        writer.append(
            "------------------------------------------Delays------------------------------------------");
        writer.append(
            "------------------------------------------------------------------------------------------");
        for (LabelPoint pause : labelCounter.list) {
          System.out.println("---------" + pause.name + "-----------");
          writer.append("---------" + pause.name + "-----------");
          writer.append('\n');
          for (int i = 0; i < 11; i++) {
            System.out.println(
                "\t" + i * 500 + "\t" + (i + 1) * 500 + "\t" + pause.timeIntervals[i]);
            writer.append("\t" + i * 500 + "\t" + (i + 1) * 500 + "\t" + pause.timeIntervals[i]);
            writer.append('\n');
          }
          writer.append('\n');
        }
      }
      writer.close();
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }