Package auction :: Module auction :: Class Auction
[hide private]
[frames] | no frames]

Class Auction

object --+
         |
        Auction
Known Subclasses:

The base class Auction represents auctions in an electronic auction house. Each auction object represents an auction for a single item that has been put up for sale. Each auction has a description and a starting price. An auction may be open or closed. A closed auction can have a buyer or it may have expired. These features are common to all kinds of auctions. However, the specifics of how an auction's price changes as the auction proceeds, and various other implementation details will vary for different kinds of auctions (i.e., different implementations of this interface).

Every day, the method advance_one_day must be called to update an auction status. Different kinds of auctions will have different kinds of daily status changes. The way items are bought is also defined differently for each different kind of auction.

All prices and bid amounts are integers. Buyers are represented simply by their names (strings).

Instance Methods [hide private]
string
get_description(self)
Returns a description of the auction and the item being sold.
int
get_starting_price(self)
Returns the starting price of the auction.
boolean
matches_keyword(self, keyword)
Determines if the auction matches a given search keyword, i.e., if the auction description contains the given keyword.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

get_description(self)

 

Returns a description of the auction and the item being sold.

Returns: string
auction description

get_starting_price(self)

 

Returns the starting price of the auction.

Returns: int
starting price

matches_keyword(self, keyword)

 

Determines if the auction matches a given search keyword, i.e., if the auction description contains the given keyword. Upper and lower case letters are considered equal for the purposes of this matching operation.

For instance, if the auction description is "Big golden Rolex", then the keywords "rolex", "Rolex", "GOLD", "olde" and "en r" match the auction.

Parameters:
  • keyword (string) - a search string
Returns: boolean
a boolean value indicating if the auction matches the keyword