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

public class Shelf extends PermanentUnit{

    PermanentUnit out;
    protected String value = "Rudi";
    public static Attribute[] attribute = {//Test ;-)
        new Attribute( "Value","value","advanced", String.class, new String[]{ "Martin" ,"Rudi", "Markus" } )
    };

    /*
    * Verwaltet eine Reihe von Regalpl&auml;tzen
    */
    public Shelf( ){
        super( );
    }

    public boolean ask( ){
        if( state == FAILURE ) return false;
        if( recorder.getInside( ) >= childs.size( ) ) return false;
        return true;
    }

    /**
    * Platzzuweisung
    *
    */
    public PermanentUnit whereToGo( PermanentUnit pu ){
        javax.vecmath.Vector3d p = pu.getPosition( );
        for( java.util.Iterator it = childs.iterator( ); it.hasNext( ); ){
            PermanentUnit shelfplace = (PermanentUnit)it.next( );
            if( ! shelfplace.getOccupied( ) ){
                System.out.println( "-------->Zuweisung: " + shelfplace );
                return shelfplace;
            }
        }
        return null;
    }
    
    public void setValue( String v ){
    	value = v;
    }
    
    public String getValue( ){
    	return value;
    }
    
	//Static Methods
	public static String description( ){
		return "The Shelf... " +
			   "<br><br>" +
			   "See also: " + SfxHtmlPanel.addDocHyperlink( Shelf.class );
	}
}