clean up code

This commit is contained in:
Philipp Kunz 2017-06-09 23:33:41 +02:00
parent c7336eedfb
commit 4721d8c9e6
10 changed files with 75 additions and 88 deletions

2
dist/index.js vendored
View File

@ -10,4 +10,4 @@ var taskbuffer_classes_taskspace_1 = require("./taskbuffer.classes.taskspace");
exports.Taskspace = taskbuffer_classes_taskspace_1.Taskspace;
// import for naming only
require("./taskbuffer.classes.helpers");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFFQUE2RDtBQUFyRCx5Q0FBQSxJQUFJLENBQUE7QUFDWiwrRUFBeUQ7QUFBakQsbURBQUEsU0FBUyxDQUFBO0FBQ2pCLHFGQUErRDtBQUF2RCx5REFBQSxZQUFZLENBQUE7QUFDcEIsK0VBQXlEO0FBQWpELG1EQUFBLFNBQVMsQ0FBQTtBQUVqQix5QkFBeUI7QUFDekIsd0NBQXFDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFFQUE0RDtBQUFwRCx5Q0FBQSxJQUFJLENBQUE7QUFDWiwrRUFBd0Q7QUFBaEQsbURBQUEsU0FBUyxDQUFBO0FBQ2pCLHFGQUE4RDtBQUF0RCx5REFBQSxZQUFZLENBQUE7QUFDcEIsK0VBQXdEO0FBQWhELG1EQUFBLFNBQVMsQ0FBQTtBQUVqQix5QkFBeUI7QUFDekIsd0NBQXFDIn0=

View File

@ -24,7 +24,7 @@ export declare class BufferRunner {
bufferMax: number;
running: boolean;
constructor(taskArg: Task);
private _run(x);
setBufferMax(bufferMaxArg: number): void;
trigger(x: any): Promise<any>;
private _run(x);
}

File diff suppressed because one or more lines are too long

View File

@ -29,9 +29,7 @@ class Task {
else {
return this.triggerUnBuffered(x);
}
;
}
;
/**
* trigger task unbuffered.
*/
@ -57,4 +55,4 @@ class Task {
}
}
exports.Task = Task;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXNrYnVmZmVyLmNsYXNzZXMudGFzay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGdEQUErQztBQUMvQyx3REFBdUQ7QUFNdkQ7SUFjRSxZQUFZLFVBT1g7UUFkRCx3QkFBd0I7UUFDeEIsWUFBTyxHQUFZLEtBQUssQ0FBQTtRQUN4QixpQkFBWSxHQUFHLElBQUksT0FBTyxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUM3QyxpQkFBWSxHQUFHLElBQUksT0FBTyxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUM3QyxTQUFJLEdBQVksSUFBSSxDQUFBO1FBQ1osV0FBTSxHQUFXLE9BQU8sQ0FBQTtRQVU5QixJQUFJLE9BQU8sR0FBRyxVQUFVLENBQUE7UUFDeEIsSUFBSSxDQUFDLFlBQVksR0FBRyxVQUFVLENBQUMsWUFBWSxDQUFBO1FBQzNDLElBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQTtRQUM5QixJQUFJLENBQUMsU0FBUyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUE7UUFDbEMsSUFBSSxDQUFDLElBQUksR0FBRyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7UUFDekIsSUFBSSxDQUFDLFFBQVEsR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFBO1FBQ2hDLElBQUksQ0FBQyxZQUFZLEN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QztZQUNOLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLGFBQWEsR0FBRyxRQUFRLEdBQUcsbUJBQW1CLENBQUMsQ0FBQTtRQUN6RSxDQUFDO0lBQ0gsQ0FBQztDQUNGO0FBbkVELG9CQW1FQyJ9

View File

@ -36,19 +36,16 @@ class Taskchain extends taskbuffer_classes_task_1.Task {
if (optionsArg.log === true) {
this._oraObject.start();
}
;
}
addTask(taskArg) {
this.taskArray.push(taskArg);
}
;
removeTask(taskArg) {
// TODO
// TODO:
}
;
shiftTask() {
// TODO:
}
;
}
exports.Taskchain = Taskchain;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2tjaGFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Rhc2tidWZmZXIuY2xhc3Nlcy50YXNrY2hhaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxnREFBZ0Q7QUFDaEQsdUVBQWlEO0FBR2pELGVBQXVCLFNBQVEsOEJBQUk7SUFHakMsWUFBWSxVQU1YO1FBQ0MsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQ2hDO1lBQ0UsSUFBSSxFQUFFLG1CQUFtQjtZQUN6QixHQUFHLEVBQUUsS0FBSztTQUNYLEVBQ0QsVUFBVSxFQUNWO1lBQ0UsWUFBWSxFQUFFLENBQUMsQ0FBTTtnQkFDbkIsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQSxDQUFDLHVDQUF1QztnQkFDcEUsSUFBSSxXQUFXLEdBQUcsQ0FBQyxDQUFBLENBQUMsaURBQWlEO2dCQUNyRSxJQUFJLFlBQVksR0FBRyxDQUFDLENBQUM7b0JBQ25CLEVBQUUsQ0FBQyxDQUFD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O2dCQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO1lBQ3JCLENBQUM7U0FDRixDQUNGLENBQUE7UUFDRCxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDZCxJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxTQUFTLENBQUE7UUFDckMsSUFBSSxDQUFDLFVBQVUsR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQTtRQUN2QyxFQUFFLENBQUMsQ0FBQyxVQUFVLENBQUMsR0FBRyxLQUFLLElBQUksQ0FBQyxDQUFDLENBQUM7WUFDNUIsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUN6QixDQUFDO0lBQ0gsQ0FBQztJQUNELE9BQU8sQ0FBRSxPQUFhO1FBQ3BCLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQzlCLENBQUM7SUFDRCxVQUFVLENBQUUsT0FBYTtRQUN2QixRQUFRO0lBQ1YsQ0FBQztJQUNELFNBQVM7UUFDUCxRQUFRO0lBQ1YsQ0FBQztDQUNGO0FBdkRELDhCQXVEQyJ9

View File

@ -1,7 +1,7 @@
export {Task,ITaskFunction} from './taskbuffer.classes.task';
export {Taskchain} from './taskbuffer.classes.taskchain';
export {Taskparallel} from './taskbuffer.classes.taskparallel';
export {Taskspace} from './taskbuffer.classes.taskspace';
export {Task,ITaskFunction} from './taskbuffer.classes.task'
export {Taskchain} from './taskbuffer.classes.taskchain'
export {Taskparallel} from './taskbuffer.classes.taskparallel'
export {Taskspace} from './taskbuffer.classes.taskspace'
// import for naming only
import './taskbuffer.classes.helpers'

View File

@ -1,4 +1,4 @@
import plugins = require('./taskbuffer.plugins');
import plugins = require('./taskbuffer.plugins')
import { Task, ITaskFunction } from './taskbuffer.classes.task'
export let emptyTaskFunction: ITaskFunction = function (x) {
@ -18,7 +18,6 @@ export let isTask = function (taskArg: Task): boolean {
}
}
export let isTaskTouched = (taskArg: Task, touchedTasksArray: Task[]): boolean => {
let result = false
for (let keyArg in touchedTasksArray) {
@ -79,7 +78,6 @@ export let runTask = function (taskArg: Task, optionsArg: { x?, touchedTasksArra
return done.promise
}
export interface cycleObject {
cycleCounter: number,
deferred: plugins.q.Deferred<any>
@ -90,8 +88,8 @@ export class CycleCounter {
cycleObjectArray: cycleObject[] = []
constructor(taskArg: Task) {
this.task = taskArg
};
getPromiseForCycle(cycleCountArg: number) {
}
getPromiseForCycle (cycleCountArg: number) {
let done = plugins.q.defer()
let cycleObject: cycleObject = {
cycleCounter: cycleCountArg,
@ -99,8 +97,8 @@ export class CycleCounter {
}
this.cycleObjectArray.push(cycleObject)
return done.promise
};
informOfCycle(x) {
}
informOfCycle (x) {
let newCycleObjectArray: cycleObject[] = []
this.cycleObjectArray.forEach(cycleObjectArg => {
cycleObjectArg.cycleCounter--
@ -108,7 +106,7 @@ export class CycleCounter {
cycleObjectArg.deferred.resolve(x)
} else {
newCycleObjectArray.push(cycleObjectArg)
};
}
})
this.cycleObjectArray = newCycleObjectArray
}
@ -122,8 +120,24 @@ export class BufferRunner {
running: boolean = false
constructor(taskArg: Task) {
this.task = taskArg
};
private _run(x) {
}
setBufferMax (bufferMaxArg: number) {
this.bufferMax = bufferMaxArg
}
trigger (x): Promise<any> {
if (!(this.bufferCounter >= this.bufferMax)) {
this.bufferCounter++
}
let returnPromise: Promise<any> = this.task.cycleCounter.getPromiseForCycle(this.bufferCounter + 1)
if (!this.running) {
this._run(x)
}
return returnPromise
}
private _run (x) {
let recursiveBufferRunner = (x) => {
if (this.bufferCounter >= 0) {
this.running = true
@ -140,18 +154,6 @@ export class BufferRunner {
}
}
recursiveBufferRunner(x)
};
setBufferMax(bufferMaxArg: number) {
this.bufferMax = bufferMaxArg
};
trigger(x): Promise<any> {
if (!(this.bufferCounter >= this.bufferMax)) {
this.bufferCounter++
};
let returnPromise: Promise<any> = this.task.cycleCounter.getPromiseForCycle(this.bufferCounter + 1)
if (!this.running) {
this._run(x)
}
return returnPromise
};
};
}

View File

@ -2,11 +2,11 @@ import * as plugins from './taskbuffer.plugins'
import * as helpers from './taskbuffer.classes.helpers'
export interface ITaskFunction {
(x?: any): PromiseLike<any>;
(x?: any): PromiseLike<any>
}
export class Task {
name: string;
name: string
taskFunction: ITaskFunction
buffered: boolean
preTask: Task
@ -40,33 +40,32 @@ export class Task {
/**
* trigger the task. Will trigger buffered if this.buffered is true
*/
trigger(x?): Promise<any> {
trigger (x?): Promise<any> {
if (this.buffered) {
return this.triggerBuffered(x)
}
else {
} else {
return this.triggerUnBuffered(x)
};
};
}
}
/**
* trigger task unbuffered.
*/
triggerUnBuffered(x?): Promise<any> {
triggerUnBuffered (x?): Promise<any> {
return helpers.runTask(this, { x: x })
}
/**
* trigger task buffered.
*/
triggerBuffered(x?): Promise<any> {
triggerBuffered (x?): Promise<any> {
return this.bufferRunner.trigger(x)
}
get state(): string {
get state (): string {
return this._state
}
set state(stateArg: string) {
set state (stateArg: string) {
if (stateArg === 'locked') {
this._state = 'locked'
} else {

View File

@ -1,6 +1,6 @@
import * as plugins from './taskbuffer.plugins';
import { Task } from './taskbuffer.classes.task';
import helpers = require('./taskbuffer.classes.helpers');
import * as plugins from './taskbuffer.plugins'
import { Task } from './taskbuffer.classes.task'
import helpers = require('./taskbuffer.classes.helpers')
export class Taskchain extends Task {
taskArray: Task[]
@ -46,15 +46,15 @@ export class Taskchain extends Task {
this._oraObject = plugins.beautylog.ora
if (optionsArg.log === true) {
this._oraObject.start()
};
}
addTask(taskArg: Task) {
}
addTask (taskArg: Task) {
this.taskArray.push(taskArg)
};
removeTask(taskArg: Task) {
// TODO
};
shiftTask() {
};
}
removeTask (taskArg: Task) {
// TODO:
}
shiftTask () {
// TODO:
}
}