Package it.polimi.ingsw.Server.Model
Class PersonalGoalCard
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
it.polimi.ingsw.Server.Model.PersonalGoalCard
- All Implemented Interfaces:
PersonalGoalCardInterface
,Serializable
,Remote
This class represents the Personal Goal cards, thanks to which players may grant points
if they match the pattern with the corresponding ObjectCards
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Limit of Personal Goal Cards.private Optional<ObjectCardType>[][]
The pattern represents the position of specific types of object cards.private final int
This attribute stands for the id of the Personal Goal Card, which permits to identify the different Personal Goal Cards.Fields inherited from class java.rmi.server.RemoteObject
ref
-
Constructor Summary
ModifierConstructorDescriptionPersonalGoalCard
(int type) Class constructor.private
PersonalGoalCard
(int type, Optional<ObjectCardType>[][] pattern) Related to Game's refresh strategy -
Method Summary
Modifier and TypeMethodDescriptionprivate void
declarePattern
(int type) getCopy()
Refreshed copy, after server reload from fileint
getOrdinal
(int x, int y) getter methodOptional<ObjectCardType>[][]
returns the patterngetPlainType
(int x, int y) getter methodint
getType()
Getter method for Personal Goal CardMethods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
-
Field Details
-
LIMIT
public static final int LIMITLimit of Personal Goal Cards.- See Also:
-
type
@Expose private final int typeThis attribute stands for the id of the Personal Goal Card, which permits to identify the different Personal Goal Cards. -
pattern
The pattern represents the position of specific types of object cards.
-
-
Constructor Details
-
PersonalGoalCard
Class constructor. The pattern is created by reading information from the file.- Parameters:
type
- personal goal cards' id- Throws:
Exception
- if the file is not read properly
-
PersonalGoalCard
Related to Game's refresh strategy- Throws:
RemoteException
-
-
Method Details
-
declarePattern
- Throws:
URISyntaxException
IOException
-
getType
public int getType()Getter method for Personal Goal Card- Specified by:
getType
in interfacePersonalGoalCardInterface
- Returns:
- type of the card
-
getPattern
returns the pattern- Returns:
- a multidimensional array of optional object card types
-
getPlainType
getter method- Parameters:
x
- coordinatey
- coordinate- Returns:
- ObjectCardType in position[x][y] of the PersonalCard
-
getOrdinal
getter method- Specified by:
getOrdinal
in interfacePersonalGoalCardInterface
- Parameters:
x
- coordinatey
- coordinate- Returns:
- ordinal of ObjectCardType or -1 if the card is empty
- Throws:
Exception
- if coordinates are invalid
-
getCopy
Refreshed copy, after server reload from file- Returns:
- new copy of the object
- Throws:
RemoteException
- related to RMI
-