opntimer.java

来自「EOmodeler 读取数据库的方法」· Java 代码 · 共 54 行

JAVA
54
字号
package edu.thu.airlinerecovery.eof;

import java.util.Timer;
import java.util.TimerTask;


public class OPNTimer {
	    static Timer timer = new Timer(true); 
	    static Timer timerN = new Timer(true);
	    public int timePointer=0;
	    public int timePointerN = 0;
	    public int getTime(){
//	    	if(timePointer>509){    		
//	    		System.out.println(timePointerN);
	    		return timePointerN;
//	    	}
//	    	else{	    		
//	    		System.out.println(timePointer);
//	    		return timePointer;
//	    	}
	    	
//	    	return timePointer;	    	
	    }
	    
	    public void startTiming(){  
//	        timer.schedule(new TimeTask() , 0 , 10);
    		timerN.schedule(new TimeTaskN() , 0 , 10);
	    }	    
	   
	    public void stopTiming(){  
	    	timer.cancel();
	    }	  

        class TimeTask extends TimerTask{
	        public TimeTask(){   
	        }   

	        public void run(){
	    	timePointer =timePointer +2;
	        }
	
         }
        class TimeTaskN extends TimerTask{
	        public TimeTaskN(){   
	        }   

	        public void run(){
	    	timePointerN =timePointerN +2;
	        }
	
         }
        
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?