OSDN Git Service

こっそり、気持ち程度の日本語化しました (UTF-8 / Windows 環境用)。
[ring-lang-081/annotated-ring-with-OmegaT.git] / target / ringlibs / stdlib / stdqueue.ring
1 # Ring 標準ライブラリ
2 # アプリケーション用の汎用関数とクラス
3 # 2016, Mahmoud Fayed <msfclipper@yahoo.com>
4
5 Load "stdfunctions.ring"
6 Load "stdbase.ring"
7 Load "stdlist.ring"
8 Load "stdlibcore.ring"
9
10 if IsMainSourceFile() 
11         queue_class_test()
12 ok
13
14 func queue_class_test
15         oQueue = new Queue
16         oQueue.add(1)
17         oQueue.add(2)
18         oQueue.add(3)
19         see oQueue.remove() + nl
20         see oQueue.remove() + nl
21         see oQueue.remove() + nl
22         oQueue.add(4)
23         see oQueue.remove() + nl
24         oQueue { add("one") add("two") add("three") }
25         oQueue.print()
26
27 Class Queue From List
28
29         Func Init x
30                 if isstring(x) or isnumber(x) or islist(x)
31                         super.init(x)
32                 else
33                         raise("Error: Queue Class - Init Method - Bad Parameter")
34                 ok
35
36         Func Remove
37                 item = item(1)
38                 delete(1)
39                 return item