java.lang.Object
it.polimi.ingsw.am13.model.card.points.PointsSet
All Implemented Interfaces:
PointsObjective, Serializable

public class PointsSet extends Object implements PointsObjective
Representation of points of an objective card of type "x points for each set of resources/objects" (first 3 types of objective cards presentd in the rule book). An object instantiated from this class is immutable.
See Also:
  • Field Details

    • set

      private final Map<Resource,Integer> set
      Represets the set of resources/objects that must be present to obtain the points
    • points

      private final int points
      Represetns how many points the card gives for each complete set present in field
  • Constructor Details

    • PointsSet

      public PointsSet(Map<Resource,Integer> set, int points)
      The only constructor of the class. The only way to set the parameters of the class is to instantiate the object via this constructor
      Parameters:
      set - The set of resources/objects that must be present to obtain the points
      points - How many points the card gives for each complete set present in field
  • Method Details

    • getSet

      public Map<Resource,Integer> getSet()
      Returns:
      The set of resources/objects that must be present to obtain the points
    • calcPoints

      public int calcPoints(FieldIF field)
      Calculate points of the card, according to how many sets of resources/objects, which are indicated by the card itself, are visible.
      Specified by:
      calcPoints in interface PointsObjective
      Parameters:
      field - Field of the player for whom you want to calculate the points given by the card objective.
      Returns:
      Number of points guaranteed by the card objective
    • getPointsMultiplier

      public int getPointsMultiplier()
      Specified by:
      getPointsMultiplier in interface PointsObjective
      Returns:
      Points multiplier of the objective card (how many points are given for each pattern/set satisfied in the field)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object