@bfchain/algorithm-stream-merger
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports[Symbol.toStringTag]="Module";class t{eq(t,e){return 0===this.compare(t,e)}gt(t,e){return this.compare(t,e)>0}gte(t,e){return this.compare(t,e)>=0}lt(t,e){return this.compare(t,e)<0}lte(t,e){return this.compare(t,e)<=0}}var e;function r(t,e){const r=(e,r)=>{if(t.lte(e.minByte,r.minByte)){if(t.gte(e.maxByte,r.maxByte))return{hasIntersection:!0,left:e,right:e};if(t.gte(e.maxByte,r.minByte))return{hasIntersection:!0,left:e,right:r}}};class s{constructor(e,r){if(this.items=e,e.length<=0)throw new Error("Bytes need at least 1 item.");if(void 0===r)if(e.length>1){const s=t.compare(e[e.length-1],e[0]);if(0===s)throw new Error("invalid order");r=s}else r=exports.ORDER.UP;this.order=r,this.length=this.items.length}at(t){return t<0?this.items[this.length+t]:this.items[t]}toArray(t){return t===this.order?this.items:this.items.slice().reverse()}get firstByte(){return this.at(0)}get lastByte(){return this.at(-1)}get minByte(){return this.order===exports.ORDER.UP?this.firstByte:this.lastByte}get maxByte(){return this.order===exports.ORDER.UP?this.lastByte:this.firstByte}checkMergeable(t){return r(this,t)||r(t,this)||{hasIntersection:!1}}merge(e,r=this.checkMergeable(e)){if(!r.hasIntersection)return;if(r.left===r.right)return r.left;const{left:i,right:n}=r,o=i.maxByte;for(let h=0;h<n.length;++h)if(t.eq(o,n.items[h])){return new s([...i.toArray(i.order),...n.toArray(i.order).slice(h+1)],i.order)}}get firstPoint(){return t.getPoint(this.firstByte)}get lastPoint(){return t.getPoint(this.lastByte)}get minPoint(){return t.getPoint(this.minByte)}get maxPoint(){return t.getPoint(this.maxByte)}checkWalkable(t){return e.lte(this.firstPoint,t)&&e.gte(this.lastPoint,t)}walk(r,i,n,o=this.checkWalkable(r)){if(!o)return;let h=0,l=this.length;i===exports.ORDER.DOWN&&(h=l-1,l=-1);const a=[],{isEnd:f,endReason:c}=((r,s,i)=>{const n=[],o=[];if(i){if(void 0!==i.endPoint){const h=i.endPoint,l=()=>{if(r.length){const i=t.getPoint(r[r.length-1]),n=e.compare(h,i);return n!==s&&(0!==n&&(r.length-=1),!0)}return!1};n.push(l),o.push((()=>l()?"endPoint":void 0))}const h=void 0!==i.offset&&i.offset>0&&Number.isFinite(i.offset)?Math.floor(i.offset):0;if(h>0){const t=()=>{if(r.length<h)return"offset"};o.push(t)}if(void 0!==i.limit&&i.limit>0&&Number.isFinite(i.limit)){const t=Math.floor(i.limit);n.push((()=>r.length>=h+t)),o.push((()=>{if(r.length>=h+t)return"limit"}))}}return{isEnd:()=>0!==n.length&&(1===n.length?n[0]():n.some((t=>t()))),endReason:()=>{if(0!==o.length){if(1===o.length)return o[0]();for(const t of o){const e=t();if(e)return e}}}}})(a,i,n);for(;h!==l&&!f();h+=i){const s=this.items[h],n=t.getPoint(s),o=e.compare(n,r);if(o===i||0===o){if(a.push(s),f())break;for(h+=i;h!==l&&!f();h+=i){const s=this.items[h],n=t.getPoint(s);if(e.compare(n,r)!==i)break;a.push(s)}break}}return{Bytes:new s(a,i),endReason:c()||"outRange"}}}return{Bytes:s}}exports.ORDER=void 0,(e=exports.ORDER||(exports.ORDER={}))[e.UP=1]="UP",e[e.DOWN=-1]="DOWN",e[e.FROM_START=1]="FROM_START",e[e.FROM_END=-1]="FROM_END",e[e.TO_END=1]="TO_END",e[e.TO_START=-1]="TO_START",exports.ByteToolkit=class extends t{},exports.PointToolkit=class extends t{},exports.StreamFactory=function(t,e){const{Bytes:s}=r(t,e);return{Stream:class{constructor(){this.desksSlices=[]}addBytes(e){if(0===this.desksSlices.length)return void this.desksSlices.push(e);const{desksSlices:r}=this,s=r.length-1;let i=0;for(;;){const n=r[i];if(t.lte(e.minByte,n.minByte)){if(i>0){const s=i-1,n=r[s];t.lte(e.minByte,n.maxByte)&&(i=s)}break}if(i===s){t.gt(e.minByte,n.maxByte)&&++i;break}++i}if(i>s)return void r.push(e);let n=i,o=e;for(;n<=s;++n){const t=r[n].merge(o);if(void 0===t)return void r.splice(i,n-i,o);o=t}r.length=i,r.push(o)}walkBytes(t,e,r){for(const s of this.desksSlices)if(s.checkWalkable(t))return s.walk(t,e,r,!0)}},Bytes:s}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports[Symbol.toStringTag]="Module";var e;function t(e){const t=(t,r)=>{if(e.lte(t.minFrame,r.minFrame)){if(e.gte(t.maxFrame,r.maxFrame))return{hasIntersection:!0,left:t,right:t};if(e.gte(t.maxFrame,r.minFrame))return{hasIntersection:!0,left:t,right:r}}};class r{constructor(t,r){if(this._items=t,t.length<=0)throw new Error("Fragment need at least 1 item.");if(void 0===r)if(t.length>1){const s=e.compare(t[t.length-1],t[0]);if(0===s)throw new Error("invalid order");r=s}else r=exports.ORDER.UP;this.order=r,this.length=t.length}at(e){return e<0?this._items[this.length+e]:this._items[e]}toArray(e){return e===this.order?this._items:this._reverse_items||(this._reverse_items=this._items.slice().reverse())}get firstFrame(){return this.at(0)}get lastFrame(){return this.at(-1)}get minFrame(){return this.order===exports.ORDER.UP?this.firstFrame:this.lastFrame}get maxFrame(){return this.order===exports.ORDER.UP?this.lastFrame:this.firstFrame}checkMergeable(e){return t(this,e)||t(e,this)||{hasIntersection:!1}}merge(t,s=this.checkMergeable(t)){if(!s.hasIntersection)return;if(s.left===s.right)return s.left;const{left:i,right:n}=s,o=i.maxFrame;for(let a=0;a<n.length;++a){const t=n.toArray(exports.ORDER.UP);if(e.eq(o,t[a])){return new r([...i.toArray(exports.ORDER.UP),...t.slice(a+1)],exports.ORDER.UP)}}}checkClipable(t){return e.lte(this.minFrame,t)&&e.lte(t,this.maxFrame)}clip(t,s,i,n){if(!n)return;const o=this.toArray(s),a=o.length,h=[],{isEnd:m,endReason:l}=((t,r,s)=>{const i=[],n=[];if(s){if(void 0!==s.endFrame){const o=s.endFrame,a=()=>{if(t.length){const s=t[t.length-1],i=e.compare(o,s);return i!==r&&(0!==i&&(t.length-=1),!0)}return!1};i.push(a),n.push((()=>a()?"endFrame":void 0))}const o=void 0!==s.offset&&s.offset>0&&Number.isFinite(s.offset)?Math.floor(s.offset):0;if(o>0){const e=()=>{if(t.length<o)return"offset"};n.push(e)}if(void 0!==s.limit&&s.limit>0&&Number.isFinite(s.limit)){const e=Math.floor(s.limit);i.push((()=>t.length>=o+e)),n.push((()=>{if(t.length>=o+e)return"limit"}))}}return{isEnd:0===i.length?()=>!1:1===i.length?i[0]:()=>i.some((e=>e())),endReason:0===n.length?()=>{}:1===n.length?n[0]:()=>{for(const e of n){const t=e();if(t)return t}}}})(h,s,i.end),{filter:c}=i,f=c?e=>{c(e)&&(h[h.length]=e)}:e=>{h[h.length]=e};for(let r=0;r<a&&!m();++r){const i=o[r],n=e.compare(i,t);if(n===s||0===n){if(f(i),m())break;for(++r;r!==a&&!m();++r){const i=o[r];if(e.compare(i,t)!==s)break;f(i)}break}}return{fragment:new r(h,s),endReason:l()||"outRange"}}}return{Fragment:r}}exports.ORDER=void 0,(e=exports.ORDER||(exports.ORDER={}))[e.UP=1]="UP",e[e.DOWN=-1]="DOWN",e[e.FROM_START=1]="FROM_START",e[e.FROM_END=-1]="FROM_END",e[e.TO_END=1]="TO_END",e[e.TO_START=-1]="TO_START",exports.FrameToolkit=class extends class{eq(e,t){return 0===this.compare(e,t)}gt(e,t){return this.compare(e,t)>0}gte(e,t){return this.compare(e,t)>=0}lt(e,t){return this.compare(e,t)<0}lte(e,t){return this.compare(e,t)<=0}}{},exports.StreamFactory=function(e){const{Fragment:r}=t(e);return{Stream:class{constructor(){this.desksSlices=[]}addFragment(t){if(0===this.desksSlices.length)return void this.desksSlices.push(t);const{desksSlices:r}=this,s=r.length-1;let i=0;for(;;){const n=r[i];if(e.lte(t.minFrame,n.minFrame)){if(i>0){const s=i-1,n=r[s];e.lte(t.minFrame,n.maxFrame)&&(i=s)}break}if(i===s){e.gt(t.minFrame,n.maxFrame)&&++i;break}++i}if(i>s)return void r.push(t);let n=i,o=t;for(;n<=s;++n){const e=r[n].merge(o);if(void 0===e)return void r.splice(i,n-i,o);o=e}r.length=i,r.push(o)}clipFragment(e,t,r={}){for(const s of this.desksSlices)if(s.checkClipable(e))return s.clip(e,t,r,!0)}},Fragment:r}}; |
@@ -1,1 +0,1 @@ | ||
class t{eq(t,e){return 0===this.compare(t,e)}gt(t,e){return this.compare(t,e)>0}gte(t,e){return this.compare(t,e)>=0}lt(t,e){return this.compare(t,e)<0}lte(t,e){return this.compare(t,e)<=0}}class e extends t{}class i extends t{}var r,s;function n(t,e){const i=(e,i)=>{if(t.lte(e.minByte,i.minByte)){if(t.gte(e.maxByte,i.maxByte))return{hasIntersection:!0,left:e,right:e};if(t.gte(e.maxByte,i.minByte))return{hasIntersection:!0,left:e,right:i}}};class s{constructor(e,i){if(this.items=e,e.length<=0)throw new Error("Bytes need at least 1 item.");if(void 0===i)if(e.length>1){const r=t.compare(e[e.length-1],e[0]);if(0===r)throw new Error("invalid order");i=r}else i=r.UP;this.order=i,this.length=this.items.length}at(t){return t<0?this.items[this.length+t]:this.items[t]}toArray(t){return t===this.order?this.items:this.items.slice().reverse()}get firstByte(){return this.at(0)}get lastByte(){return this.at(-1)}get minByte(){return this.order===r.UP?this.firstByte:this.lastByte}get maxByte(){return this.order===r.UP?this.lastByte:this.firstByte}checkMergeable(t){return i(this,t)||i(t,this)||{hasIntersection:!1}}merge(e,i=this.checkMergeable(e)){if(!i.hasIntersection)return;if(i.left===i.right)return i.left;const{left:r,right:n}=i,o=r.maxByte;for(let h=0;h<n.length;++h)if(t.eq(o,n.items[h])){return new s([...r.toArray(r.order),...n.toArray(r.order).slice(h+1)],r.order)}}get firstPoint(){return t.getPoint(this.firstByte)}get lastPoint(){return t.getPoint(this.lastByte)}get minPoint(){return t.getPoint(this.minByte)}get maxPoint(){return t.getPoint(this.maxByte)}checkWalkable(t){return e.lte(this.firstPoint,t)&&e.gte(this.lastPoint,t)}walk(i,n,o,h=this.checkWalkable(i)){if(!h)return;let l=0,a=this.length;n===r.DOWN&&(l=a-1,a=-1);const f=[],{isEnd:c,endReason:u}=((i,r,s)=>{const n=[],o=[];if(s){if(void 0!==s.endPoint){const h=s.endPoint,l=()=>{if(i.length){const s=t.getPoint(i[i.length-1]),n=e.compare(h,s);return n!==r&&(0!==n&&(i.length-=1),!0)}return!1};n.push(l),o.push((()=>l()?"endPoint":void 0))}const h=void 0!==s.offset&&s.offset>0&&Number.isFinite(s.offset)?Math.floor(s.offset):0;if(h>0){const t=()=>{if(i.length<h)return"offset"};o.push(t)}if(void 0!==s.limit&&s.limit>0&&Number.isFinite(s.limit)){const t=Math.floor(s.limit);n.push((()=>i.length>=h+t)),o.push((()=>{if(i.length>=h+t)return"limit"}))}}return{isEnd:()=>0!==n.length&&(1===n.length?n[0]():n.some((t=>t()))),endReason:()=>{if(0!==o.length){if(1===o.length)return o[0]();for(const t of o){const e=t();if(e)return e}}}}})(f,n,o);for(;l!==a&&!c();l+=n){const r=this.items[l],s=t.getPoint(r),o=e.compare(s,i);if(o===n||0===o){if(f.push(r),c())break;for(l+=n;l!==a&&!c();l+=n){const r=this.items[l],s=t.getPoint(r);if(e.compare(s,i)!==n)break;f.push(r)}break}}return{Bytes:new s(f,n),endReason:u()||"outRange"}}}return{Bytes:s}}function o(t,e){const{Bytes:i}=n(t,e);return{Stream:class{constructor(){this.desksSlices=[]}addBytes(e){if(0===this.desksSlices.length)return void this.desksSlices.push(e);const{desksSlices:i}=this,r=i.length-1;let s=0;for(;;){const n=i[s];if(t.lte(e.minByte,n.minByte)){if(s>0){const r=s-1,n=i[r];t.lte(e.minByte,n.maxByte)&&(s=r)}break}if(s===r){t.gt(e.minByte,n.maxByte)&&++s;break}++s}if(s>r)return void i.push(e);let n=s,o=e;for(;n<=r;++n){const t=i[n].merge(o);if(void 0===t)return void i.splice(s,n-s,o);o=t}i.length=s,i.push(o)}walkBytes(t,e,i){for(const r of this.desksSlices)if(r.checkWalkable(t))return r.walk(t,e,i,!0)}},Bytes:i}}(s=r||(r={}))[s.UP=1]="UP",s[s.DOWN=-1]="DOWN",s[s.FROM_START=1]="FROM_START",s[s.FROM_END=-1]="FROM_END",s[s.TO_END=1]="TO_END",s[s.TO_START=-1]="TO_START";export{e as ByteToolkit,r as ORDER,i as PointToolkit,o as StreamFactory}; | ||
class e extends class{eq(e,t){return 0===this.compare(e,t)}gt(e,t){return this.compare(e,t)>0}gte(e,t){return this.compare(e,t)>=0}lt(e,t){return this.compare(e,t)<0}lte(e,t){return this.compare(e,t)<=0}}{}var t,r;function i(e){const r=(t,r)=>{if(e.lte(t.minFrame,r.minFrame)){if(e.gte(t.maxFrame,r.maxFrame))return{hasIntersection:!0,left:t,right:t};if(e.gte(t.maxFrame,r.minFrame))return{hasIntersection:!0,left:t,right:r}}};class i{constructor(r,i){if(this._items=r,r.length<=0)throw new Error("Fragment need at least 1 item.");if(void 0===i)if(r.length>1){const t=e.compare(r[r.length-1],r[0]);if(0===t)throw new Error("invalid order");i=t}else i=t.UP;this.order=i,this.length=r.length}at(e){return e<0?this._items[this.length+e]:this._items[e]}toArray(e){return e===this.order?this._items:this._reverse_items||(this._reverse_items=this._items.slice().reverse())}get firstFrame(){return this.at(0)}get lastFrame(){return this.at(-1)}get minFrame(){return this.order===t.UP?this.firstFrame:this.lastFrame}get maxFrame(){return this.order===t.UP?this.lastFrame:this.firstFrame}checkMergeable(e){return r(this,e)||r(e,this)||{hasIntersection:!1}}merge(r,s=this.checkMergeable(r)){if(!s.hasIntersection)return;if(s.left===s.right)return s.left;const{left:n,right:a}=s,o=n.maxFrame;for(let h=0;h<a.length;++h){const r=a.toArray(t.UP);if(e.eq(o,r[h])){return new i([...n.toArray(t.UP),...r.slice(h+1)],t.UP)}}}checkClipable(t){return e.lte(this.minFrame,t)&&e.lte(t,this.maxFrame)}clip(t,r,s,n){if(!n)return;const a=this.toArray(r),o=a.length,h=[],{isEnd:m,endReason:l}=((t,r,i)=>{const s=[],n=[];if(i){if(void 0!==i.endFrame){const a=i.endFrame,o=()=>{if(t.length){const i=t[t.length-1],s=e.compare(a,i);return s!==r&&(0!==s&&(t.length-=1),!0)}return!1};s.push(o),n.push((()=>o()?"endFrame":void 0))}const a=void 0!==i.offset&&i.offset>0&&Number.isFinite(i.offset)?Math.floor(i.offset):0;if(a>0){const e=()=>{if(t.length<a)return"offset"};n.push(e)}if(void 0!==i.limit&&i.limit>0&&Number.isFinite(i.limit)){const e=Math.floor(i.limit);s.push((()=>t.length>=a+e)),n.push((()=>{if(t.length>=a+e)return"limit"}))}}return{isEnd:0===s.length?()=>!1:1===s.length?s[0]:()=>s.some((e=>e())),endReason:0===n.length?()=>{}:1===n.length?n[0]:()=>{for(const e of n){const t=e();if(t)return t}}}})(h,r,s.end),{filter:c}=s,f=c?e=>{c(e)&&(h[h.length]=e)}:e=>{h[h.length]=e};for(let i=0;i<o&&!m();++i){const s=a[i],n=e.compare(s,t);if(n===r||0===n){if(f(s),m())break;for(++i;i!==o&&!m();++i){const s=a[i];if(e.compare(s,t)!==r)break;f(s)}break}}return{fragment:new i(h,r),endReason:l()||"outRange"}}}return{Fragment:i}}function s(e){const{Fragment:t}=i(e);return{Stream:class{constructor(){this.desksSlices=[]}addFragment(t){if(0===this.desksSlices.length)return void this.desksSlices.push(t);const{desksSlices:r}=this,i=r.length-1;let s=0;for(;;){const n=r[s];if(e.lte(t.minFrame,n.minFrame)){if(s>0){const i=s-1,n=r[i];e.lte(t.minFrame,n.maxFrame)&&(s=i)}break}if(s===i){e.gt(t.minFrame,n.maxFrame)&&++s;break}++s}if(s>i)return void r.push(t);let n=s,a=t;for(;n<=i;++n){const e=r[n].merge(a);if(void 0===e)return void r.splice(s,n-s,a);a=e}r.length=s,r.push(a)}clipFragment(e,t,r={}){for(const i of this.desksSlices)if(i.checkClipable(e))return i.clip(e,t,r,!0)}},Fragment:t}}(r=t||(t={}))[r.UP=1]="UP",r[r.DOWN=-1]="DOWN",r[r.FROM_START=1]="FROM_START",r[r.FROM_END=-1]="FROM_END",r[r.TO_END=1]="TO_END",r[r.TO_START=-1]="TO_START";export{e as FrameToolkit,t as ORDER,s as StreamFactory}; |
{ | ||
"name": "@bfchain/algorithm-stream-merger", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "./dist/algorithm-stream-merger.cjs.js", | ||
@@ -24,3 +24,3 @@ "exports": { | ||
"test": "deno test", | ||
"test:debug": "ndb node_modules/ava/cli.js ./src/*" | ||
"test:debug": "deno test --inspect-brk" | ||
}, | ||
@@ -32,4 +32,5 @@ "dependencies": { | ||
"execa": "^5.1.1", | ||
"typescript-deno-plugin": "^1.31.0", | ||
"vite": "^2.5.1" | ||
} | ||
} |
@@ -7,5 +7,24 @@ # Algorithm Stream Merger | ||
定义了两个名词: | ||
定义了三个名词: | ||
1. Stream 流 | ||
1. Byte 一个信息基本单元 | ||
1. Frame 帧 | ||
1. Fragment 片段,由连续的帧组成 | ||
1. Stream 流,由不连续的片段拼接而成。是一个简单的片段管理器 | ||
这里最关键的概念是 Frame,也就是帧。 | ||
开发者可以自定义帧的概念是什么?并且通过定义: | ||
- 1. 如何对比两帧之间的顺序? | ||
1. 两帧是否是连续的? | ||
从而就能实现自动合并片段的功能 | ||
此外,还有一个方向的概念:`ORDER`,本项目中: | ||
1. `left`被定义为`start` | ||
1. `right`被定义为`end` | ||
1. `up`被定义为`to-right`/`from-left` | ||
1. `down`被定义为`to-left`/`from-right` | ||
1. `start`与`end` 的含义取决于 `order`。 | ||
1. `order`为`up`时,`start`为`left`,`end`为`right` | ||
1. `order`为`down`时,`start`为`right`,`end`为`left` |
declare namespace BFChainAlgorithm { | ||
interface Bytes<D, P> { | ||
interface Fragment<D> { | ||
readonly length: number; | ||
@@ -7,45 +7,49 @@ at(index: number): D | undefined; | ||
readonly order: import("./const").ORDER; | ||
readonly firstByte: D; | ||
readonly lastByte: D; | ||
readonly firstPoint: P; | ||
readonly lastPoint: P; | ||
readonly minByte: D; | ||
readonly maxByte: D; | ||
readonly minPoint: P; | ||
readonly maxPoint: P; | ||
checkMergeable(other: Bytes<D, P>): { | ||
readonly firstFrame: D; | ||
readonly lastFrame: D; | ||
readonly minFrame: D; | ||
readonly maxFrame: D; | ||
checkMergeable(other: Fragment<D>): { | ||
hasIntersection: true; | ||
left: Bytes<D, P>; | ||
right: Bytes<D, P>; | ||
left: Fragment<D>; | ||
right: Fragment<D>; | ||
} | { | ||
hasIntersection: false; | ||
}; | ||
merge(other: Bytes<D, P>, matedata?: ReturnType<Bytes<D, P>["checkMergeable"]>): Bytes<D, P> | undefined; | ||
checkWalkable(point: P): boolean; | ||
walk(startPoint: P, order: import("./const").ORDER, end?: Bytes.WalkEnd<P>, matedata?: ReturnType<Bytes<D, P>["checkWalkable"]>): Bytes.WalkResult<D, P>; | ||
merge(other: Fragment<D>, matedata?: ReturnType<Fragment<D>["checkMergeable"]>): Fragment<D> | undefined; | ||
checkClipable(frame: D): boolean; | ||
/** | ||
* 剪切片段 | ||
* @params end.offset 并不是skip的作用,它只是会影响 endReason 的判断。最终的长度会是 end.offset+end.limit | ||
*/ | ||
clip(startFrame: D, order: import("./const").ORDER, options: Fragment.ClipOptions<D>, matedata?: ReturnType<Fragment<D>["checkClipable"]>): Fragment.ClipResult<D>; | ||
} | ||
namespace Bytes { | ||
type WalkEnd<P> = { | ||
endPoint?: P; | ||
namespace Fragment { | ||
type ClipEnd<D> = { | ||
endFrame?: D; | ||
offset?: number; | ||
limit?: number; | ||
}; | ||
type EndReason = "endPoint" | "offset" | "limit" | "outRange"; | ||
type WalkResult<D, P> = { | ||
Bytes: Bytes<D, P>; | ||
endReason: Bytes.EndReason | false; | ||
type EndReason = "endFrame" | "offset" | "limit" | "outRange"; | ||
type ClipResult<D> = { | ||
fragment: Fragment<D>; | ||
endReason: Fragment.EndReason | false; | ||
} | undefined; | ||
type ClipOptions<D> = { | ||
end?: ClipEnd<D>; | ||
filter?: (item: D) => boolean; | ||
}; | ||
} | ||
interface BytesConstructor<D, P> { | ||
new (items: D[], order?: import("./const").ORDER): Bytes<D, P>; | ||
$TYPE: Bytes<D, P>; | ||
interface FragmentConstructor<D> { | ||
new (items: D[], order?: import("./const").ORDER): Fragment<D>; | ||
$TYPE: Fragment<D>; | ||
} | ||
interface Stream<D, P> { | ||
readonly desksSlices: BFChainAlgorithm.Bytes<D, P>[]; | ||
addBytes(newBytes: Bytes<D, P>): void; | ||
walkBytes(startPoint: P, order: import("./const").ORDER, end?: Bytes.WalkEnd<P>): Bytes.WalkResult<D, P>; | ||
interface Stream<D> { | ||
readonly desksSlices: BFChainAlgorithm.Fragment<D>[]; | ||
addFragment(newFragment: Fragment<D>): void; | ||
clipFragment(startFrame: D, order: import("./const").ORDER, options?: Fragment.ClipOptions<D>): Fragment.ClipResult<D>; | ||
} | ||
interface StreamConstructor<D, P> { | ||
new (): Stream<D, P>; | ||
interface StreamConstructor<D> { | ||
new (): Stream<D>; | ||
} | ||
} |
@@ -1,5 +0,5 @@ | ||
import { ByteToolkit, PointToolkit } from "./toolkit"; | ||
export declare function StreamFactory<D, P>(ByteToolkit: ByteToolkit<D, P>, pointToolkit: PointToolkit<P>): { | ||
Stream: BFChainAlgorithm.StreamConstructor<D, P>; | ||
Bytes: BFChainAlgorithm.BytesConstructor<D, P>; | ||
import { FrameToolkit } from "./toolkit"; | ||
export declare function StreamFactory<D>(frameToolkit: FrameToolkit<D>): { | ||
Stream: BFChainAlgorithm.StreamConstructor<D>; | ||
Fragment: BFChainAlgorithm.FragmentConstructor<D>; | ||
}; |
@@ -16,8 +16,5 @@ declare abstract class Comparable<T> { | ||
} | ||
/**使用toolkit,而不是直接封装成Byte这样的对象,目的是节省内存 */ | ||
export declare abstract class ByteToolkit<D, P> extends Comparable<D> { | ||
abstract getPoint(Byte: D): P; | ||
/**使用toolkit,而不是直接封装成Frame这样的对象,目的是节省内存 */ | ||
export declare abstract class FrameToolkit<D> extends Comparable<D> { | ||
} | ||
export declare abstract class PointToolkit<P> extends Comparable<P> { | ||
} | ||
export {}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13644
30
3