Module set.pkg
1//************************************************************************
2//
3// Confidential Trade Secret.
4// Copyright 1987-1992 Data Access Corporation, Miami FL, USA
5// All Rights reserved
6// DataFlex is a registered trademark of Data Access Corporation.
7//
8//
9// $Source: k:\RCS\.\pkg\set.pkg,v $
10// $Revision: 1 $
11// $State: Exp $
12// $Author: james $
13// $Date: Apr 01 16:09:27 1997 $
14// $Locker: $
15//
16// $Log: set.pkg,v $
17//Revision 2.1 1993/08/25 17:49:41 james
18//Adding new main branch
19//
20//Revision 1.2 1993/04/28 00:20:34 james
21//Initializing 3.04 source code.
22//
23//Revision 1.1 1992/09/08 14:43:09 james
24//Initial revision
25//
26//Revision 1.4 92/05/14 17:15:20 SWM
27//Updated Copyright slug.
28//
29//Revision 1.3 92/03/09 19:04:28 james
30//Added #CHKSUB directive to insure source
31//only compiled with correct revision of
32//compiler.
33//
34//Revision 1.2 91/11/26 17:43:48 elsa
35//Only a test
36//
37//Revision 1.1 91/10/23 10:22:35 elsa
38//Initial revision
39//
40//************************************************************************/
41
42//************************************************************************
43// File Name: Set.Pkg
44// Creation Date: January 1, 1991
45// Modified Date: May 23, 1991
46// Author(s): Steven A. Lowe
47//
48// This module contains the Set class definition.
49//************************************************************************/
50
51#CHKSUB 1 1 // Verify the UI subsystem.
52
53use VDFBase.pkg
54
55
56{ ClassLibrary=Common }
57{ HelpTopic=Set }
58class Set is an ARRAY
59
60 Function Find_Element string ElemStr returns integer
61 integer ndx retVal ArrMax
62 string ArrVal
63 get item_count to ArrMax
64 move -1 to retVal
65 move 0 to ndx
66 while (ndx < ArrMax AND retVal = -1)
67 get array_value item ndx to ArrVal
68 if ArrVal eq ElemStr move ndx to retVal
69 Move (ndx + 1) to ndx
70 end
71 function_return retVal
72 end_function
73
74 procedure Add_Element string Elem_Str returns integer
75 integer Ret_Val
76
77 get Find_Element Elem_Str to Ret_Val
78
79 if Ret_Val LT 0 ;
80 get Item_Count to Ret_Val
81
82 set Array_Value item Ret_Val to Elem_Str
83
84 procedure_return Ret_Val
85 end_procedure
86
87 Procedure Remove_Element string sElement
88 Integer iIndex
89 Get Find_Element sElement to iIndex
90 If (iIndex > -1) Send delete_item iIndex
91 end_procedure
92
93
94end_class
95
96//
97// global function to create set instances at random
98//
99{ Visibility=Private Obsolete=True }
100function make_set for cDesktop returns integer
101 integer retval
102 object SetTemplate is a Set
103 move self to retval
104 end_object
105 function_return retval
106end_function
107
108
109