TMutable
This commit is contained in:
+4
-27
@@ -62,7 +62,7 @@ type
|
||||
protected
|
||||
function GetValue: T; virtual; abstract;
|
||||
public
|
||||
constructor Create(const AChanged: TState);
|
||||
constructor Create(const AChanged: TSignal);
|
||||
destructor Destroy; override;
|
||||
function Pop(out Res: T): Boolean;
|
||||
end;
|
||||
@@ -73,16 +73,7 @@ type
|
||||
protected
|
||||
function GetValue: T; override;
|
||||
public
|
||||
constructor Create(const AChanged: TState; const AProc: TFunc<T>);
|
||||
end;
|
||||
|
||||
TMycChainedLazy<T> = class(TMycLazyBase<T>)
|
||||
private
|
||||
FValue: TLazy<T>.ILazy;
|
||||
protected
|
||||
function GetValue: T; override;
|
||||
public
|
||||
constructor Create(const AValue: TLazy<T>.ILazy);
|
||||
constructor Create(const AChanged: TSignal.ISignal; const AProc: TFunc<T>);
|
||||
end;
|
||||
|
||||
implementation
|
||||
@@ -159,7 +150,7 @@ end;
|
||||
|
||||
{ TMycLazyBase<T> }
|
||||
|
||||
constructor TMycLazyBase<T>.Create(const AChanged: TState);
|
||||
constructor TMycLazyBase<T>.Create(const AChanged: TSignal);
|
||||
begin
|
||||
inherited Create;
|
||||
FChanged := TFlag.CreateFlag;
|
||||
@@ -189,7 +180,7 @@ end;
|
||||
|
||||
{ TMycFuncLazy<T> }
|
||||
|
||||
constructor TMycFuncLazy<T>.Create(const AChanged: TState; const AProc: TFunc<T>);
|
||||
constructor TMycFuncLazy<T>.Create(const AChanged: TSignal.ISignal; const AProc: TFunc<T>);
|
||||
begin
|
||||
inherited Create(AChanged);
|
||||
FProc := AProc;
|
||||
@@ -201,20 +192,6 @@ begin
|
||||
Result := FProc();
|
||||
end;
|
||||
|
||||
{ TMycChainedLazy<T> }
|
||||
|
||||
constructor TMycChainedLazy<T>.Create(const AValue: TLazy<T>.ILazy);
|
||||
begin
|
||||
inherited Create(AValue.Changed);
|
||||
FValue := AValue;
|
||||
end;
|
||||
|
||||
function TMycChainedLazy<T>.GetValue: T;
|
||||
begin
|
||||
if not FValue.Pop(Result) then
|
||||
raise Exception.Create('Lazy chain already popped');
|
||||
end;
|
||||
|
||||
constructor TMycFuncMutable<T>.Create(const AChanged: TSignal; const AProc: TFunc<T>);
|
||||
begin
|
||||
inherited Create(AChanged);
|
||||
|
||||
Reference in New Issue
Block a user