AuctionHouse2 Docs
Fall 2024
API

# AuctionHouse

o1.auctionhouse.AuctionHouse
class AuctionHouse(val `name`: String)

The class `AuctionHouse` represents electronic auction houses. It provides methods for adding auctions and producing statistics about the items being sold, among other things.

This version of class `AuctionHouse` allows for various ways of selling items: any objects of type `ItemForSale` may be added to the auction house.

## Parameters

name

  the name of the auction house

## Attributes

Graph
Supertypes
  class Object
  trait Matchable
  class Any

## Members list

### Value members

#### Concrete methods

def addItem(`item`: ItemForSale): Unit

Adds the given item to the auction house.

Adds the given item to the auction house.

## Attributes

def averagePrice: Double

Returns the current average price of all the items that have been put up for sale in this auction house. The average is computed from the prices of all items, be they open or closed.

Returns the current average price of all the items that have been put up for sale in this auction house. The average is computed from the prices of all items, be they open or closed.

## Attributes

def nextDay(): Unit

Records one day as having passed. This is equivalent to calling `item.advanceOneDay()` for each of the items in this auction house.

Records one day as having passed. This is equivalent to calling `item.advanceOneDay()` for each of the items in this auction house.

## Attributes

See also

  ItemForSale.advanceOneDay

def numberOfOpenItems: Int

Returns the number of items in this auction house that are currently open.

Returns the number of items in this auction house that are currently open.

## Attributes

def priciest: Option[ItemForSale]

Returns the priciest item in the auction house, that is, the item whose current price is the highest. Both open and closed items are considered. The item is returned in an `Option` wrapper; if there are no auctions at all, `None` is returned.

Returns the priciest item in the auction house, that is, the item whose current price is the highest. Both open and closed items are considered. The item is returned in an `Option` wrapper; if there are no auctions at all, `None` is returned.

## Attributes

def purchasesOf(`buyer`: String): Vector[ItemForSale]

Returns a collection that contains the purchases of a single buyer. This means all the (open or closed) items that have either already been bought by the given person, or that have the person as the highest bidder.

Returns a collection that contains the purchases of a single buyer. This means all the (open or closed) items that have either already been bought by the given person, or that have the person as the highest bidder.

## Parameters

buyer

  the name of the buyer whose purchases should be returned

## Attributes

Returns

  a new buffer containing the items

def removeItem(`item`: ItemForSale): Unit

Removes the given item from the auction house, assuming it was there.

Removes the given item from the auction house, assuming it was there.

## Attributes

override def toString: String

Produces a textual representation of this auction house.

Produces a textual representation of this auction house.

## Attributes

Definition Classes
  Any

def totalPrice: Int

Returns the current total price of all the items that have been put up for sale in this auction house. The total includes the prices of all items, be they open or closed.

Returns the current total price of all the items that have been put up for sale in this auction house. The total includes the prices of all items, be they open or closed.

## Attributes

#### Concrete fields

val name: String