Packages

c

o1.goodstuff

Category

class Category extends AnyRef

The class Category represents categories of experiences in the GoodStuff diary application. A single category contains zero or more experiences that are similar in some way and are purchased in units of the same kind. A category object could be used represent hotel experiences, for instance, or wines the diarist has tasted.

A category object has a mutable state: A newly created category has no experiences yet; experiences must be added to it using the addExperience method.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Category
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Category(name: String, unit: String)

    name

    the name of the category, such as "Hotel" or "Wine"

    unit

    the name of the pricing unit associated with the experiences in this category, such as "night" or "bottle"

Value Members

  1. def addExperience(newExperience: Experience): Unit

    Adds a new experience to this category.

  2. def allExperiences: Vector[Experience]

    Returns a collection containing all the experiences recorded in this category.

  3. def favorite: Option[Experience]

    Returns the experience that the user has rated the highest in this category.

    Returns the experience that the user has rated the highest in this category. That is, of all the experiences added into this category so far, returns the one with the highest rating. If there is a tie for first place, the experience recorded first is returned.

  4. val name: String
  5. val unit: String