de.flothow.prog3.diningsavages
Class Pot

java.lang.Object
  extended by de.flothow.prog3.diningsavages.Pot

public class Pot
extends java.lang.Object

Ein Topf mit veränderlichem Füllstand. Ein neu erzeugter Topf ist zunächst leer.

Author:
Sebastian Flothow (sebastian@flothow.de)

Constructor Summary
Pot()
           
 
Method Summary
 int getContent()
          Gibt zurück, wieviele Portionen der Topf momentan enthält.
 void putServings(int n)
          Füllt Portionen in den Topf.
 void takeServing()
          Nimmt eine Portion aus dem Topf heraus.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pot

public Pot()
Method Detail

getContent

public int getContent()
Gibt zurück, wieviele Portionen der Topf momentan enthält.

Returns:
Anzahl der Portionen

takeServing

public void takeServing()
Nimmt eine Portion aus dem Topf heraus. Dies ist nur möglich, wenn der Topf mindestens eine Portion enthält.

Throws:
java.lang.IllegalStateException - wenn der Topf leer ist

putServings

public void putServings(int n)
Füllt Portionen in den Topf. Dies ist nur möglich, wenn der Topf leer ist.

Parameters:
n - Anzahl der einzufüllenden Portionen
Throws:
java.lang.IllegalStateException - wenn der Topf nicht leer ist