以下のコードは、演習 7 終了時の PaymentLib.egl ファイルのテキストです。
package libraries;
library PaymentLib type BasicLibrary{}
categories string[] =[
"Rent", // 1
"Food", // 2
"Entertainment", // 3
"Automotive", // 4
"Utilities", // 5
"Clothes", // 6
"Other" // 7
];
function getCategoryDesc(cat int in) returns(string)
if(cat) // the integer is not 0
return(categories[cat]);
else
return("");
end
end
function getCategoryNum(desc string in) returns(int)
for(i int from 1 to categories.getSize())
if(categories[i] == desc)
return(i);
end
end
return(0); // no match
end
end