File: notes.txt

package info (click to toggle)
libur-perl 0.470%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,192 kB
  • sloc: perl: 61,814; javascript: 255; xml: 108; sh: 13; makefile: 9
file content (51 lines) | stat: -rw-r--r-- 1,896 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
ur define namespace Vending

ur define datasource sqlite --dsname Machine

Schema:
-- name the kinds of things the machine knows about
create table item_type (type_id integer PRIMARY KEY NOT NULL,
                        name varchar NOT NULL);

-- places where things get sloted in
create table vend_slot (slot_id integer PRIMARY KEY NOT NULL,
                         name varchar NOT NULL,
                         is_buyable integer NOT NULL,
                         cost_cents integer,
                         label varchar);

-- kinds of coins we'll accept and their value
--create table coin_type(type_id integer PRIMARY KEY NOT NULL REFERENCES item_type(type_id),
--                       value_cents integer NOT NULL);


--Parent table for instances of things the machine can sell
create table vend_item (vend_item_id integer PRIMARY KEY NOT NULL,
                        subtype_name varchar,
                        slot_id integer NOT NULL REFERENCES vend_slot(slot_id));

-- instances of coins held by the machine
create table coin (coin_id integer PRIMARY KEY NOT NULL REFERENCES vend_item(vend_item_id),
                   type_id integer NOT NULL REFERENCES item_type(type_id));

-- kinds of things we'll sell
create table product (product_id integer PRIMARY KEY NOT NULL REFERENCES item_type(type_id),
                      cost_cents integer NOT NULL,
                      manufacturer varchar NOT NULL);

-- instances of things in the inventory
create table inventory (inv_id integer PRIMARY KEY NOT NULL,
                        product_id integer NOT NULL REFERENCES product(product_id),
                        insert_date datetime NOT NULL DEFAULT (date('now')));
                        

ur update classes

fixup VendingMachine::Inventory
    add indirect properties for name, price, is_sellable

make command line script vend

Make skeleton VendingMachine::Command