Line | |
---|
1 | unit GenericSet;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | GenericList;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TGSet<T> = class
|
---|
12 | private
|
---|
13 | FList: TGList<T>;
|
---|
14 | public
|
---|
15 | function IsIn(Item: T): Boolean;
|
---|
16 | constructor Create;
|
---|
17 | destructor Destroy; override;
|
---|
18 | property List: TGList<T> read FList;
|
---|
19 | end;
|
---|
20 |
|
---|
21 | implementation
|
---|
22 |
|
---|
23 | { TGSet }
|
---|
24 |
|
---|
25 | function TGSet<T>.IsIn(Item: T): Boolean;
|
---|
26 | begin
|
---|
27 | Result := FList.IndexOf(Item) <> -1;
|
---|
28 | end;
|
---|
29 |
|
---|
30 | constructor TGSet<T>.Create;
|
---|
31 | begin
|
---|
32 | FList := TGList<T>.Create;
|
---|
33 | end;
|
---|
34 |
|
---|
35 | destructor TGSet<T>.Destroy;
|
---|
36 | begin
|
---|
37 | FList.Free;
|
---|
38 | inherited Destroy;
|
---|
39 | end;
|
---|
40 |
|
---|
41 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.