jhomenet.commons.responsive.plan
Class DefaultPlan

java.lang.Object
  extended by jhomenet.commons.responsive.plan.DefaultPlan
All Implemented Interfaces:
Plan

public class DefaultPlan
extends java.lang.Object
implements Plan

The default implementation of the plan interface.

Id: $Id: $

Author:
Dave Irwin (jhomenet at gmail dot com)

Constructor Summary
DefaultPlan()
           
DefaultPlan(java.lang.String planName)
          Default constructor.
 
Method Summary
 void addListener(PlanListener listener)
          Add a listener.
 void addResponse(Response response, ResponseType responseType)
          Add a response to the plan.
 boolean equals(java.lang.Object obj)
           
 Expression getExpression()
           
 java.util.Set<Response> getOnFalseResponses()
          Get the current list of on-false responses.
 java.util.Set<Response> getOnTrueResponses()
          Get the current list of on-true responses.
 java.lang.String getPlanName()
          Get the plan name.
 java.util.List<Response> getResponses(ResponseType type)
           
 int hashCode()
           
 java.lang.Boolean isActive()
           
 void removeExpression()
          Remove the plan's expression.
 void removeListener(PlanListener listener)
          Remove a listener.
 void removeResponse(Response response)
          Try to remove a response from the plan.
 void responseUpdated(Response response)
          Call this method when a response has been updated.
 void setActive(java.lang.Boolean active)
          Set whether the plan is active or not.
 void setExpression(Expression expression)
           
 void setOnFalseResponses(java.util.Set<Response> onfalseResponseList)
          Set the list of no-false responses.
 void setOnTrueResponses(java.util.Set<Response> ontrueResponseList)
          Set the list of on-true responses.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultPlan

public DefaultPlan(java.lang.String planName)
Default constructor.

Parameters:
planName -

DefaultPlan

public DefaultPlan()
Method Detail

getPlanName

public final java.lang.String getPlanName()
Description copied from interface: Plan
Get the plan name.

Specified by:
getPlanName in interface Plan
Returns:
The plan name
See Also:
Plan.getPlanName()

setActive

public void setActive(java.lang.Boolean active)
Description copied from interface: Plan
Set whether the plan is active or not.

Specified by:
setActive in interface Plan
Parameters:
active - Whether the plan is active or not
See Also:
Plan.setActive(java.lang.Boolean)

isActive

public java.lang.Boolean isActive()
Returns:
Whether the plan is active or not

getExpression

public Expression getExpression()
Specified by:
getExpression in interface Plan
Returns:
See Also:
Plan.getExpression()

setExpression

public void setExpression(Expression expression)
Specified by:
setExpression in interface Plan
See Also:
Plan.setExpression(jhomenet.commons.responsive.condition.Expression)

removeExpression

public void removeExpression()
Remove the plan's expression.


addResponse

public void addResponse(Response response,
                        ResponseType responseType)
Add a response to the plan. If the response already exists in the plan, then this method will replace the existing response with the newer one.

Specified by:
addResponse in interface Plan
Parameters:
response - Response to add
responseType - Response type
See Also:
jhomenet.commons.responsive.plan.Plan#addResponse(jhomenet.commons.responsive.response.Response, jhomenet.commons.responsive.plan.Plan.ResponseType)

setOnTrueResponses

public void setOnTrueResponses(java.util.Set<Response> ontrueResponseList)
Set the list of on-true responses. This method will override the current list of on-true responses.

Parameters:
ontrueResponseList - List of on-true responses

setOnFalseResponses

public void setOnFalseResponses(java.util.Set<Response> onfalseResponseList)
Set the list of no-false responses. This method will override the current list of on-false responses.

Parameters:
onfalseResponseList -

getResponses

public java.util.List<Response> getResponses(ResponseType type)
                                      throws ResponsiveException
Specified by:
getResponses in interface Plan
Returns:
Throws:
ResponsiveException
See Also:
Plan.getResponses(jhomenet.commons.responsive.plan.ResponseType)

getOnTrueResponses

public final java.util.Set<Response> getOnTrueResponses()
Get the current list of on-true responses.

Returns:
The list of current on-true responses

getOnFalseResponses

public final java.util.Set<Response> getOnFalseResponses()
Get the current list of on-false responses.

Returns:
The list of current on-false responses

removeResponse

public void removeResponse(Response response)
Try to remove a response from the plan. This method attempts to remove the response both from the list of on-true and on-false response lists.

Specified by:
removeResponse in interface Plan
Parameters:
response - The response to remove from the plan
See Also:
Plan.removeResponse(jhomenet.commons.responsive.response.Response)

responseUpdated

public void responseUpdated(Response response)
Call this method when a response has been updated.

Parameters:
response - The response that has been updated

addListener

public void addListener(PlanListener listener)
Add a listener.

Parameters:
listener - A plan listener to add

removeListener

public void removeListener(PlanListener listener)
Remove a listener.

Parameters:
listener - Listener to remove

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

toString

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


Copyright © 2004-2007 David Irwin. All Rights Reserved.