blob: b690958968acd14c7dce032583b2efa73562148b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package JACE.Concurrency;
import JACE.ASX.TimedWait;
class RenewObject extends TimedWait
{
public RenewObject (int maxYieldTo)
{
yieldTo_ = maxYieldTo;
}
public boolean condition ()
{
return yieldTo_ <= 0;
}
public void decrementYieldTo()
{
this.yieldTo_--;
}
public int yieldTo ()
{
return this.yieldTo_;
}
public RenewObject min (RenewObject other)
{
if (other.yieldTo_ < this.yieldTo_)
return other;
else
return this;
}
private int yieldTo_;
}
|