risiko.server.domain
Class WeltMgr

java.lang.Object
  extended by risiko.server.domain.WeltMgr
All Implemented Interfaces:
java.io.Serializable

public class WeltMgr
extends java.lang.Object
implements java.io.Serializable

Verwaltet Länder, Kontinente und Länderbeziehungen.

Version:
2009-06-08
Author:
hhollstein
See Also:
Serialized Form

Constructor Summary
WeltMgr()
          Erstellt Länder, Kontinente, Länderbeziehungen
WeltMgr(PersMgr persistenz)
          Erstellt Welt aus Inhalt von Dateien
 
Method Summary
 void addEinheiten(Land l, int x)
          -> fügt x Einheiten zum Land hinzu
 java.util.Vector<Kontinent> getKontinentenliste()
          Gibt Kontinentenliste zurück.
 java.util.Vector<Land> getLaenderliste()
           
 java.util.Vector<Land> getNachbarn(Land a)
          Gibt Ländervektor mit Nachbarländern zurück
 boolean isNachbar(Land a, Land b)
          Prüft ob zwei Länder benachbart sind
 boolean kontinentErobert(Kontinent k)
          wenn alle länder eines kontinents den selben besitzer haben -> kontinent erobert
 void pruefKontinente()
          Prüft alle Kontinente, ob sie erobert wurden.
 void removeEinheiten(Land l, int x)
          -> entefernt x Einheiten aus dem Land
 void setBesitzer(Land l, Spieler spieler)
          -> setzt spieler als neuen Besitzer des Landes l
 void setUnbeteiligt()
          Setzt alle Länder auf unbeteiligt.
 void verschiebeEinheiten(Land land1, Land land2, int x)
          -> verschiebt x Einheiten von land1 nach land2.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeltMgr

public WeltMgr(PersMgr persistenz)
        throws java.io.FileNotFoundException,
               java.io.IOException
Erstellt Welt aus Inhalt von Dateien

Parameters:
persistenz - Datenspeicherung
Throws:
java.io.FileNotFoundException - , wenn Datei nicht vorhanden
java.io.IOException - , wenn Fehler beim Einlesen

WeltMgr

public WeltMgr()
        throws java.rmi.RemoteException
Erstellt Länder, Kontinente, Länderbeziehungen

Throws:
java.rmi.RemoteException
Method Detail

verschiebeEinheiten

public void verschiebeEinheiten(Land land1,
                                Land land2,
                                int x)
                         throws NichtGenugEinheitenException,
                                java.rmi.RemoteException
-> verschiebt x Einheiten von land1 nach land2.

Parameters:
land1 - Ursprungsland
land2 - Zielland
x - Anzahl Einheiten
Throws:
NichtGenugEinheitenException - , wenn in x > Einheiten aus land1
java.rmi.RemoteException

addEinheiten

public void addEinheiten(Land l,
                         int x)
                  throws java.rmi.RemoteException
-> fügt x Einheiten zum Land hinzu

Parameters:
l - Land
x - Anzahl Einheiten
Throws:
java.rmi.RemoteException

removeEinheiten

public void removeEinheiten(Land l,
                            int x)
                     throws java.rmi.RemoteException
-> entefernt x Einheiten aus dem Land

Parameters:
l - Land
x - Anzahl Einheiten
Throws:
java.rmi.RemoteException

kontinentErobert

public boolean kontinentErobert(Kontinent k)
                         throws java.rmi.RemoteException
wenn alle länder eines kontinents den selben besitzer haben -> kontinent erobert

Parameters:
k - Kontinent
Returns:
true, wenn erobert; false, sonst
Throws:
java.rmi.RemoteException

pruefKontinente

public void pruefKontinente()
                     throws java.rmi.RemoteException
Prüft alle Kontinente, ob sie erobert wurden.

Throws:
java.rmi.RemoteException

setUnbeteiligt

public void setUnbeteiligt()
                    throws java.rmi.RemoteException
Setzt alle Länder auf unbeteiligt.

Throws:
java.rmi.RemoteException

setBesitzer

public void setBesitzer(Land l,
                        Spieler spieler)
                 throws java.rmi.RemoteException
-> setzt spieler als neuen Besitzer des Landes l

Parameters:
l - Land
spieler - Spieler
Throws:
java.rmi.RemoteException

getLaenderliste

public java.util.Vector<Land> getLaenderliste()
Returns:
Vektor mit allen Ländern

isNachbar

public boolean isNachbar(Land a,
                         Land b)
                  throws java.rmi.RemoteException
Prüft ob zwei Länder benachbart sind

Parameters:
a - ein Land
b - ein anderes Land
Returns:
true, wenn benachbart
Throws:
java.rmi.RemoteException

getNachbarn

public java.util.Vector<Land> getNachbarn(Land a)
                                   throws java.rmi.RemoteException
Gibt Ländervektor mit Nachbarländern zurück

Parameters:
a - Land dessen Nachbarländer gesucht werden
Returns:
Vektor mit Nachbarländern
Throws:
java.rmi.RemoteException

getKontinentenliste

public java.util.Vector<Kontinent> getKontinentenliste()
Gibt Kontinentenliste zurück.

Returns:
Kontinentenliste