This repository was archived by the owner on Feb 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathutils.functional.pas
More file actions
639 lines (535 loc) · 18.4 KB
/
utils.functional.pas
File metadata and controls
639 lines (535 loc) · 18.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
(******************************************************************************)
(* PascalUtils *)
(* delphi and object pascal library of utils data structures *)
(* *)
(* Copyright (c) 2020 - 2021 Ivan Semenkov *)
(* https://github.com/isemenkov/pascalutils ivan@semenkov.pro *)
(* Ukraine *)
(******************************************************************************)
(* *)
(* Permission is hereby granted, free of charge, to any person obtaining a *)
(* copy of this software and associated documentation files (the "Software"), *)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)
(* and/or sell copies of the Software, and to permit persons to whom the *)
(* Software is furnished to do so, subject to the following conditions: *)
(* *)
(* The above copyright notice and this permission notice shall be included in *)
(* all copies or substantial portions of the Software. *)
(* *)
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)
(* DEALINGS IN THE SOFTWARE. *)
(* *)
(******************************************************************************)
unit utils.functional;
{$IFDEF FPC}
{$mode objfpc}{$H+}
{$ENDIF}
{$IFOPT D+}
{$DEFINE DEBUG}
{$ENDIF}
interface
uses
SysUtils, utils.functor, utils.enumerate
{$IFDEF USE_OPTIONAL}, utils.optional{$ENDIF};
type
{ Accumulate iterable object data using Functor. }
{$IFDEF FPC}generic{$ENDIF} TAccumulate<V; Iterator
{$IFNDEF FPC}: TForwardIterator<V, Iterator>{$ENDIF};
Functor{$IFNDEF FPC}: constructor, TBinaryFunctor<V, V>{$ENDIF}> = class
public
constructor Create (AIterator : Iterator; AInitial : V);
protected
FValue : V;
public
property Value : V read FValue;
end;
{ Map applying the given functor to each item of a given iterable object. }
{$IFDEF FPC}generic{$ENDIF} TMap<V; Iterator
{$IFNDEF FPC}: TForwardIterator<V, Iterator>{$ENDIF};
Functor{$IFNDEF FPC}: constructor, TUnaryFunctor<V, V>{$ENDIF}> = class
public
type
{$IFDEF USE_OPTIONAL}
TOptionalValue = {$IFDEF FPC}specialize{$ENDIF} TOptional<V>;
{$ENDIF}
TIterator = class; { Fix for FreePascal compiler. }
TIterator = class ({$IFDEF FPC}specialize{$ENDIF} TForwardIterator<V,
TIterator>)
protected
constructor Create (AIterator : Iterator; AFunctor : Functor);
public
{ Return true if iterator has correct value. }
function HasValue : Boolean; override;
{ Retrieve the next entry. }
function Next : TIterator; override;
{ Return True if we can move to next element. }
function MoveNext : Boolean; override;
{ Return enumerator for in operator. }
function GetEnumerator : TIterator; override;
protected
{ Get item value. }
function GetValue : {$IFNDEF USE_OPTIONAL}V{$ELSE}TOptionalValue
{$ENDIF}; override;
{ Return current item iterator and move it to next. }
function GetCurrent : TIterator; reintroduce;
public
property Value : {$IFNDEF USE_OPTIONAL}V{$ELSE}TOptionalValue
{$ENDIF} read GetValue;
property Current : TIterator read GetCurrent;
protected
FValue : V;
FInnerIterator : Iterator;
FFunctor : Functor;
end;
public
constructor Create (AIterator : Iterator; AFunctor : Functor);
{ Return True if we can move to next element. }
function MoveNext : Boolean;
{ Retrive the first entry. }
function FirstEntry : TIterator;
{$IFNDEF DEBUG}inline;{$ENDIF}
{ Return enumerator for in operator. }
function GetEnumerator : TIterator;
{$IFNDEF DEBUG}inline;{$ENDIF}
protected
{ Return current item iterator and move it to next. }
function GetCurrent : TIterator;
public
property Current : TIterator read GetCurrent;
protected
FBaseIterator : Iterator;
FFunctor : Functor;
FIterator : TIterator;
end;
{ Accumulate functors for default data types.
Delphi generics do not support arithmetic operators that act on generic
types. }
TAdditionByteFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Byte, Byte>)
public
function Call (AValue1, AValue2 : Byte) : Byte; override;
end;
TAdditionShortIntFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<ShortInt, ShortInt>)
public
function Call (AValue1, AValue2 : ShortInt) : ShortInt; override;
end;
TAdditionWordFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Word, Word>)
public
function Call (AValue1, AValue2 : Word) : Word; override;
end;
TAdditionSmallIntFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<SmallInt, SmallInt>)
public
function Call (AValue1, AValue2 : SmallInt) : SmallInt; override;
end;
TAdditionIntegerFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Integer, Integer>)
public
function Call (AValue1, AValue2 : Integer) : Integer; override;
end;
{$IFDEF FPC}
TAdditionDWordFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<DWord, DWord>)
public
function Call (AValue1, AValue2 : DWord) : DWord; override;
end;
{$ENDIF}
TAdditionCardinalFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Cardinal, Cardinal>)
public
function Call (AValue1, AValue2 : Cardinal) : Cardinal; override;
end;
TAdditionLongWordFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<LongWord, LongWord>)
public
function Call (AValue1, AValue2 : LongWord) : LongWord; override;
end;
TAdditionLongIntFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<LongInt, LongInt>)
public
function Call (AValue1, AValue2 : LongInt) : LongInt; override;
end;
{$IFDEF FPC}
TAdditionQWordFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<QWord, QWord>)
public
function Call (AValue1, AValue2 : QWord) : QWord; override;
end;
{$ENDIF}
TAdditionInt64Functor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Int64, Int64>)
public
function Call (AValue1, AValue2 : Int64) : Int64; override;
end;
TAdditionSingleFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Single, Single>)
public
function Call (AValue1, AValue2 : Single) : Single; override;
end;
TAdditionRealFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Real, Real>)
public
function Call (AValue1, AValue2 : Real) : Real; override;
end;
TAdditionDoubleFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Double, Double>)
public
function Call (AValue1, AValue2 : Double) : Double; override;
end;
TAdditionExtendedFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Extended, Extended>)
public
function Call (AValue1, AValue2 : Extended) : Extended; override;
end;
TAdditionCurrencyFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Currency, Currency>)
public
function Call (AValue1, AValue2 : Currency) : Currency; override;
end;
TAdditionStringFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<String, String>)
public
function Call (AValue1, AValue2 : String) : String; override;
end;
TAdditionWideStringFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<WideString, WideString>)
public
function Call (AValue1, AValue2 : WideString) : WideString; override;
end;
TMultiplicationByteFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Byte, Byte>)
public
function Call (AValue1, AValue2 : Byte) : Byte; override;
end;
TMultiplicationShortIntFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<ShortInt, ShortInt>)
public
function Call (AValue1, AValue2 : ShortInt) : ShortInt; override;
end;
TMultiplicationWordFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Word, Word>)
public
function Call (AValue1, AValue2 : Word) : Word; override;
end;
TMultiplicationSmallIntFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<SmallInt, SmallInt>)
public
function Call (AValue1, AValue2 : SmallInt) : SmallInt; override;
end;
TMultiplicationIntegerFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Integer, Integer>)
public
function Call (AValue1, AValue2 : Integer) : Integer; override;
end;
{$IFDEF FPC}
TMultiplicationDWordFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<DWord, DWord>)
public
function Call (AValue1, AValue2 : DWord) : DWord; override;
end;
{$ENDIF}
TMultiplicationCardinalFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Cardinal, Cardinal>)
public
function Call (AValue1, AValue2 : Cardinal) : Cardinal; override;
end;
TMultiplicationLongWordFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<LongWord, LongWord>)
public
function Call (AValue1, AValue2 : LongWord) : LongWord; override;
end;
TMultiplicationLongIntFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<LongInt, LongInt>)
public
function Call (AValue1, AValue2 : LongInt) : LongInt; override;
end;
{$IFDEF FPC}
TMultiplicationQWordFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<QWord, QWord>)
public
function Call (AValue1, AValue2 : QWord) : QWord; override;
end;
{$ENDIF}
TMultiplicationInt64Functor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Int64, Int64>)
public
function Call (AValue1, AValue2 : Int64) : Int64; override;
end;
TMultiplicationSingleFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Single, Single>)
public
function Call (AValue1, AValue2 : Single) : Single; override;
end;
TMultiplicationRealFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Real, Real>)
public
function Call (AValue1, AValue2 : Real) : Real; override;
end;
TMultiplicationDoubleFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Double, Double>)
public
function Call (AValue1, AValue2 : Double) : Double; override;
end;
TMultiplicationExtendedFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Extended, Extended>)
public
function Call (AValue1, AValue2 : Extended) : Extended; override;
end;
TMultiplicationCurrencyFunctor = class
({$IFDEF FPC}specialize{$ENDIF} TBinaryFunctor<Currency, Currency>)
public
function Call (AValue1, AValue2 : Currency) : Currency; override;
end;
implementation
{ TAccumulate }
constructor TAccumulate{$IFNDEF FPC}<V, Iterator, Functor>{$ENDIF}.Create
(AIterator : Iterator; AInitial : V);
var
Func : Functor;
begin
FValue := AInitial;
Func := Functor.Create;
while AIterator.MoveNext do
begin
FValue := Func.Call(FValue, AIterator.GetValue
{$IFDEF USE_OPTIONAL}.Unwrap{$ENDIF});
AIterator := AIterator.Next;
end;
FreeAndNil(Func);
end;
{ Accumulate functors. }
function TAdditionByteFunctor.Call (AValue1, AValue2 : Byte) : Byte;
begin
Result := AValue1 + AValue2;
end;
function TAdditionShortIntFunctor.Call (AValue1, AValue2 : ShortInt) : ShortInt;
begin
Result := AValue1 + AValue2;
end;
function TAdditionWordFunctor.Call (AValue1, AValue2 : Word) : Word;
begin
Result := AValue1 + AValue2;
end;
function TAdditionSmallIntFunctor.Call (AValue1, AValue2 : SmallInt) : SmallInt;
begin
Result := AValue1 + AValue2;
end;
function TAdditionIntegerFunctor.Call (AValue1, AValue2 : Integer) : Integer;
begin
Result := AValue1 + AValue2;
end;
{$IFDEF FPC}
function TAdditionDWordFunctor.Call (AValue1, AValue2 : DWord) : DWord;
begin
Result := AValue1 + AValue2;
end;
{$ENDIF}
function TAdditionCardinalFunctor.Call (AValue1, AValue2 : Cardinal) : Cardinal;
begin
Result := AValue1 + AValue2;
end;
function TAdditionLongWordFunctor.Call (AValue1, AValue2 : LongWord) : LongWord;
begin
Result := AValue1 + AValue2;
end;
function TAdditionLongIntFunctor.Call (AValue1, AValue2 : LongInt) : LongInt;
begin
Result := AValue1 + AValue2;
end;
{$IFDEF FPC}
function TAdditionQWordFunctor.Call (AValue1, AValue2 : QWord) : QWord;
begin
Result := AValue1 + AValue2;
end;
{$ENDIF}
function TAdditionInt64Functor.Call (AValue1, AValue2 : Int64) : Int64;
begin
Result := AValue1 + AValue2;
end;
function TAdditionSingleFunctor.Call (AValue1, AValue2 : Single) : Single;
begin
Result := AValue1 + AValue2;
end;
function TAdditionRealFunctor.Call (AValue1, AValue2 : Real) : Real;
begin
Result := AValue1 + AValue2;
end;
function TAdditionDoubleFunctor.Call (AValue1, AValue2 : Double) : Double;
begin
Result := AValue1 + AValue2;
end;
function TAdditionExtendedFunctor.Call (AValue1, AValue2 : Extended) : Extended;
begin
Result := AValue1 + AValue2;
end;
function TAdditionCurrencyFunctor.Call (AValue1, AValue2 : Currency) : Currency;
begin
Result := AValue1 + AValue2;
end;
function TAdditionStringFunctor.Call (AValue1, AValue2 : String) : String;
begin
Result := AValue1 + AValue2;
end;
function TAdditionWideStringFunctor.Call (AValue1, AValue2 : WideString) :
WideString;
begin
Result := AValue1 + AValue2;
end;
function TMultiplicationByteFunctor.Call (AValue1, AValue2 : Byte) : Byte;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationShortIntFunctor.Call (AValue1, AValue2 : ShortInt) :
ShortInt;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationWordFunctor.Call (AValue1, AValue2 : Word) : Word;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationSmallIntFunctor.Call (AValue1, AValue2 : SmallInt) :
SmallInt;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationIntegerFunctor.Call (AValue1, AValue2 : Integer) :
Integer;
begin
Result := AValue1 * AValue2;
end;
{$IFDEF FPC}
function TMultiplicationDWordFunctor.Call (AValue1, AValue2 : DWord) : DWord;
begin
Result := AValue1 * AValue2;
end;
{$ENDIF}
function TMultiplicationCardinalFunctor.Call (AValue1, AValue2 : Cardinal) :
Cardinal;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationLongWordFunctor.Call (AValue1, AValue2 : LongWord) :
LongWord;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationLongIntFunctor.Call (AValue1, AValue2 : LongInt) :
LongInt;
begin
Result := AValue1 * AValue2;
end;
{$IFDEF FPC}
function TMultiplicationQWordFunctor.Call (AValue1, AValue2 : QWord) : QWord;
begin
Result := AValue1 * AValue2;
end;
{$ENDIF}
function TMultiplicationInt64Functor.Call (AValue1, AValue2 : Int64) : Int64;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationSingleFunctor.Call (AValue1, AValue2 : Single) : Single;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationRealFunctor.Call (AValue1, AValue2 : Real) : Real;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationDoubleFunctor.Call (AValue1, AValue2 : Double) : Double;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationExtendedFunctor.Call (AValue1, AValue2 : Extended) :
Extended;
begin
Result := AValue1 * AValue2;
end;
function TMultiplicationCurrencyFunctor.Call (AValue1, AValue2 : Currency) :
Currency;
begin
Result := AValue1 * AValue2;
end;
{ TMap }
constructor TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.TIterator.Create
(AIterator : Iterator; AFunctor : Functor);
begin
FInnerIterator := AIterator;
FFunctor := AFunctor;
if AIterator.HasValue then
FValue := FFunctor.Call(AIterator.GetValue
{$IFDEF USE_OPTIONAL}.Unwrap{$ENDIF});
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.TIterator.HasValue :
Boolean;
begin
Result := FInnerIterator.HasValue;
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.TIterator.Next :
TIterator;
begin
Result := TIterator.Create(FInnerIterator.Next, FFunctor);
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.TIterator.MoveNext :
Boolean;
begin
Result := FInnerIterator.MoveNext;
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.TIterator.GetEnumerator
: TIterator;
begin
Result := TIterator.Create(FInnerIterator, FFunctor);
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.TIterator.GetValue :
{$IFNDEF USE_OPTIONAL}V{$ELSE}TOptionalValue{$ENDIF};
begin
Result := {$IFNDEF USE_OPTIONAL}FValue{$ELSE}TOptionalValue.Create(FValue)
{$ENDIF};
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.TIterator.GetCurrent :
TIterator;
begin
Result := TIterator.Create(FInnerIterator, FFunctor);
FInnerIterator := Iterator(FInnerIterator.Next);
if FInnerIterator.HasValue then
FValue := FFunctor.Call(FInnerIterator.GetValue
{$IFDEF USE_OPTIONAL}.Unwrap{$ENDIF});
end;
{ TMap }
constructor TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.Create
(AIterator : Iterator; AFunctor : Functor);
begin
FBaseIterator := AIterator;
FFunctor := AFunctor;
FIterator := TIterator.Create(AIterator, AFunctor);
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.MoveNext : Boolean;
begin
Result := FIterator.MoveNext;
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.GetEnumerator :
TIterator;
begin
Result := FIterator;
FIterator := FIterator.Next;
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.FirstEntry :
TIterator;
begin
Result := TIterator.Create(FBaseIterator, FFunctor);
end;
function TMap{$IFNDEF FPC}<V, Iterator; Functor>{$ENDIF}.GetCurrent :
TIterator;
begin
Result := FIterator;
end;
end.