|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.tudelft.simulation.event.EventProducer
nl.tudelft.simulation.dsol.formalisms.Resource
public class Resource
A resource defines a shared and limited amount.
(c) copyright 2002-2005 Delft
University of Technology , the Netherlands.
See for project information
www.simulation.tudelft.nl
License of use: Lesser
General Public License (LGPL) , no warranty.
Nested Class Summary | |
---|---|
static 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 static long |
counter
the counter counting the requests |
static int |
DEFAULT_REQUEST_PRIORITY
the default average priority |
protected String |
description
the description of the resource |
static int |
MAX_REQUEST_PRIORITY
the maximum priority |
static int |
MIN_REQUEST_PRIORITY
the minimum priority |
protected SortedSet |
requests
request defines the list of requestors for this resource |
static 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 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,
String description,
double capacity)
Method Resource. |
Method Summary | |
---|---|
double |
getAvailableCapacity()
returns the currently available capacity on this resource. |
double |
getCapacity()
returns the maximum, and thus original capacity of the resource. |
double |
getClaimedCapacity()
returns the amount of currently claimed capacity. |
int |
getQueueLength()
returns the number of instances currently waiting for this 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 |
requestCapacity(double amount,
ResourceRequestorInterface requestor,
int priority)
requests an amount of capacity from the resource \ |
void |
setCapacity(double capacity)
sets the capacity of the resource |
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 |
---|
protected static long counter
public static final EventType UTILIZATION_EVENT
public static final EventType RESOURCE_REQUESTED_QUEUE_LENGTH
public static final int MIN_REQUEST_PRIORITY
public static final int MAX_REQUEST_PRIORITY
public static final int DEFAULT_REQUEST_PRIORITY
protected double capacity
protected double claimedCapacity
protected SortedSet requests
protected DEVSSimulatorInterface simulator
protected String description
Constructor Detail |
---|
public Resource(DEVSSimulatorInterface simulator, String description, double capacity)
simulator
- on which is scheduleddescription
- the description of this resourcecapacity
- of the resourcepublic Resource(DEVSSimulatorInterface simulator, double capacity)
simulator
- on which is scheduledcapacity
- of the resourceMethod Detail |
---|
public double getCapacity()
public double getClaimedCapacity()
public double getAvailableCapacity()
return this.getCapacity()-this.getClaimedCapacity()
public int getQueueLength()
public void setCapacity(double capacity)
capacity
- the new maximal capacitypublic void requestCapacity(double amount, ResourceRequestorInterface requestor) throws RemoteException, SimRuntimeException
amount
- the requested amountrequestor
- the RequestorInterface requesting the amount
RemoteException
- on network failure
SimRuntimeException
- on other failurespublic void requestCapacity(double amount, ResourceRequestorInterface requestor, int priority) throws RemoteException, SimRuntimeException
amount
- the requested amountrequestor
- the RequestorInterface requesting the amountpriority
- the priority of the request
RemoteException
- on network failure
SimRuntimeException
- on other failurespublic void releaseCapacity(double amount) throws RemoteException
amount
- the amount to release
RemoteException
- on network failurepublic String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |