Beispiel #1
0
  /** 从plt中读取数据,并写入到mysql数据库中 */
  private static void loadData() {
    // TODO Auto-generated method stub

    MyDataBase dataBase = new MyDataBase();
    String path = MyConstant.filePath + "Data";
    gps.getFiles(path);
    gps.fileCount();
    ArrayList<FileAtrribute> filelist = gps.getFilelist();

    TimeThread myThread = new TimeThread();
    myThread.start();

    myThread.setTotalNum(filelist.size());
    for (int i = 0; i < filelist.size(); i++) {
      FileAtrribute file = filelist.get(i);
      List<GPSpoint> gPSpoints = gps.readTextFile(file.getFilePath(), file.getFileNum());
      if (gPSpoints.size() == 0) {
        continue;
      } else {
        dataBase.insertGPSdata(gPSpoints);
      }
      myThread.setI(i);
    }
    // 关掉线程
    myThread.setFlag(true);
  }
Beispiel #2
0
 private void add(QueueItem item) {
   ticker.startTick();
   if (head == null) {
     head = tail = item;
     item.prev = null;
     item.next = null;
     item.time = interval;
     tailtime = interval;
   } else {
     tail.next = item;
     item.prev = tail;
     item.next = null;
     item.time = interval - tailtime;
     tailtime = interval;
     tail = item;
   }
 }
Beispiel #3
0
 /**
  * Creates an instance of TimeLimited.
  *
  * @param interval the number of ticks an object lives before it will be disposed.
  */
 public TimeLimited(int interval) {
   map = new Hashtable();
   this.interval = interval + 1;
   ticker.addListener(this);
 }
Beispiel #4
0
 public void resumeTime() {
   thread.pause = false;
 }
Beispiel #5
0
 public void pauseTime() {
   thread.pause = true;
 }
Beispiel #6
0
 public void stopTime() {
   thread.running = false;
 }
Beispiel #7
0
  public void startTime() {
    if (thread != null && thread.running) stopTime();

    thread = new TimeThread();
    thread.start();
  }