dk.deepthought.sidious.greenhouse
Class Greenhouse

java.lang.Object
  extended by dk.deepthought.sidious.greenhouse.Greenhouse
All Implemented Interfaces:
PlanRequester, java.lang.Runnable

public class Greenhouse
extends java.lang.Object
implements PlanRequester, java.lang.Runnable

This class represents a greenhouse and its properties.

Author:
Deepthought

Field Summary
private  java.util.Collection<Adjustable> adjustables
          Collection of adjustables
private  Plan currentPlan
           
private  boolean finished
           
private  SuperLinkID id
          The id of this greenhouse.
private  boolean interrupted
          Boolean that holds interrupt status.
private static org.apache.commons.logging.Log logger
           
private  java.util.Collection<Rule> rules
          Collection of rules
 
Constructor Summary
Greenhouse(SuperLinkID id, java.util.Collection<Adjustable> adjustables, java.util.Collection<Rule> rules)
          Constructs a new instance of Greenhouse with the specified id, adjustables, and rules.
 
Method Summary
 java.util.Collection<Adjustable> getAdjustables()
          Returns the adjustables associated with this plan requester.
 Plan getCurrentPlan()
          Gets the current plan for this greenhouse.
 SuperLinkID getID()
          Returns the id of this plan requester.
 java.util.Collection<Rule> getRules()
          Returns the rules associated with this plan requester.
 State getState()
          Returns the current state of the system from the point of view of this plan requester.
 void interrupt()
          Method interrupts the thread.
private  boolean interrupted()
          Returns true if this thread has been interrupted, false otherwise.
 boolean isFinished()
           
 void run()
          Main loop of the Greenhouse.
 void setPlan(Plan plan)
          Sets the plan on this requester.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final org.apache.commons.logging.Log logger

id

private final SuperLinkID id
The id of this greenhouse.


interrupted

private volatile boolean interrupted
Boolean that holds interrupt status.


adjustables

private final java.util.Collection<Adjustable> adjustables
Collection of adjustables


rules

private final java.util.Collection<Rule> rules
Collection of rules


finished

private boolean finished

currentPlan

private Plan currentPlan
Constructor Detail

Greenhouse

public Greenhouse(SuperLinkID id,
                  java.util.Collection<Adjustable> adjustables,
                  java.util.Collection<Rule> rules)
Constructs a new instance of Greenhouse with the specified id, adjustables, and rules.

Parameters:
id - the id of the greenhouse
adjustables - the adjustables associated with the greenhouse
rules - the rules associated with the greenhouse
Method Detail

getAdjustables

public java.util.Collection<Adjustable> getAdjustables()
Description copied from interface: PlanRequester
Returns the adjustables associated with this plan requester.

Specified by:
getAdjustables in interface PlanRequester
Returns:
all adjustables associated with this

getRules

public java.util.Collection<Rule> getRules()
Description copied from interface: PlanRequester
Returns the rules associated with this plan requester.

Specified by:
getRules in interface PlanRequester
Returns:
all rules associated with this

getState

public State getState()
Description copied from interface: PlanRequester
Returns the current state of the system from the point of view of this plan requester.

Specified by:
getState in interface PlanRequester
Returns:
current state

run

public void run()
Main loop of the Greenhouse. Controls the frequency of which a new plan is requested from the Blackboard.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

interrupted

private boolean interrupted()
Returns true if this thread has been interrupted, false otherwise.

Returns:
true if interrupted

interrupt

public void interrupt()
Method interrupts the thread.


getID

public SuperLinkID getID()
Description copied from interface: PlanRequester
Returns the id of this plan requester.

Specified by:
getID in interface PlanRequester
Returns:
the id

setPlan

public void setPlan(Plan plan)
Description copied from interface: PlanRequester
Sets the plan on this requester.

Specified by:
setPlan in interface PlanRequester
Parameters:
plan - the plan

getCurrentPlan

public Plan getCurrentPlan()
Gets the current plan for this greenhouse.

Returns:
the current plan of this

isFinished

public boolean isFinished()
Returns:
true if a plan has been delivered

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © Deepthought Development - All Rights Reserved.