ItemForSale

trait ItemForSale(val description: String)

The class ItemForSale represents items that have been put up for sale in an (imaginary) electronic auction house. Items can be sold in various ways (fixed price, auctions, etc.); the concrete subclasses of this class represent those different ways. This abstract class captures some of the common characteristics of all different sales.

This simple implementation does not store any seller information.

Value parameters:
description

a short description of the item

class Object
trait Matchable
class Any

Value members

Abstract methods

Records one day as having passed. The effects of this depend on the way the item is sold.

Records one day as having passed. The effects of this depend on the way the item is sold.

Returns the winner of the item, or the person who is currently leading the bidding, in the case of an auction that is still open. The person’s name is returned in an Option wrapper; None is returned if nobody has expressed an interest in buying the item.

Returns the winner of the item, or the person who is currently leading the bidding, in the case of an auction that is still open. The person’s name is returned in an Option wrapper; None is returned if nobody has expressed an interest in buying the item.

Determines if the item has expired, that is, if the sale has ended due to a lack of interest and without the item having been sold. How soon this happens depends on the way the item is sold.

Determines if the item has expired, that is, if the sale has ended due to a lack of interest and without the item having been sold. How soon this happens depends on the way the item is sold.

Determines if the item is open, that is, if it can still be bought. Whether this is the case depends on the way the item is sold.

Determines if the item is open, that is, if it can still be bought. Whether this is the case depends on the way the item is sold.

def price: Int

Returns the current price of the item, that is, the price that the item is selling for at the moment. If the item is not open, the sale price (if bought) or closing price (if expired) is returned.

Returns the current price of the item, that is, the price that the item is selling for at the moment. If the item is not open, the sale price (if bought) or closing price (if expired) is returned.

Concrete methods

override def toString: String

Returns a textual description of the item. This text is the same as that returned by description.

Returns a textual description of the item. This text is the same as that returned by description.

Definition Classes

Concrete fields