nl.tudelft.simulation.dsol.formalisms
Class Resource

java.lang.Object
  extended bynl.tudelft.simulation.event.EventProducer
      extended bynl.tudelft.simulation.dsol.formalisms.Resource
All Implemented Interfaces:
nl.tudelft.simulation.event.EventProducerInterface, java.io.Serializable

public class Resource
extends nl.tudelft.simulation.event.EventProducer

A resource defines a shared and limited amount.

(c) copyright 2003 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: General Public License (GPL) , no warranty

Since:
1.0
Version:
1.2 2004-03-26
Author:
Peter Jacobs
See Also:
Serialized Form

Nested Class Summary
 class Resource.Request
          A Request.
 
Field Summary
protected  double capacity
          capacity defines the maximuum capacity of the resource
protected  double claimedCapacity
          claimedCapacity defines the currently claimed capacity
protected  java.lang.String description
          the description of the resource
static nl.tudelft.simulation.event.EventType RESOURCE_REQUESTED_QUEUE_LENGTH
          RESOURCE_REQUESTED_QUEUE_LENGTH fired on changes in queue length
protected  DEVSSimulatorInterface simulator
          simulator defines the simulator on which is scheduled
static nl.tudelft.simulation.event.EventType UTILIZATION_EVENT
          UTILIZATION_EVENT is fired on activity
 
Fields inherited from class nl.tudelft.simulation.event.EventProducer
listeners
 
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
 
Constructor Summary
Resource(DEVSSimulatorInterface simulator, double capacity)
          Method Resource.
Resource(DEVSSimulatorInterface simulator, java.lang.String description, double capacity)
          Method Resource.
 
Method Summary
 double getCapacity()
          returns the capacity of the resource
 void releaseCapacity(double amount)
          releases an amount of capacity from the resource.
 void requestCapacity(double amount, ResourceRequestorInterface requestor)
          requests an amount of capacity from the resource \
 void setCapacity(double capacity)
          sets the capacity of the resource
 java.lang.String toString()
           
 
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getEventTypes, removeAllListeners, removeAllListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UTILIZATION_EVENT

public static final nl.tudelft.simulation.event.EventType UTILIZATION_EVENT
UTILIZATION_EVENT is fired on activity


RESOURCE_REQUESTED_QUEUE_LENGTH

public static final nl.tudelft.simulation.event.EventType RESOURCE_REQUESTED_QUEUE_LENGTH
RESOURCE_REQUESTED_QUEUE_LENGTH fired on changes in queue length


capacity

protected double capacity
capacity defines the maximuum capacity of the resource


claimedCapacity

protected double claimedCapacity
claimedCapacity defines the currently claimed capacity


simulator

protected DEVSSimulatorInterface simulator
simulator defines the simulator on which is scheduled


description

protected java.lang.String description
the description of the resource

Constructor Detail

Resource

public Resource(DEVSSimulatorInterface simulator,
                java.lang.String description,
                double capacity)
Method Resource.

Parameters:
simulator - on which is scheduled
description - the description of this resource
capacity - of the resource

Resource

public Resource(DEVSSimulatorInterface simulator,
                double capacity)
Method Resource.

Parameters:
simulator - on which is scheduled
capacity - of the resource
Method Detail

getCapacity

public double getCapacity()
returns the capacity of the resource

Returns:
capacity

setCapacity

public void setCapacity(double capacity)
sets the capacity of the resource

Parameters:
capacity - the new maximal capacity

requestCapacity

public void requestCapacity(double amount,
                            ResourceRequestorInterface requestor)
                     throws java.rmi.RemoteException,
                            SimRuntimeException
requests an amount of capacity from the resource \

Parameters:
amount - the requested amount
requestor - the RequestorInterface requesting the amount
Throws:
java.rmi.RemoteException - on network failure
SimRuntimeException - on other failures

releaseCapacity

public void releaseCapacity(double amount)
                     throws java.rmi.RemoteException
releases an amount of capacity from the resource.

Parameters:
amount - the amount to release
Throws:
java.rmi.RemoteException - on network failure

toString

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


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