GNU PIC で クラス図

GNU PIC でクラス図 を書く。

GNU PIC でクラス図

.ps 14 # font size
.PS
scale = 2.54; # inch -> cm

lineht=3;
linewid=3;

define class {[
    box $1 ht $2 wid $3;
    box $4 ht $5 wid last box.wid with .ne at last box.se;
    box $6 ht $7 wid last box.wid with .ne at last box.se;
]}

define diamond {[
    box invisible ht $1 wid $1;
    line from last box.n to last box.e;
    line from last box.n to last box.w;
    line from last box.s to last box.e;
    line from last box.s to last box.w;
]}

define triangle {[
    box invisible ht $1 wid $1;
    line from last box.n to last box.sw;
    line from last box.n to last box.se;
    line from last box.se to last box.sw;
]}

Customer: class("customer", 1, 3, "name" "age" "birthday" "number" "address", 3, "modify info", 1);

move to Customer.s; down;
line "be rent" ljust;
Rental: class("rental", 1, 3, "date" "due" "fee", 2, "rental", 1);

"previous owner" "n .. *" rjust below at Customer.s +(-1.5, -0.5);

"previous rental" "1" rjust above at Rental.n +(-1.5, 0.5);

line "rent" ljust from Customer.e +(2, 0) to Rental.e +(2, 0);
line "owner" "0 .. *" from last line.start to Customer.e;
line "rental" "1" from 2nd last line.end to Rental.e;

diamond(0.5) with .e at Rental.w;
move to last [].w; left; line;
RentalSubstance: class("rental substance", 1, 4, "rental number" "media", 2, "modify info", 1);

move to RentalSubstance.s; down; line;
Movie: class("movie", 1, 3, "name" "time" "director" "actors", 2, "modify info", 1);

triangle(0.5) with .n at Rental.s;
move to last [].s; down; line;
OnlineRental: class("online rental", 1, 3, , 0.5, "rental", 1);

.PE