FileDocCategorySizeDatePackage
TimerEvent.javaAPI DocAzureus 3.0.3.43115Mon Feb 26 09:01:14 GMT 2007org.gudy.azureus2.core3.util

TimerEvent

public class TimerEvent extends ThreadPoolTask implements Comparable
author
parg

Fields Summary
private String
name
private Timer
timer
private long
created
private long
when
private TimerEventPerformer
performer
private boolean
cancelled
private boolean
has_run
private long
unique_id
Constructors Summary
protected TimerEvent(Timer _timer, long _unique_id, long _created, long _when, TimerEventPerformer _performer)

	
	
	
							
							
							
							
				 
	
		timer		= _timer;
		unique_id	= _unique_id;
		when		= _when;
		performer	= _performer;
		
		created 	= _created;
	
Methods Summary
public synchronized voidcancel()

		cancelled	= true;
		
		timer.cancelEvent( this );
	
public intcompareTo(java.lang.Object other)

		long	res =  when - ((TimerEvent)other).getWhen();

		if ( res == 0 ){
			
			return((int)( unique_id - ((TimerEvent)other).getUniqueId()));
			
		}else{
			
			return res < 0 ? -1 : 1;
		}
	
public longgetCreatedTime()

		return( created );
	
public java.lang.StringgetName()

		return( name );
	
protected TimerEventPerformergetPerformer()

		return( performer );
	
protected AERunnablegetRunnable()

		return( this );
	
public java.lang.StringgetString()

		if ( performer instanceof TimerEventPeriodic ){

			TimerEventPeriodic	tep = (TimerEventPeriodic)performer;
			
			return( "when=" + getWhen() + ",run=" + hasRun() + ", can=" + isCancelled() + "/" + tep.isCancelled() + ",freq=" + tep.getFrequency() + ",target=" + tep.getPerformer()+ (name==null?"":",name=" + name ));

		}else{
			
			return( "when=" + getWhen() + ",run=" + hasRun() + ", can=" + isCancelled() + ",target=" + getPerformer() + (name==null?"":",name=" + name ));
		}
	
protected longgetUniqueId()

		return( unique_id );
	
public longgetWhen()

		return( when );
	
public booleanhasRun()

		return( has_run );
	
public voidinterruptTask()

	
public synchronized booleanisCancelled()

		return( cancelled );
	
public voidrunSupport()

		performer.perform( this );
	
protected voidsetHasRun()

		has_run	= true;
	
public voidsetName(java.lang.String _name)

		name	= _name;
	
protected voidsetWhen(long new_when)

		when	= new_when;