/** 从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); }
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; } }
/** * 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); }
public void resumeTime() { thread.pause = false; }
public void pauseTime() { thread.pause = true; }
public void stopTime() { thread.running = false; }
public void startTime() { if (thread != null && thread.running) stopTime(); thread = new TimeThread(); thread.start(); }