New Test-Startegy
This commit is contained in:
@@ -89,6 +89,15 @@ type
|
||||
constructor Create(const AFunc: TConstFunc<S, T>);
|
||||
end;
|
||||
|
||||
TMycGenericAggregator<S, T> = class(TMycConverter<S, T>)
|
||||
private
|
||||
FFunc: TConstFunc<S, TConverter<S, T>.TBroadcastProc, TState>;
|
||||
protected
|
||||
function ProcessData(const Value: S): TState; override;
|
||||
public
|
||||
constructor Create(const AFunc: TConstFunc<S, TConverter<S, T>.TBroadcastProc, TState>);
|
||||
end;
|
||||
|
||||
TMycGenericParallelConverter<S, T> = class(TMycConverter<S, T>)
|
||||
private
|
||||
FFunc: TConstFunc<S, T>;
|
||||
@@ -235,6 +244,17 @@ type
|
||||
property Sender: TMycContainedDataProvider<TArray<T>> read FSender implements TDataProvider<TArray<T>>.IDataProvider;
|
||||
end;
|
||||
|
||||
TMycComposedConverter<S, T> = class(TMycProcessor<S>, TConverter<S, T>.IConverter)
|
||||
private
|
||||
FProcessor: IMycProcessor<S>;
|
||||
FDataProvider: TDataProvider<T>;
|
||||
protected
|
||||
function ProcessData(const Value: S): TState; override;
|
||||
function GetSender: TDataProvider<T>.IDataProvider;
|
||||
public
|
||||
constructor Create(const AProcessor: IMycProcessor<S>; const ADataProvider: TDataProvider<T>);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@@ -892,4 +912,32 @@ begin
|
||||
FSender.Broadcast(Arr);
|
||||
end;
|
||||
|
||||
constructor TMycGenericAggregator<S, T>.Create(const AFunc: TConstFunc<S, TConverter<S, T>.TBroadcastProc, TState>);
|
||||
begin
|
||||
inherited Create;
|
||||
FFunc := AFunc;
|
||||
end;
|
||||
|
||||
function TMycGenericAggregator<S, T>.ProcessData(const Value: S): TState;
|
||||
begin
|
||||
Result := FFunc(Value, function(const Value: T): TState begin Result := FSender.Broadcast(Value); end);
|
||||
end;
|
||||
|
||||
constructor TMycComposedConverter<S, T>.Create(const AProcessor: IMycProcessor<S>; const ADataProvider: TDataProvider<T>);
|
||||
begin
|
||||
inherited Create;
|
||||
FProcessor := AProcessor;
|
||||
FDataProvider := ADataProvider;
|
||||
end;
|
||||
|
||||
function TMycComposedConverter<S, T>.GetSender: TDataProvider<T>.IDataProvider;
|
||||
begin
|
||||
Result := FDataProvider;
|
||||
end;
|
||||
|
||||
function TMycComposedConverter<S, T>.ProcessData(const Value: S): TState;
|
||||
begin
|
||||
Result := FProcessor.ProcessData(Value);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user