lane.sente
Class Battery

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--lane.sente.Battery
All Implemented Interfaces:
java.lang.Runnable

public class Battery
extends java.lang.Thread

This is a simple thread that simply refills itself constantly. It is designed to ensure that robots can not do too much at one time.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Battery()
          This is the default constructor
Battery(int maxEnergy, int refillRate)
          This is the constructor
 
Method Summary
 int getEnergy()
          the method used to determine the amount of energy in the battery
 int getMaxEnergy()
          the method used to determine the capacity of the battery
 int getRefillRate()
          the method used to determine the refill rate of the battery
 void removeEnergy(int i)
          the method used to remove energy from the battery
 void run()
          The run method inherited from Thread
 void setEnergy(int i)
          the method used to set the energy level in the barry
 void setMaxEnergy(int i)
          the method used to set the maximum amount of energy the battery may contain
 void setRefillRate(int i)
          the method used to set the refil rate of the battery
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Battery

public Battery()
This is the default constructor

Battery

public Battery(int maxEnergy,
               int refillRate)
This is the constructor
Parameters:
maxEnergy - the maximum amount of energy the battery can contain
refilRate - the rate at which the battery refils
Method Detail

run

public void run()
The run method inherited from Thread
Overrides:
run in class java.lang.Thread

getEnergy

public int getEnergy()
the method used to determine the amount of energy in the battery
Returns:
energy the amount of energy left in the battery

getMaxEnergy

public int getMaxEnergy()
the method used to determine the capacity of the battery
Returns:
maxEnergy the capacity of the battery

getRefillRate

public int getRefillRate()
the method used to determine the refill rate of the battery
Returns:
refilllRate the refill rate of the battery

setEnergy

public void setEnergy(int i)
the method used to set the energy level in the barry
Parameters:
i - the level to set the battery to

removeEnergy

public void removeEnergy(int i)
the method used to remove energy from the battery
Parameters:
i - the amount of energy to remove

setMaxEnergy

public void setMaxEnergy(int i)
the method used to set the maximum amount of energy the battery may contain
Parameters:
i - the amount to set the max energy contained in this battery

setRefillRate

public void setRefillRate(int i)
the method used to set the refil rate of the battery
Parameters:
i - the rate to set the refill rate to