-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added wikitext task, added text-dataset for core, node and web, renam…
…ed task.taskId to task.id
- Loading branch information
1 parent
a25a9af
commit a0be7af
Showing
62 changed files
with
5,803 additions
and
3,310 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,67 @@ | ||
import { AggregatorBase } from './aggregator' | ||
|
||
export class AsyncInformant<T> { | ||
private _round = 0 | ||
private _currentNumberOfParticipants = 0 | ||
private _totalNumberOfParticipants = 0 | ||
private _averageNumberOfParticipants = 0 | ||
private _round = 0 | ||
private _currentNumberOfParticipants = 0 | ||
private _totalNumberOfParticipants = 0 | ||
private _averageNumberOfParticipants = 0 | ||
|
||
constructor ( | ||
private readonly aggregator: AggregatorBase<T> | ||
) {} | ||
constructor(private readonly aggregator: AggregatorBase<T>) {} | ||
Check failure on line 9 in discojs/discojs-core/src/async_informant.ts
|
||
|
||
update (): void { | ||
console.debug('before:') | ||
this.printAllInfos() | ||
if (this.round === 0 || this.round < this.aggregator.round) { | ||
this._round = this.aggregator.round | ||
this._currentNumberOfParticipants = this.aggregator.size | ||
this._averageNumberOfParticipants = this.totalNumberOfParticipants / this.round | ||
this._totalNumberOfParticipants += this.currentNumberOfParticipants | ||
} else { | ||
this._round = this.aggregator.round | ||
update(): void { | ||
Check failure on line 11 in discojs/discojs-core/src/async_informant.ts
|
||
console.debug('before:') | ||
this.printAllInfos() | ||
if (this.round === 0 || this.round < this.aggregator.round) { | ||
this._round = this.aggregator.round | ||
this._currentNumberOfParticipants = this.aggregator.size | ||
this._averageNumberOfParticipants = | ||
this.totalNumberOfParticipants / this.round | ||
this._totalNumberOfParticipants += this.currentNumberOfParticipants | ||
} else { | ||
this._round = this.aggregator.round | ||
} | ||
console.debug('after:') | ||
this.printAllInfos() | ||
} | ||
console.debug('after:') | ||
this.printAllInfos() | ||
} | ||
|
||
// Getter functions | ||
get round (): number { | ||
return this._round | ||
} | ||
// Getter functions | ||
get round(): number { | ||
return this._round | ||
} | ||
|
||
get currentNumberOfParticipants (): number { | ||
return this._currentNumberOfParticipants | ||
} | ||
get currentNumberOfParticipants(): number { | ||
return this._currentNumberOfParticipants | ||
} | ||
|
||
get totalNumberOfParticipants (): number { | ||
return this._totalNumberOfParticipants | ||
} | ||
get totalNumberOfParticipants(): number { | ||
return this._totalNumberOfParticipants | ||
} | ||
|
||
get averageNumberOfParticipants (): number { | ||
return this._averageNumberOfParticipants | ||
} | ||
get averageNumberOfParticipants(): number { | ||
return this._averageNumberOfParticipants | ||
} | ||
|
||
getAllStatistics (): Record< | ||
'round' | 'currentNumberOfParticipants' | 'totalNumberOfParticipants' | 'averageNumberOfParticipants', number | ||
> { | ||
return { | ||
round: this.round, | ||
currentNumberOfParticipants: this.currentNumberOfParticipants, | ||
totalNumberOfParticipants: this.totalNumberOfParticipants, | ||
averageNumberOfParticipants: this.averageNumberOfParticipants | ||
getAllStatistics(): Record< | ||
| 'round' | ||
| 'currentNumberOfParticipants' | ||
| 'totalNumberOfParticipants' | ||
| 'averageNumberOfParticipants', | ||
number | ||
> { | ||
return { | ||
round: this.round, | ||
currentNumberOfParticipants: this.currentNumberOfParticipants, | ||
totalNumberOfParticipants: this.totalNumberOfParticipants, | ||
averageNumberOfParticipants: this.averageNumberOfParticipants, | ||
} | ||
} | ||
} | ||
|
||
// Debug | ||
public printAllInfos (): void { | ||
console.debug('task:', this.aggregator.task.taskID) | ||
console.debug('round:', this.round) | ||
console.debug('participants:', this.currentNumberOfParticipants) | ||
console.debug('total:', this.totalNumberOfParticipants) | ||
console.debug('average:', this.averageNumberOfParticipants) | ||
} | ||
// Debug | ||
public printAllInfos(): void { | ||
console.debug('task:', this.aggregator.task.id) | ||
console.debug('round:', this.round) | ||
console.debug('participants:', this.currentNumberOfParticipants) | ||
console.debug('total:', this.totalNumberOfParticipants) | ||
console.debug('average:', this.averageNumberOfParticipants) | ||
} | ||
} |
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.