java.lang.Object
it.polimi.ingsw.am13.model.card.Card
- All Implemented Interfaces:
CardIF
,Serializable
- Direct Known Subclasses:
CardObjective
,CardPlayable
Represents a generic card of the game.
It is identified by a unique id (immutable attribute), and stores other information about the card during the game.
The card is present in field if all players can see it. Hence, it could be in one player's field or if it is in one of the 9 spots of the commond field.
If the card is in field,
visibleSide
specifies what side is visible (front or back)- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getId()
int
hashCode()
void
placeCardInField
(Side visibleSide) Sets the card visible in field, with the visible side specified.void
Removes card from fieldtoString()
-
Field Details
-
id
Unique id of the card (r, g, s, o for type), number or 3 digits (in order of pdf). -
visibleSide
If the card is in the field, this specifies what side is visible. If the card is not in the field, the attribute is null
-
-
Constructor Details
-
Card
Card(String id) Set the specified id while creating a new card The card is created not visible in the field- Parameters:
id
- Id of the card
-
-
Method Details
-
getId
-
getVisibleSide
- Specified by:
getVisibleSide
in interfaceCardIF
- Returns:
- The visible side of the card. If the card is not in field, returns
null
.
-
placeCardInField
Sets the card visible in field, with the visible side specified.- Parameters:
visibleSide
- Visible side of the card in the field- Throws:
NullPointerException
- if the side specified is null
-
removeCardFromField
public void removeCardFromField()Removes card from field -
equals
-
hashCode
public int hashCode() -
toString
-