
import de.simflex.gui.windows.SfxHtmlPanel;
import de.simflex.simulator.scheduler.Event;
import de.simflex.units.PermanentUnit;
import de.simflex.util.attribute.Attribute;

public class Protocol extends PermanentUnit{
	
	protected int intervall = 20;
	
    public static Attribute[] attribute = {
    	new Attribute( "Intervall","intervall","Advanced", int.class, Attribute.WRITABLE )
    };
	
	public Protocol( ){
		super( );
		scheduler.setRelativeEvent( new Event( 0 , this , WORK_BEGIN ) );
	}

	protected void work_begin( ){
		for( java.util.Enumeration en = model.getUnitsVector().elements( ); en.hasMoreElements( ); ){
			PermanentUnit t = (PermanentUnit)en.nextElement( );
			System.out.println( "Unit: " + t + " Recorder: " + t.getRecorder( ) );
		}
		scheduler.setRelativeEvent( new Event( intervall , this , WORK_BEGIN ) );
	}
	
	public void setIntervall( int v ){
		intervall = v;
	}
	
	public int getIntervall( ){
		return intervall;
	}
	
	//Static Methods
	public static String description( ){
		return " " +
			   "<br><br>" +
			   "See also: " + SfxHtmlPanel.addDocHyperlink( Protocol.class );
	}
}