AltingBarrierCoordinate.java 2.37 KB
  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
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
// Decompiled by DJ v3.11.11.95 Copyright 2009 Atanas Neshkov Date: 26/10/2010 13:58:39
// 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:
// ProcessInterruptedException, JCSP_InternalError

class AltingBarrierCoordinate
{

AltingBarrierCoordinate()
{
}

static void startEnable()
{
synchronized(activeLock)
{
if(active > 0)
try
{
activeLock.wait();
while(active > 0)
activeLock.wait();
}
catch(InterruptedException interruptedexception)
{
throw new ProcessInterruptedException(interruptedexception.toString());
}
if(active != 0)
throw new JCSP_InternalError("\n*** AltingBarrier enable sequence starting with 'active' count not equal to zero: " + active);
active = 1;
}
}

static void finishEnable()
{
synchronized(activeLock)
{
if(active != 1)
throw new JCSP_InternalError("\n*** AltingBarrier enable sequence finished with 'active' count not equal to one: " + active);
active = 0;
activeLock.notify();
}
}

static void startDisable(int i)
{
if(i <= 0)
throw new JCSP_InternalError("\n*** attempt to start " + i + " disable sequences!");
synchronized(activeLock)
{
if(active != 1)
throw new JCSP_InternalError("\n*** completed AltingBarrier found in ALT sequence with 'active' count not equal to one: " + active);
active = i;
}
}

static void finishDisable()
{
synchronized(activeLock)
{
if(active < 1)
throw new JCSP_InternalError("\n*** AltingBarrier disable sequence finished with 'active' count less than one: " + active);
active--;
if(active == 0)
activeLock.notify();
}
}

private static int active = 0;
private static Object activeLock = new Object();

}