// Decompiled by DJ v3.11.11.95 Copyright 2009 Atanas Neshkov Date: 26/10/2010 14:06:00
// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
package jcircus.classesdescompiladas;
// Referenced classes of package org.jcsp.lang:
// Guard, ProcessInterruptedException, Spurious, Alternative
public class CSTimer extends Guard
{
public CSTimer()
{
msecs = 0L;
}
public void setAlarm(long l)
{
msecs = l;
}
public long getAlarm()
{
return msecs;
}
/**
* @deprecated Method set is deprecated
*/
public void set(long l)
{
msecs = l;
}
public long read()
{
return System.currentTimeMillis();
}
public void after(long l)
{
long l1 = l - System.currentTimeMillis();
if(l1 > 0L)
try
{
Thread.sleep(l1);
}
catch(InterruptedException interruptedexception)
{
throw new ProcessInterruptedException("*** Thrown from CSTimer.after (long)\n" + interruptedexception.toString());
}
}
public void sleep(long l)
{
if(l > 0L)
try
{
Thread.sleep(l);
}
catch(InterruptedException interruptedexception)
{
throw new ProcessInterruptedException("*** Thrown from CSTimer.sleep (long)\n" + interruptedexception.toString());
}
}
boolean enable(Alternative alternative)
{
if(msecs - System.currentTimeMillis() <= Spurious.earlyTimeout)
{
return true;
} else
{
alternative.setTimeout(msecs);
return false;
}
}
boolean disable()
{
return msecs - System.currentTimeMillis() <= Spurious.earlyTimeout;
}
private long msecs;
}