@@ -18,7 +18,7 @@ import { BitState, DigitalChannelStates, TimestampType } from './dataTypes';
1818
1919export interface BitDataAccumulator {
2020 bitDataStorage : BitDataStorage ;
21- accumulator : Array < BitState | null > ;
21+ accumulatedBitStates : Array < BitState | null > ;
2222 digitalChannelsToCompute : number [ ] | undefined ;
2323 initialise : ( digitalChannelsToCompute : number [ ] ) => void ;
2424 processBits : ( bits : number ) => void ;
@@ -29,15 +29,15 @@ export interface BitDataAccumulator {
2929
3030export default ( ) : BitDataAccumulator => ( {
3131 bitDataStorage : bitDataStorage ( ) ,
32- accumulator : new Array ( numberOfDigitalChannels ) ,
32+ accumulatedBitStates : new Array ( numberOfDigitalChannels ) ,
3333 digitalChannelsToCompute : undefined as number [ ] | undefined ,
3434
3535 initialise ( digitalChannelsToCompute ) {
3636 this . bitDataStorage . initialise ( digitalChannelsToCompute ) ;
3737 this . digitalChannelsToCompute = digitalChannelsToCompute ;
3838 // .fill is slower then a normal for loop when array is large
39- for ( let i = 0 ; i < this . accumulator . length ; i += 1 ) {
40- this . accumulator [ i ] = null ;
39+ for ( let i = 0 ; i < this . accumulatedBitStates . length ; i += 1 ) {
40+ this . accumulatedBitStates [ i ] = null ;
4141 }
4242 } ,
4343
@@ -49,26 +49,28 @@ export default (): BitDataAccumulator => ({
4949 } ,
5050
5151 processBitState ( bitState , channel ) {
52- if ( this . accumulator [ channel ] === null ) {
53- this . accumulator [ channel ] = bitState ;
52+ if ( this . accumulatedBitStates [ channel ] === null ) {
53+ this . accumulatedBitStates [ channel ] = bitState ;
5454 } else if (
55- ( this . accumulator [ channel ] === always1 && bitState !== always1 ) ||
56- ( this . accumulator [ channel ] === always0 && bitState !== always0 )
55+ ( this . accumulatedBitStates [ channel ] === always1 &&
56+ bitState !== always1 ) ||
57+ ( this . accumulatedBitStates [ channel ] === always0 &&
58+ bitState !== always0 )
5759 ) {
58- this . accumulator [ channel ] = sometimes0And1 ;
60+ this . accumulatedBitStates [ channel ] = sometimes0And1 ;
5961 }
6062 } ,
6163
6264 processAccumulatedBits ( timestamp ) {
6365 this . digitalChannelsToCompute ! . forEach ( i => {
64- const bitState = this . accumulator [ i ] ;
66+ const bitState = this . accumulatedBitStates [ i ] ;
6567 if ( bitState != null )
6668 this . bitDataStorage . storeBit ( timestamp , i , bitState ) ;
6769 } ) ;
6870
6971 // .fill is slower then a normal for loop when array is large
70- for ( let i = 0 ; i < this . accumulator . length ; i += 1 ) {
71- this . accumulator [ i ] = null ;
72+ for ( let i = 0 ; i < this . accumulatedBitStates . length ; i += 1 ) {
73+ this . accumulatedBitStates [ i ] = null ;
7274 }
7375 } ,
7476
0 commit comments