// 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:   AbstractNeuroContainer.java

package drm.signal.neuro;

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

// Referenced classes of package drm.signal.neuro:
//			AbstractNeuroBox

public abstract class AbstractNeuroContainer extends AbstractBox
{

	protected Vector neurons;
	protected double weight[];

	public AbstractNeuroContainer()
	{
		neurons = new Vector();
		weight = new double[0];
	}

	public void setAllWeights(double weights[])
		throws ArrayIndexOutOfBoundsException
	{
		weight = (double[])weights.clone();
		Iterator it = neurons.iterator();
		int i = 0;
		while(it.hasNext()) 
		{
			Object box = it.next();
			if(box instanceof AbstractNeuroBox)
			{
				AbstractNeuroBox anb = (AbstractNeuroBox)box;
				int size = anb.weight.length;
				double wt[] = new double[size];
				System.arraycopy(weight, i, wt, 0, size);
				anb.setWeights(wt);
				i += size;
			}
		}
	}

	public double[] getAllWeights()
	{
		return (double[])weight.clone();
	}

	public void setStep(long step)
	{
		super.setStep(step);
		for(Iterator it = neurons.iterator(); it.hasNext(); ((AbstractBox)it.next()).setStep(step));
	}

	public void clearSignals()
	{
		for(Iterator it = neurons.iterator(); it.hasNext(); ((AbstractBox)it.next()).clearSignals());
	}
}
