跳轉至內容

Ada 程式設計/庫/容器/Booch

來自華夏公益教科書

Ada. Time-tested, safe and secure.
Ada. 經久耐用,安全可靠。

庫容器

[編輯 | 編輯原始碼]
  • 集合
    • 普通
    • 有序
  • 雙端佇列
    • 有向圖
    • 無向圖
  • 列表
    • 單鏈表
    • 雙向連結串列
  • 對映
  • 佇列
    • 普通
    • 有序
  • 環形緩衝區
  • 集合
    • AVL 樹
    • 二叉樹
    • 多叉樹
[編輯 | 編輯原始碼]
作者
Simon Wright
主頁
http://booch95.sourceforge.net
教程
http://booch95.sourceforge.net/case-study.html
專案資訊
http://sourceforge.net/projects/booch95
CVS 存檔
http://sourceforge.net/cvs/?group_id=135616
下載
http://sourceforge.net/project/showfiles.php?group_id=135616

示例程式碼

[編輯 | 編輯原始碼]

閱讀專案教程以獲取完整細節。

with Ada.Calendar;
with Ada.Strings.Bounded;

package Cars is

   package Plate_Strings
     is new Ada.Strings.Bounded.Generic_Bounded_Length (10);
   
   subtype Plate_String is Plate_Strings.Bounded_String;

   package Model_Strings
     is new Ada.Strings.Bounded.Generic_Bounded_Length (32);
   
   subtype Model_String is Model_Strings.Bounded_String;

   type Car is 
      record
         Plate : Plate_String;
         Model : Model_String;
         Registered : Ada.Calendar.Time;
      end record;

end Cars;
with BC.Containers.Collections.Bounded;
with Cars;
package My_Fleet_Combined is

   use type Cars.Car;

   package Abstract_Car_Containers 
     is new BC.Containers (Cars.Car);

   package Abstract_Car_Collections 
     is new Abstract_Car_Containers.Collections;

   package Fleets 
     is new Abstract_Car_Collections.Bounded (Maximum_Size => 30);

   The_Fleet : Fleets.Collection;

end My_Fleet_Combined;

華夏公益教科書

[編輯 | 編輯原始碼]
華夏公益教科書