products/Sources/formale Sprachen/VDM/VDMPP/trayallocationPP image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: Item.vdmpp   Sprache: VDM

Original von: VDM©

-- ===============================================================================================================
-- Item in tray allocation for a sortation system
-- By José Antonio Esparza and Kim Bjerge - spring 2010
-- ===============================================================================================================

class Item
 types
     public ItemTraySize = nat1
     inv it == it <= ItemMaxTrays;     -- Limitation on how many trays an item occupies 

 values
  public ItemMaxSize : nat = 1500;  -- Item maximum size in mm
  public ItemMinSize : nat = 100;   -- Item minimum size in mm
  public ItemMaxTrays: nat = 2;   -- Maimum number of trays an item occupies

 instance variables
     id : nat;            -- Item ID for induction
     size : nat1;        -- Item size in mm
     inv size >= ItemMinSize and size <= ItemMaxSize;
     
     sizeOfTrays : ItemTraySize;    -- Number of trays item occupies
     trays : set of Tray := {};
     
     -- If the item is on the sorter ring the size of trays the item occupies 
     -- must be equal to number of tray associations
     -- inv let t = card trays in t > 0 => sizeOfTrays = t;
       
 operations
 
    -- InductionController constructor
 public Item: nat1 * nat ==> Item
 Item(s, i) ==
 (
  size := s;
     sizeOfTrays := size div Tray`TraySize + 1;
  id := i;
 );
 
 -- Return item id
 pure public GetId: () ==> nat
 GetId() == 
  return id;
 
 -- Returns the number of trays the item occupies
 pure public GetSizeOfTrays: () ==> ItemTraySize
 GetSizeOfTrays() ==
  return sizeOfTrays;

 -- Return item size
 public GetSize: () ==> nat
 GetSize() == 
  return size;

 -- Creates association between item and tray
 public AssignItemToTray: Tray ==> ()
 AssignItemToTray(tray) ==
  trays := trays union {tray};

 -- Remove item from sorter ring - Implicit operation - not used yet
 public RemoveItemFromTray ()
 ext wr trays : set of Tray
 post trays = {}; 
    
end Item

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet)  ¤





Download des
Quellennavigators
Download des
sprechenden Kalenders

in der Quellcodebibliothek suchen




Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.


Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.


Bot Zugriff