diff options
| author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 20:21:29 +0000 | 
|---|---|---|
| committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 20:21:29 +0000 | 
| commit | 61cb1570a3410c85a4489b97c172e3a50715f36c (patch) | |
| tree | 8fe4a5b77ea54bba80abc817ce2c9ef0e79e7e66 /sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js | |
| parent | 21a53d349788c99d2007cba91a923db982353b31 (diff) | |
| parent | a9ee9e0a500a4a15bd0b5dcaf041f827228ed309 (diff) | |
Merge branch 'researchML' into 'dev'
Research ml
See merge request igrannonica/neuronstellar!6
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js')
| -rw-r--r-- | sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js | 140 | 
1 files changed, 140 insertions, 0 deletions
| diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js new file mode 100644 index 00000000..b5815892 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js @@ -0,0 +1,140 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isContentAction = exports.ActionList = exports.UnknownActionException = void 0; +const core_1 = require("@angular-devkit/core"); +class UnknownActionException extends core_1.BaseException { +    constructor(action) { +        super(`Unknown action: "${action.kind}".`); +    } +} +exports.UnknownActionException = UnknownActionException; +let _id = 1; +class ActionList { +    constructor() { +        this._actions = []; +    } +    _action(action) { +        var _a, _b; +        this._actions.push({ +            ...action, +            id: _id++, +            parent: (_b = (_a = this._actions[this._actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 0, +        }); +    } +    create(path, content) { +        this._action({ kind: 'c', path, content }); +    } +    overwrite(path, content) { +        this._action({ kind: 'o', path, content }); +    } +    rename(path, to) { +        this._action({ kind: 'r', path, to }); +    } +    delete(path) { +        this._action({ kind: 'd', path }); +    } +    optimize() { +        const toCreate = new Map(); +        const toRename = new Map(); +        const toOverwrite = new Map(); +        const toDelete = new Set(); +        for (const action of this._actions) { +            switch (action.kind) { +                case 'c': +                    toCreate.set(action.path, action.content); +                    break; +                case 'o': +                    if (toCreate.has(action.path)) { +                        toCreate.set(action.path, action.content); +                    } +                    else { +                        toOverwrite.set(action.path, action.content); +                    } +                    break; +                case 'd': +                    toDelete.add(action.path); +                    break; +                case 'r': +                    const maybeCreate = toCreate.get(action.path); +                    const maybeOverwrite = toOverwrite.get(action.path); +                    if (maybeCreate) { +                        toCreate.delete(action.path); +                        toCreate.set(action.to, maybeCreate); +                    } +                    if (maybeOverwrite) { +                        toOverwrite.delete(action.path); +                        toOverwrite.set(action.to, maybeOverwrite); +                    } +                    let maybeRename = undefined; +                    for (const [from, to] of toRename.entries()) { +                        if (to == action.path) { +                            maybeRename = from; +                            break; +                        } +                    } +                    if (maybeRename) { +                        toRename.set(maybeRename, action.to); +                    } +                    if (!maybeCreate && !maybeOverwrite && !maybeRename) { +                        toRename.set(action.path, action.to); +                    } +                    break; +            } +        } +        this._actions = []; +        toDelete.forEach((x) => { +            this.delete(x); +        }); +        toRename.forEach((to, from) => { +            this.rename(from, to); +        }); +        toCreate.forEach((content, path) => { +            this.create(path, content); +        }); +        toOverwrite.forEach((content, path) => { +            this.overwrite(path, content); +        }); +    } +    push(action) { +        this._actions.push(action); +    } +    get(i) { +        return this._actions[i]; +    } +    has(action) { +        for (let i = 0; i < this._actions.length; i++) { +            const a = this._actions[i]; +            if (a.id == action.id) { +                return true; +            } +            if (a.id > action.id) { +                return false; +            } +        } +        return false; +    } +    find(predicate) { +        return this._actions.find(predicate) || null; +    } +    forEach(fn, thisArg) { +        this._actions.forEach(fn, thisArg); +    } +    get length() { +        return this._actions.length; +    } +    [Symbol.iterator]() { +        return this._actions[Symbol.iterator](); +    } +} +exports.ActionList = ActionList; +function isContentAction(action) { +    return action.kind == 'c' || action.kind == 'o'; +} +exports.isContentAction = isContentAction; | 
