Skip to content

Environment Creation

Given the following snippet of code

public class 
TranscodeJobImpl 
	implements TranscodeJob, DownloadWillBeRemovedListener
{
	private long					started_on;
	private long					paused_on;
	private long					process_time;
public void
	resume()
	{
		synchronized( this ){
			if ( state == ST_PAUSED ){
				state = ST_RUNNING;
				if ( paused_on > 0 && started_on > 0 ){
					process_time -= SystemTime.getMonotonousTime() - paused_on;
				}
			}else{
				return;
			}
		}
		queue.jobChanged( this, false, true );
	}

public void
	pause()
	{
		synchronized( this ){
			if ( use_direct_input ){
				return;
			}
			if ( state == ST_RUNNING ){		
				state = ST_PAUSED;			
				paused_on = SystemTime.getMonotonousTime();			
			}else{				
				return;
			}
		}
		queue.jobChanged( this, false, true );
	}
}

The order of analysing of the method is strict atm. and therefore the following time constraint is not detected. In order to fix it I suggest to parse once the file in the Env building phase to detect all the class attribute that are time relevant. Then parse normally to detect the time constraint.