ignore .lib and .exe
[prop.git] / prop-src / collection.ph
blob91e433239e050aed7d5f0903893994e29978e1b0
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 //  This file describe the collection datatypes in Prop.
4 //
5 ///////////////////////////////////////////////////////////////////////////////
6 #ifndef collection_datatypes_h
7 #define collection_datatypes_h
9 #include "basics.ph"
11 ///////////////////////////////////////////////////////////////////////////////
13 //  CollectionAttrib describes the set of extension properties that
14 //  a collection may have.
16 ///////////////////////////////////////////////////////////////////////////////
17 enum {  COLLECTION_NONE            = 0,
18         COLLECTION_ORDERED         = 1, // is it ordered?
19         COLLECTION_IDEMPOTENT      = 2, // no duplicates?
20         COLLECTION_SINGLE_VALUED   = 4, // single valued map?
21         COLLECTION_EXTERNAL_KEYED  = 8  // external ordering function?
22      };
24 ///////////////////////////////////////////////////////////////////////////////
26 //  Operations that can be performed on a collection.
28 ///////////////////////////////////////////////////////////////////////////////
29 enum {  OP_size       = 1<<1,   // cardinality
30         OP_capacity   = 1<<2,   // maximum capacity
31         OP_growth     = 1<<3,   // dynamic expansion
32         OP_copy       = 1<<4,   // copy
33         OP_move       = 1<<5,   // destructive copy
34         OP_merge      = 1<<6,   // destructive merge
35         OP_with       = 1<<7,   // insert an element by key
36         OP_less       = 1<<8,   // delete an element by key
37         OP_union      = 1<<9,   // union
38         OP_intersect  = 1<<10,  // intersection
39         OP_arb        = 1<<11,  // choose an arbitrary element
40         OP_delete     = 1<<12,  // self deletion
41         OP_forall     = 1<<13,  // iteration 
42         OP_minkey     = 1<<14,  // find min element by key 
43         OP_maxkey     = 1<<15,  // find max element by key
44         OP_deletemin  = 1<<16,  // delete min element by key
45         OP_deletemax  = 1<<17,  // delete max element by key
46         OP_count      = 1<<18,  // count element by key
47         OP_map        = 1<<19,  // f(x)
48         OP_mapall     = 1<<20,  // f{x}
49         OP_inverse    = 1<<21,  // f^{-1}{x}
50         OP_dom        = 1<<22,  // dom f
51         OP_ran        = 1<<23   // ran f
52      };
54 ///////////////////////////////////////////////////////////////////////////////
56 //  Intensional properties are described by CollectionRep.
58 ///////////////////////////////////////////////////////////////////////////////
59 enum CollectionRep
60    {  REP_none           = 0,
61       REP_unbased        = 1<<1,           // linked list representation   
62       REP_weakly_based   = 1<<2,           // linked list representation   
63       REP_strongly_based = 1<<3,           // linked list representation   
64       REP_array          = 1<<4,           // array representation
65       REP_based          = 1<<5,           // based set representation
66       REP_bitmap         = 1<<6,           // bitmap representation
67       REP_hash           = 1<<7,           // hash table representation
68       REP_heap           = 1<<8            // binary heap representation
69    }; 
71 ///////////////////////////////////////////////////////////////////////////////
73 //  The collection type descriptor is described as follows.  All collection
74 //  types are generative.
76 ///////////////////////////////////////////////////////////////////////////////
77 datatype CollectionDesc : MEM =
78             COLdesc { name   : Id, 
79                       attrib : CollectionAttrib = COLLECTION_NONE, 
80                       rep    : CollectionRep = REP_none
81                     }
82 where type CollectionOp     = int
83        and CollectionAttrib = int
84        and CollectionDescs  = List<CollectionDesc>
87 #endif