net.sf.magicproject.deckbuilder
Class Deck

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

public class Deck
extends java.lang.Object

Since:
0.90
Author:
Fabrice Daugan

Field Summary
static Deck currentDeck
          The current instance of deck.
 
Constructor Summary
Deck(java.lang.String deckName)
          Create a new instance of this class.
 
Method Summary
 void addCard(MCardCompare card)
          Add any number of cards to this deck.
 void addCard(java.lang.String cardName, int amount, java.util.Map<java.lang.String,java.lang.String> properties)
          Add any number of cards to this deck.
 java.util.List<MCardCompare> getCards()
          Return the cards of this deck.
 DeckConstraint getConstraint()
          Return the deck constraint applied to this deck.May be null.
 java.io.FileInputStream getMdbStream()
          Return available stream of deck.
 java.lang.Object getProperty(java.lang.String propertyName)
          Return a property value of this deck.
 boolean isValidated()
          Is this deck has been validated.
 void removeCard(MCardCompare card)
           
 void send(java.io.OutputStream out)
          Write the cards of this deck into the given output stream.
 java.lang.String toString()
           
 java.util.List<java.lang.String> validate(DeckConstraint deckConstraint)
          Validate this deck.
 java.util.List<java.lang.String> validate(java.lang.String deckConstraint)
          Validate this deck.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentDeck

public static Deck currentDeck
The current instance of deck. Used by some test such as DeckCounter.
This field should be removed to be added as parameter of this kind of test.

See Also:
validate(String)
Constructor Detail

Deck

public Deck(java.lang.String deckName)
Create a new instance of this class.

Parameters:
deckName - The deck name.
Method Detail

getCards

public java.util.List<MCardCompare> getCards()
Return the cards of this deck.

Returns:
the cards of this deck.

getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Return a property value of this deck.

Parameters:
propertyName - the property name.
Returns:
a property. Null if the property does not exist.

addCard

public void addCard(java.lang.String cardName,
                    int amount,
                    java.util.Map<java.lang.String,java.lang.String> properties)
Add any number of cards to this deck.

Parameters:
cardName - the card name.
amount - th numbe of cards to add to this deck.
properties - the optional properties attached to these cards.

addCard

public void addCard(MCardCompare card)
Add any number of cards to this deck.

Parameters:
card - the card specification.

validate

public java.util.List<java.lang.String> validate(DeckConstraint deckConstraint)
                                          throws java.io.IOException
Validate this deck.

Parameters:
deckConstraint - the deck constraint name.
Returns:
list of validation error. Validation is ok when this list is empty.
Throws:
java.io.IOException - if io exception occurred.

validate

public java.util.List<java.lang.String> validate(java.lang.String deckConstraint)
                                          throws java.io.IOException
Validate this deck.

Parameters:
deckConstraint - the deck constraint name.
Returns:
list of validation error. Validation is ok when this list is empty.
Throws:
java.io.IOException - if io exception occurred.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getConstraint

public DeckConstraint getConstraint()
Return the deck constraint applied to this deck.May be null.

Returns:
the deck constraint applied to this deck.May be null.

send

public void send(java.io.OutputStream out)
Write the cards of this deck into the given output stream.

Parameters:
out - the output stream where this deck will be written.

getMdbStream

public java.io.FileInputStream getMdbStream()
Return available stream of deck. Not null only when validating a deck. The returned stream corresponds to the first offset of first card.

Returns:
Available stream of deck. Not null only when validating a deck.

isValidated

public boolean isValidated()
Is this deck has been validated.

Returns:
true if this deck has been validated.

removeCard

public void removeCard(MCardCompare card)
Parameters:
card -


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