Class IntResource<T extends Number & Comparable<T>>

    • Field Detail

      • counter

        static AtomicLong counter
        the counter counting the requests. package visibility, so Request can access it.
      • UTILIZATION_EVENT

        public static final EventType UTILIZATION_EVENT
        UTILIZATION_EVENT is fired on activity.
      • RESOURCE_REQUESTED_QUEUE_LENGTH

        public static final EventType RESOURCE_REQUESTED_QUEUE_LENGTH
        RESOURCE_REQUESTED_QUEUE_LENGTH fired on changes in queue length.
      • MIN_REQUEST_PRIORITY

        public static final int MIN_REQUEST_PRIORITY
        the minimum priority.
        See Also:
        Constant Field Values
      • MAX_REQUEST_PRIORITY

        public static final int MAX_REQUEST_PRIORITY
        the maximum priority.
        See Also:
        Constant Field Values
      • DEFAULT_REQUEST_PRIORITY

        public static final int DEFAULT_REQUEST_PRIORITY
        the default average priority.
        See Also:
        Constant Field Values
      • claimedCapacity

        protected long claimedCapacity
        claimedCapacity defines the currently claimed capacity.
      • description

        protected String description
        the description of the resource.
    • Constructor Detail

      • IntResource

        public IntResource​(DevsSimulatorInterface<T> simulator,
                           String description,
                           long capacity)
        Method Resource.
        Parameters:
        simulator - DEVSSimulatorInterface<T>; on which is scheduled
        description - String; the description of this resource
        capacity - long; of the resource
      • IntResource

        public IntResource​(DevsSimulatorInterface<T> simulator,
                           long capacity)
        Method Resource.
        Parameters:
        simulator - DEVSSimulatorInterface<T>; on which is scheduled
        capacity - long; of the resource
    • Method Detail

      • getCapacity

        public long getCapacity()
        returns the maximum, and thus original capacity of the resource.
        Returns:
        capacity the maximum, and thus original capacity of the resource.
      • getClaimedCapacity

        public long getClaimedCapacity()
        returns the amount of currently claimed capacity.
        Returns:
        the amount of currently claimed capacity.
      • getAvailableCapacity

        public long getAvailableCapacity()
        returns the currently available capacity on this resource. This method is implemented as return this.getCapacity()-this.getClaimedCapacity()
        Returns:
        the currently available capacity on this resource.
      • getQueueLength

        public int getQueueLength()
        returns the number of instances currently waiting for this resource.
        Returns:
        the number of instances currently waiting for this resource
      • setCapacity

        public void setCapacity​(long capacity)
        sets the capacity of the resource.
        Parameters:
        capacity - long; the new maximal capacity
      • releaseCapacity

        public void releaseCapacity​(long amount)
                             throws RemoteException
        releases an amount of capacity from the resource.
        Parameters:
        amount - long; the amount to release
        Throws:
        RemoteException - on network failure