java.lang.Object
it.polimi.ingsw.am13.model.card.Corner
- All Implemented Interfaces:
Serializable
This is a class that represents one of the four corners of the side of a card
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
This attribute represents whether the corner has been covered by another corner or notprivate CardSidePlayable
This attribute represents the card side that is played on or under this cornerprivate final Resource
This attribute represents the resource contained in this cornerprivate final boolean
This attribute represents whether the corner is visible or not -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLinkToCard
(CardSidePlayable cardSidePlayable) This method creates a link from this corner to a cardSidePlayableclone()
void
This method covers the Corner by setting the covered variable to trueboolean
Utility method useful for tests.getLink()
int
hashCode()
boolean
boolean
-
Field Details
-
visibility
private final boolean visibilityThis attribute represents whether the corner is visible or not -
covered
private boolean coveredThis attribute represents whether the corner has been covered by another corner or not -
resource
This attribute represents the resource contained in this corner -
link
This attribute represents the card side that is played on or under this corner
-
-
Constructor Details
-
Corner
This is a constructor of a visible corner- Parameters:
resource
- Resource present on the corner. If the corner is visible but has no resource, useResource.NO_RESOURCE
-
Corner
public Corner()This is a constructor of a corner that isn't visible. A non-visible corner can only contain NO_RESOURCE as a resource
-
-
Method Details
-
getResource
- Returns:
- the resource contained in this corner
-
getLink
- Returns:
- the link contained in this corner
-
isCovered
public boolean isCovered()- Returns:
- whether the corner has been covered by another corner or not
-
coverCorner
public void coverCorner()This method covers the Corner by setting the covered variable to true -
isPlaceable
public boolean isPlaceable()- Returns:
- whether another corner can be played on top of this corner
-
addLinkToCard
This method creates a link from this corner to a cardSidePlayable- Parameters:
cardSidePlayable
- the cardSidePlayable to which the link will be created- Throws:
VariableAlreadySetException
- when the link isn't null, ie it was already set outside the constructor before
-
generateEmptyCorners
Utility method useful for tests. Generates a list of four visible empty corners (as in back side of resource cards)- Returns:
- New list of four visible empty corners (as in back side of resource cards)
-
clone
-
equals
-
hashCode
public int hashCode()
-