// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) fieldsfirst 
// Source File Name:   AndBox.java

package drm.signal.logic;

import drm.signal.*;
import java.util.Iterator;
import java.util.Vector;

// Referenced classes of package drm.signal.logic:
//			LogicValue

public class AndBox extends AbstractBox
{

	public AndBox()
	{
	}

	protected void update()
	{
		LogicValue rez = new LogicValue(2);
		Signal s;
		for(Iterator it = in.iterator(); it.hasNext() && rez.value != 1;)
		{
			s = ((Connector)it.next()).getSignal();
			int val = 3;
			if(s != null)
				val = ((LogicValue)s.getValue()).value;
			if(rez.value == 2)
				rez.value = val;
			else
			if(rez.value == 3 && val != 2)
				rez.value = val;
		}

		s = new SimpleSignal(rez);
		s.setStep(step + 1L);
		setOutSignal(s);
	}
}
