net.sf.magicproject.deckbuilder
Class DeckReader

java.lang.Object
  extended by net.sf.magicproject.deckbuilder.DeckReader

public final class DeckReader
extends java.lang.Object

Since:
0.90
Author:
Fabrice Daugan

Method Summary
static void fillZone(Deck deck, java.io.FileInputStream dbFile, MZone zone, Player owner)
          Fill player's zone with the cards found in InputFile
static Deck getDeck(java.awt.Component parentComponent, java.lang.String deckFile)
          Return the deck component corresponding to the given file.
static Deck getDeck(MInputStream deckStream)
          Return the deck component corresponding to the given stream.
static void readAvailableCards(MListModel<MCardCompare> cardNames)
          Read available cards from file and add them to the specified cardNames
static boolean validateDeck(java.awt.Component parentComponent, Deck deck, DeckConstraint deckConstraint)
          Validate a deck read from the given stream.
static boolean validateDeck(java.awt.Component parentComponent, Deck deck, java.lang.String deckConstraint)
          Validate a deck read from the given stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDeck

public static Deck getDeck(MInputStream deckStream)
Return the deck component corresponding to the given stream.

Parameters:
deckStream - the deck stream.
Returns:
the deck component corresponding to the given stream.

getDeck

public static Deck getDeck(java.awt.Component parentComponent,
                           java.lang.String deckFile)
                    throws java.io.FileNotFoundException
Return the deck component corresponding to the given file.

Parameters:
parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
deckFile - the deck file.
Returns:
the deck component corresponding to the given file.
Throws:
java.io.FileNotFoundException

fillZone

public static void fillZone(Deck deck,
                            java.io.FileInputStream dbFile,
                            MZone zone,
                            Player owner)
                     throws java.io.IOException
Fill player's zone with the cards found in InputFile

Parameters:
deck - the deck to add.
dbFile - opened file read containing the available cards
zone - the destination zone.
owner - the player owning the created cards.
Throws:
java.io.IOException - If some other I/O error occurs

readAvailableCards

public static void readAvailableCards(MListModel<MCardCompare> cardNames)
Read available cards from file and add them to the specified cardNames

Parameters:
cardNames - to this list method add card names

validateDeck

public static boolean validateDeck(java.awt.Component parentComponent,
                                   Deck deck,
                                   java.lang.String deckConstraint)
                            throws java.io.IOException
Validate a deck read from the given stream.

Parameters:
parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
deck -
deckConstraint - the deck constraint name.
Returns:
true if the read deck is valid.
Throws:
java.io.IOException - If some other I/O error occurs

validateDeck

public static boolean validateDeck(java.awt.Component parentComponent,
                                   Deck deck,
                                   DeckConstraint deckConstraint)
                            throws java.io.IOException
Validate a deck read from the given stream.

Parameters:
parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
deck -
deckConstraint - the deck constraint name.
Returns:
true if the read deck is valid.
Throws:
java.io.IOException - If some other I/O error occurs


Copyright © 2003-2007 Magic-Project. All Rights Reserved.