Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## simogl.resource
Class AbstractResource

    java.lang.Object
      simogl.resource.AbstractResource

Direct Known Subclasses:
  Food, Gold

    public abstract class AbstractResource

extends java.lang.Object

This class represents an abstract resource. Concrete resources like gold or food can be generated by extending this class.

Author:
  Frank Bruns

Constructor Summary
`AbstractResource(int amount, long intervall)` Creates a new resource with the specified initial amount.

Method Summary
`void` | `decrease(int amount)` Decrease the resource about the specified amount
`int` | `getCurrentAmount()` Returns the current amount of the resource
`long` | `getUpdateIntervall()` Returns the intervall on which the resource gets recalculated
`void` | `increase(int amount)` Increase the resource about the specified amount
`void` | `setCurrentAmount(int amount)` Sets the current amount of the resource to the specified value
`void` | `setUpdateIntervall(long intervall)` Sets the new intervall on which the resource gets recalculated
`abstract void` | `update(long elapsedTime)` Recalculates the available amount of the resource

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractResource

    public AbstractResource(int amount,
                            long intervall)

  Creates a new resource with the specified initial amount.

  Parameters:
    `amount` - initial amount of the resource
    `intervall` - intervall of time in miliseconds in which calculations on resources will be performed, effecting the amount of the player's resources

Method Detail

### getUpdateIntervall

    public long getUpdateIntervall()

  Returns the intervall on which the resource gets recalculated

  Returns:
    intervall of recalculation of the resource's amount

### setUpdateIntervall

    public void setUpdateIntervall(long intervall)

  Sets the new intervall on which the resource gets recalculated

  Parameters:
    `intervall` - new intervall for recalculating the resource's amount

### getCurrentAmount

    public int getCurrentAmount()

  Returns the current amount of the resource

  Returns:
    current amount of the resource

### setCurrentAmount

    public void setCurrentAmount(int amount)

  Sets the current amount of the resource to the specified value

  Parameters:
    `amount` - new current amount of the resource

### increase

    public void increase(int amount)

  Increase the resource about the specified amount

  Parameters:
    `amount` - amount to increase the resource

### decrease

    public void decrease(int amount)

  Decrease the resource about the specified amount

  Parameters:
    `amount` - amount to decrease the resource

### update

    public abstract void update(long elapsedTime)

  Recalculates the available amount of the resource

  Parameters:
    `elapsedTime` - time between two calls of the updater thread

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD