net.sf.magicproject.clickable.targetable.card
Class CardModelImpl

java.lang.Object
  extended by net.sf.magicproject.clickable.targetable.card.CardModelImpl
All Implemented Interfaces:
java.lang.Comparable<CardModel>, CardModel

public class CardModelImpl
extends java.lang.Object
implements CardModel

Since:
0.90
Version:
0.91
Author:
Fabrice Daugan , Stefano "Kismet" Lenzi

Constructor Summary
CardModelImpl(CardModelImpl other)
          Create a new instance of this class from another instance.
CardModelImpl(java.lang.String cardName)
          Creates a new instance with the specified card name(id).
CardModelImpl(java.lang.String cardName, java.io.InputStream inputStream)
          Complete this instance with content of specified stream.
 
Method Summary
 int compareTo(CardModel o)
           
 Ability[] getAbilities()
          Return the list of actions when casting
 Attachment getAttachment()
          Returns the optional attachment condition and modifiers brought by this card.
 java.lang.String getCardName()
          Returns the english name of this card.
 int getIdCard()
          Return the type of this card
 int getIdColor()
          Return the printed Colors of this card.
 java.lang.String getKeyName()
          Returns the file-serializable card name.
 java.lang.String getLanguage()
          Returns the language used for this card.
 java.lang.String getLocalName()
          Returns the translated name.
 ModifierModel getModifierModels()
          Return the shared modifier models.
 int[] getProperties()
          Return the properties of this card.
 java.lang.String getRulesCredit()
          XML rule designer of loaded cards.
 int[] getStaticRegisters()
          Return shared registers of this targetable.
 boolean hasKeywords(java.lang.String keyword)
          Indicates this card contains or not the specified keyword.
 void setAbilities(java.util.List<Ability> abilities)
           
 void setCardName(java.lang.String cardName)
          The the new card name.
 void setIdCard(int idCard)
          Set idCard.
 void setIdColor(int idColor)
          Set color set.
 void setLocalName(java.lang.String localName)
          Set the translated card name.
 void setModifierModels(ModifierModel modifierModels)
          Set the shared modifier models.
 void setRulesCredits(java.lang.String cardRulesCredits)
          Set XML rule designer of this card.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CardModelImpl

public CardModelImpl(java.lang.String cardName)
Creates a new instance with the specified card name(id). The translated and english names are initialized to this id.

Parameters:
cardName - the card name (id) of this instance.

CardModelImpl

public CardModelImpl(java.lang.String cardName,
                     java.io.InputStream inputStream)
Complete this instance with content of specified stream.
Structure of InputStream : Data[size] Creates a new instance with the specified card name(id). The translated and english names are initialized to this id.

Parameters:
cardName - the card name (id) of this instance.
inputStream - the input stream containing the data of this card.

CardModelImpl

public CardModelImpl(CardModelImpl other)
Create a new instance of this class from another instance.

Parameters:
other - the model's properties to copy to this instance.
Method Detail

getLanguage

public java.lang.String getLanguage()
Description copied from interface: CardModel
Returns the language used for this card.

Specified by:
getLanguage in interface CardModel
Returns:
the language used for this card.

getKeyName

public java.lang.String getKeyName()
Description copied from interface: CardModel
Returns the file-serializable card name.

Specified by:
getKeyName in interface CardModel
Returns:
the file-serializable card name.

getLocalName

public java.lang.String getLocalName()
Description copied from interface: CardModel
Returns the translated name. If null or empty, it would be equals to the given english name.

Specified by:
getLocalName in interface CardModel
Returns:
the translated card name.

getCardName

public java.lang.String getCardName()
Description copied from interface: CardModel
Returns the english name of this card. May contain any character. If null or empty, it would be equals to the card name (id).

Specified by:
getCardName in interface CardModel
Returns:
the english card name.

setRulesCredits

public void setRulesCredits(java.lang.String cardRulesCredits)
Description copied from interface: CardModel
Set XML rule designer of this card.

Specified by:
setRulesCredits in interface CardModel
Parameters:
cardRulesCredits - the XML rule designer of loaded cards.

setLocalName

public void setLocalName(java.lang.String localName)
Description copied from interface: CardModel
Set the translated card name.

Specified by:
setLocalName in interface CardModel
Parameters:
localName - the new local name.

getRulesCredit

public java.lang.String getRulesCredit()
Description copied from interface: CardModel
XML rule designer of loaded cards.

Specified by:
getRulesCredit in interface CardModel
Returns:
XML rule designer of loaded cards.

hasKeywords

public boolean hasKeywords(java.lang.String keyword)
Description copied from interface: CardModel
Indicates this card contains or not the specified keyword. Keywords are not case sensitive.

Specified by:
hasKeywords in interface CardModel
Parameters:
keyword - the tested keyword.
Returns:
true if the keyword is known by this card.

toString

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

getIdCard

public int getIdCard()
Description copied from interface: CardModel
Return the type of this card

Specified by:
getIdCard in interface CardModel
Returns:
Card type of this card

getIdColor

public int getIdColor()
Description copied from interface: CardModel
Return the printed Colors of this card.

Specified by:
getIdColor in interface CardModel
Returns:
printed Colors of this card.

getStaticRegisters

public int[] getStaticRegisters()
Description copied from interface: CardModel
Return shared registers of this targetable. This register would never be modifier.

Specified by:
getStaticRegisters in interface CardModel
Returns:
shared registers of this targetable.

getProperties

public int[] getProperties()
Description copied from interface: CardModel
Return the properties of this card. These properties are these one readable on card itself.

Specified by:
getProperties in interface CardModel
Returns:
the properties for this card.

getAbilities

public Ability[] getAbilities()
Description copied from interface: CardModel
Return the list of actions when casting

Specified by:
getAbilities in interface CardModel
Returns:
List of actions when casting

getModifierModels

public ModifierModel getModifierModels()
Description copied from interface: CardModel
Return the shared modifier models. All cards with same id have the same modifier models objects

Specified by:
getModifierModels in interface CardModel
Returns:
the shared modifier models.

setModifierModels

public void setModifierModels(ModifierModel modifierModels)
Description copied from interface: CardModel
Set the shared modifier models. All cards with same id have the same modifier models objects

Specified by:
setModifierModels in interface CardModel
Parameters:
modifierModels - The new modifierModels to set.

getAttachment

public Attachment getAttachment()
Description copied from interface: CardModel
Returns the optional attachment condition and modifiers brought by this card.

Specified by:
getAttachment in interface CardModel
Returns:
the optional attachment condition and modifiers brought by this card. Return null if there is no attachment brought by this card.

compareTo

public int compareTo(CardModel o)
Specified by:
compareTo in interface java.lang.Comparable<CardModel>
Specified by:
compareTo in interface CardModel

setIdCard

public void setIdCard(int idCard)
Set idCard.

Parameters:
idCard - the new idCard

setIdColor

public void setIdColor(int idColor)
Set color set.

Parameters:
idColor - the new color set.

setCardName

public void setCardName(java.lang.String cardName)
The the new card name.

Parameters:
cardName - the new card name.

setAbilities

public void setAbilities(java.util.List<Ability> abilities)
Parameters:
abilities -


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