-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4c85b6
commit bea5556
Showing
21 changed files
with
231 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2015-2018 Robert Rypuła - https://audio-network.rypula.pl | ||
|
||
import { IListFactory } from '../../common/list/list-factory.interface'; | ||
import { IList } from '../../common/list/list.interface'; | ||
import { IComplexFactory } from '../complex/complex-factory.interface'; | ||
import { IComplex, IComplexDto } from '../complex/complex.interface'; | ||
|
||
type IComplexListDto = IComplexDto[]; | ||
|
||
interface IComplexListUtil { | ||
fromDto(complexListDto: IComplexListDto): IList<IComplex>; | ||
// fromRawIQ(dto: number[]): IList<IComplex>; | ||
toDto(complexList: IList<IComplex>): IComplexListDto; | ||
// toRawIQ(list: IList<IComplex>): number[]; | ||
// isEqual(a: IList<IComplex>, b: IList<IComplex>): boolean; | ||
} | ||
|
||
interface IComplexListUtilStatic { | ||
new( | ||
complexFactory: IComplexFactory, | ||
listFactory: IListFactory | ||
): IComplexListUtil; | ||
} | ||
|
||
export { | ||
IComplexListDto, | ||
IComplexListUtil, | ||
IComplexListUtilStatic | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2015-2018 Robert Rypuła - https://audio-network.rypula.pl | ||
|
||
import { staticImplements } from 'rr-tsdi'; | ||
|
||
import { LIST_FACTORY } from '../../common/list/di-token'; | ||
import { IListFactory } from '../../common/list/list-factory.interface'; | ||
import { IList } from '../../common/list/list.interface'; | ||
import { IComplexFactory } from '../complex/complex-factory.interface'; | ||
import { IComplex, IComplexDto } from '../complex/complex.interface'; | ||
import { COMPLEX_FACTORY } from '../complex/di-token'; | ||
import { IComplexListDto, IComplexListUtil, IComplexListUtilStatic } from './complex-list-util.interface'; | ||
|
||
@staticImplements<IComplexListUtilStatic>() | ||
class ComplexListUtil implements IComplexListUtil { | ||
public static $inject: string[] = [ | ||
COMPLEX_FACTORY, | ||
LIST_FACTORY | ||
]; | ||
|
||
constructor( | ||
protected complexFactory: IComplexFactory, | ||
protected listFactory: IListFactory | ||
) { | ||
} | ||
|
||
public fromDto(complexListDto: IComplexListDto): IList<IComplex> { | ||
const tmp = complexListDto.map((complexDto: IComplexDto) => { | ||
return this.complexFactory.createFromDto(complexDto); | ||
}); | ||
|
||
return this.listFactory.createFromArray<IComplex>(tmp); | ||
} | ||
|
||
public toDto(complexList: IList<IComplex>): IComplexListDto { | ||
return complexList | ||
.toArray() | ||
.map( | ||
(value: IComplex): IComplexDto => { | ||
/* tslint:disable:object-literal-sort-keys */ | ||
return { | ||
real: value.getReal(), | ||
imaginary: value.getImaginary() | ||
}; | ||
/* tslint:enable:object-literal-sort-keys */ | ||
} | ||
); | ||
} | ||
} | ||
|
||
export default ComplexListUtil; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright (c) 2015-2018 Robert Rypuła - https://audio-network.rypula.pl | ||
|
||
export const COMPLEX_LIST_UTIL = 'COMPLEX_LIST_UTIL'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.