nl.tudelft.simulation.supplychain.handlers
Class SupplyChainHandler

java.lang.Object
  extended bynl.tudelft.simulation.content.Handler
      extended bynl.tudelft.simulation.supplychain.handlers.SupplyChainHandler
All Implemented Interfaces:
nl.tudelft.simulation.content.HandlerInterface, java.io.Serializable
Direct Known Subclasses:
BillHandler, InternalDemandHandler, OrderConfirmationHandler, OrderHandler, PaymentHandler, ProductionOrderHandler, QuoteHandler, RequestForQuoteHandler, ShipmentHandlerConsume, ShipmentHandlerStock, YellowPageAnswerHandler, YellowPageRequestHandler

public abstract class SupplyChainHandler
extends nl.tudelft.simulation.content.Handler

SupplyChainHandler is the SupplyChainActor specific abstract Handler class. It has a SupplyChainActor as owner, making it unnecessary to cast the Actor all the time to a SupplyChainActor.
The generic SupplyChainHandler already has the methods to check whether the content is of the right type, and methods to do basic filtering on product and on the partner with whom the owner is dealing. This makes it very easy to have different handlers for e.g. production orders and for purchase orders; it can be done on the basis of the message sender (in case of production orders the owner itself), or on the basis of the product type.

Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl . The source code and binary code of this software is proprietary information of Delft University of Technology.

Version:
$$Revision: 1.2 $$ $$Date: 2005/04/08 11:50:53 $$
Author:
Alexander Verbraeck
See Also:
Serialized Form

Field Summary
protected  SupplyChainActor owner
          the owner of the handler
protected  java.util.Set validPartners
          the partner actors for which this handler is valid
protected  java.util.Set validProducts
          the products for which this handler is valid
 
Fields inherited from class nl.tudelft.simulation.content.Handler
stream
 
Constructor Summary
SupplyChainHandler(SupplyChainActor owner)
           
 
Method Summary
 void addValidPartner(SupplyChainActor partner)
          Add a valid partner to the list of supply chain partners to handle with this handler.
 void addValidProduct(Product product)
          Add a valid product to the list of products to handle with this handler.
protected  Content checkContent(java.io.Serializable serContent)
          Method checkContent.
protected abstract  boolean checkContentClass(java.io.Serializable content)
          Check whether the content is of the right type for this handler
 java.util.Set getValidPartners()
           
 java.util.Set getValidProducts()
           
protected  boolean isValidContent(Content content)
          Check partner and content for validity for this handler.
 void setValidPartners(java.util.Set validPartners)
          Replace the current set of valid partners.
 void setValidProducts(java.util.Set validProducts)
          Replace the current set of valid products.
 
Methods inherited from class nl.tudelft.simulation.content.Handler
getStream, handleContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

protected SupplyChainActor owner
the owner of the handler


validProducts

protected java.util.Set validProducts
the products for which this handler is valid


validPartners

protected java.util.Set validPartners
the partner actors for which this handler is valid

Constructor Detail

SupplyChainHandler

public SupplyChainHandler(SupplyChainActor owner)
Parameters:
owner - the a that 'owns' the handler
Method Detail

checkContentClass

protected abstract boolean checkContentClass(java.io.Serializable content)
Check whether the content is of the right type for this handler

Parameters:
content - the content to check
Returns:
whether type is right or not

checkContent

protected Content checkContent(java.io.Serializable serContent)
Method checkContent.

Parameters:
serContent - the content to check
Returns:
returns a bill

addValidProduct

public void addValidProduct(Product product)
Add a valid product to the list of products to handle with this handler.

Parameters:
product - a new valid product to use

getValidProducts

public java.util.Set getValidProducts()
Returns:
Returns the valid products.

setValidProducts

public void setValidProducts(java.util.Set validProducts)
Replace the current set of valid products. If you want to ADD a set, use addValidProduct per product instead.

Parameters:
validProducts - A new set of valid products

addValidPartner

public void addValidPartner(SupplyChainActor partner)
Add a valid partner to the list of supply chain partners to handle with this handler.

Parameters:
partner - a new valid partner to use

getValidPartners

public java.util.Set getValidPartners()
Returns:
Returns the valid partners.

setValidPartners

public void setValidPartners(java.util.Set validPartners)
Replace the current set of valid partners. If you want to ADD a set, use addValidPartner per partner instead.

Parameters:
validPartners - A new set of valid partners.

isValidContent

protected boolean isValidContent(Content content)
Check partner and content for validity for this handler.

Parameters:
content - the content to check
Returns:
boolean indicating whether the content can be handled by this handler


Copyright © 2002-2005 Delft University of Technology, the Netherlands. All Rights Reserved.