Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

astl

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astl - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

experimental/container/FlatMap.ts

87

container/Deque.ts
import { Vector } from "./Vector";
import { ReverseIterator as ReverseBase } from "../internal/iterator/ReverseIterator";
import { ReverseIteratorBase } from "../internal/iterator/ReverseIteratorBase";

@@ -465,3 +465,3 @@ import { CMath } from "../internal/numeric/CMath";

@inline()
public source(): Deque<T>
public source(): Vector<T>
{

@@ -478,4 +478,19 @@ return this.source_;

@inline()
public get value(): T
{
return this.source_.at(this.index_);
}
@inline()
public set value(val: T)
{
this.source_.set(this.index_, val);
}
/* ---------------------------------------------------------
OPERATORS
--------------------------------------------------------- */
@inline()
@operator("==")
public equals(obj: Deque.Iterator<T>): boolean
public equals(obj: Iterator<T>): boolean
{

@@ -485,6 +500,13 @@ return this.source_ === obj.source_

}
@inline()
@operator("<")
public less(obj: Iterator<T>): boolean
{
return this.index_ < obj.index_;
}
@inline()
@operator("!=")
public __not_equals(obj: Deque.Iterator<T>): boolean
protected __not_equals(obj: Iterator<T>): boolean
{

@@ -495,15 +517,29 @@ return !this.equals(obj);

@inline()
public get value(): T
@operator("<=")
protected __less_equals(obj: Iterator<T>): boolean
{
return this.source_.at(this.index_);
return this.source_ === obj.source_ && this.index_ <= obj.index_;
}
public set value(val: T)
@inline()
@operator(">")
protected __greater(obj: Iterator<T>): boolean
{
this.source_.set(this.index_, val);
return this.index_ > obj.index_;
}
@inline()
@operator(">=")
protected __greater_equals(obj: Iterator<T>): boolean
{
return this.source_ === obj.source_ && this.index_ >= obj.index_;
}
}
export class ReverseIterator<T>
extends ReverseBase<T, Deque<T>, Deque<T>, Iterator<T>, ReverseIterator<T>, T>
extends ReverseIteratorBase<T, Deque<T>, Deque<T>, Iterator<T>, ReverseIterator<T>, T>
{
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
@inline()

@@ -526,2 +562,4 @@ public advance(n: isize): ReverseIterator<T>

}
@inline()
public set value(val: T)

@@ -531,3 +569,34 @@ {

}
/* ---------------------------------------------------------
OPERATORS
--------------------------------------------------------- */
@inline()
@operator("<")
public less(obj: ReverseIterator<T>): boolean
{
return this.index() > obj.index();
}
@inline()
@operator("<=")
protected __less_equals(obj: ReverseIterator<T>): boolean
{
return this.source() === obj.source() && this.index() >= obj.index();
}
@inline()
@operator(">")
protected __greater(obj: ReverseIterator<T>): boolean
{
return this.index() < obj.index();
}
@inline()
@operator(">=")
protected __greater_equals(obj: ReverseIterator<T>): boolean
{
return this.source() === obj.source() && this.index() <= obj.index();
}
}
}

8

container/ForwardList.ts

@@ -73,3 +73,3 @@ import { IForwardIterator } from "../iterator/IForwardIterator";

it.value = val;
ForwardList.Iterator.set_next<T>(pos, it);
ForwardList.Iterator._Set_next<T>(pos, it);

@@ -108,3 +108,3 @@ ++this.size_;

this.size_ -= distance(first, last);
ForwardList.Iterator.set_next<T>(first, last);
ForwardList.Iterator._Set_next<T>(first, last);

@@ -163,2 +163,3 @@ return last;

@inline()
public static _Create<T>(sourcePtr: SourcePointer<ForwardList<T>>, next: Iterator<T> | null): ForwardList.Iterator<T>

@@ -170,3 +171,3 @@ {

@inline()
public static set_next<T>(it: Iterator<T>, next: Iterator<T>): void
public static _Set_next<T>(it: Iterator<T>, next: Iterator<T>): void
{

@@ -199,2 +200,3 @@ it.next_ = next;

@inline()
public set value(val: T)

@@ -201,0 +203,0 @@ {

@@ -28,2 +28,3 @@ import { MapElementList } from "../internal/container/associative/MapElementList";

@inline()
public clear(): void

@@ -34,3 +35,18 @@ {

}
public swap(obj: HashMap<Key, T>): void
{
// SWAP ELEMENTS
this.data_.swap(obj.data_);
const data: MapElementList<Key, T, true, HashMap<Key, T>> = this.data_;
this.data_ = obj.data_;
obj.data_ = data;
// SWAP BUCKETS
const buckets: IteratorHashBuckets<Key, HashMap.Iterator<Key, T>> = this.buckets_;
this.buckets_ = obj.buckets_;
obj.buckets_ = buckets;
}
/* ---------------------------------------------------------

@@ -37,0 +53,0 @@ ACCESSORS

@@ -27,2 +27,3 @@ import { MapElementList } from "../internal/container/associative/MapElementList";

@inline()
public clear(): void

@@ -34,5 +35,21 @@ {

public swap(obj: HashMultiMap<Key, T>): void
{
// SWAP ELEMENTS
this.data_.swap(obj.data_);
const data: MapElementList<Key, T, true, HashMultiMap<Key, T>> = this.data_;
this.data_ = obj.data_;
obj.data_ = data;
// SWAP BUCKETS
const buckets: IteratorHashBuckets<Key, HashMultiMap.Iterator<Key, T>> = this.buckets_;
this.buckets_ = obj.buckets_;
obj.buckets_ = buckets;
}
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
@inline()
public size(): usize

@@ -43,2 +60,3 @@ {

@inline()
public empty(): boolean

@@ -49,2 +67,3 @@ {

@inline()
public begin(): HashMultiMap.Iterator<Key, T>

@@ -55,2 +74,3 @@ {

@inline()
public end(): HashMultiMap.Iterator<Key, T>

@@ -61,2 +81,3 @@ {

@inline()
public rbegin(): HashMultiMap.ReverseIterator<Key, T>

@@ -67,2 +88,3 @@ {

@inline()
public rend(): HashMultiMap.ReverseIterator<Key, T>

@@ -73,2 +95,3 @@ {

@inline()
public find(key: Key): HashMultiMap.Iterator<Key, T>

@@ -80,2 +103,3 @@ {

@inline()
public has(key: Key): boolean

@@ -99,2 +123,3 @@ {

@inline()
public hash_function(): Hasher<Key>

@@ -105,2 +130,3 @@ {

@inline()
public key_eq(): BinaryPredicator<Key>

@@ -111,2 +137,3 @@ {

@inline()
public bucket(key: Key): usize

@@ -117,2 +144,3 @@ {

@inline()
public bucket_count(): usize

@@ -123,2 +151,3 @@ {

@inline()
public bucket_size(index: usize): usize

@@ -129,2 +158,3 @@ {

@inline()
public load_factor(): usize

@@ -135,2 +165,3 @@ {

@inline()
public max_load_factor(): f64

@@ -141,2 +172,3 @@ {

@inline()
public set_max_load_factor(z: f64): void

@@ -147,2 +179,3 @@ {

@inline()
public reserve(n: usize): void

@@ -153,2 +186,3 @@ {

@inline()
public rehash(n: usize): void

@@ -162,2 +196,3 @@ {

--------------------------------------------------------- */
@inline()
public emplace(key: Key, value: T): HashMultiMap.Iterator<Key, T>

@@ -164,0 +199,0 @@ {

@@ -25,2 +25,3 @@ import { SetElementList } from "../internal/container/associative/SetElementList";

@inline()
public clear(): void

@@ -32,2 +33,17 @@ {

public swap(obj: HashMultiSet<Key>): void
{
// SWAP ELEMENTS
this.data_.swap(obj.data_);
const data: SetElementList<Key, true, HashMultiSet<Key>> = this.data_;
this.data_ = obj.data_;
obj.data_ = data;
// SWAP BUCKETS
const buckets: IteratorHashBuckets<Key, HashMultiSet.Iterator<Key>> = this.buckets_;
this.buckets_ = obj.buckets_;
obj.buckets_ = buckets;
}
/* ---------------------------------------------------------

@@ -34,0 +50,0 @@ ACCESSORS

@@ -25,2 +25,3 @@ import { SetElementList } from "../internal/container/associative/SetElementList";

@inline()
public clear(): void

@@ -32,2 +33,17 @@ {

public swap(obj: HashSet<Key>): void
{
// SWAP ELEMENTS
this.data_.swap(obj.data_);
const data: SetElementList<Key, true, HashSet<Key>> = this.data_;
this.data_ = obj.data_;
obj.data_ = data;
// SWAP BUCKETS
const buckets: IteratorHashBuckets<Key, HashSet.Iterator<Key>> = this.buckets_;
this.buckets_ = obj.buckets_;
obj.buckets_ = buckets;
}
/* ---------------------------------------------------------

@@ -34,0 +50,0 @@ ACCESSORS

import { IForwardIterator } from "../iterator/IForwardIterator";
import { ReverseIterator as ReverseBase } from "../internal/iterator/ReverseIterator";
import { ReverseIteratorBase as ReverseBase } from "../internal/iterator/ReverseIteratorBase";

@@ -434,2 +434,4 @@ import { Repeater } from "../internal/iterator/disposable/Repeater";

}
@inline()
public set value(val: T)

@@ -461,2 +463,4 @@ {

}
@inline()
public set value(val: T)

@@ -463,0 +467,0 @@ {

@@ -33,2 +33,17 @@ import { MapElementList } from "../internal/container/associative/MapElementList";

public swap(obj: TreeMap<Key, T>): void
{
// SWAP ELEMENTS
this.data_.swap(obj.data_);
const data: MapElementList<Key, T, true, TreeMap<Key, T>> = this.data_;
this.data_ = obj.data_;
obj.data_ = data;
// SWAP TREE
const tree: IteratorTree<Key, TreeMap.Iterator<Key, T>> = this.tree_;
this.tree_ = obj.tree_;
obj.tree_ = tree;
}
/* ---------------------------------------------------------

@@ -35,0 +50,0 @@ ACCESSORS

@@ -34,6 +34,15 @@ import { MapElementList } from "../internal/container/associative/MapElementList";

@inline()
private key_eq(x: Key, y: Key): boolean
public swap(obj: TreeMultiMap<Key, T>): void
{
return !this.key_comp()(x, y) && !this.key_comp()(y, x);
// SWAP ELEMENTS
this.data_.swap(obj.data_);
const data: MapElementList<Key, T, true, TreeMultiMap<Key, T>> = this.data_;
this.data_ = obj.data_;
obj.data_ = data;
// SWAP TREE
const tree: IteratorTree<Key, TreeMultiMap.Iterator<Key, T>> = this.tree_;
this.tree_ = obj.tree_;
obj.tree_ = tree;
}

@@ -97,3 +106,3 @@

let ret: usize = 0;
for (let it = this.find(key); it != this.end() && this.key_eq(key, it.first); it = it.next())
for (let it = this.find(key); it != this.end() && this.key_comp()(key, it.first) === false; it = it.next())
++ret;

@@ -168,5 +177,5 @@ return ret;

let count: usize = 0;
for (let it = node.value; it != this.end() && this.key_eq(key, it.first); )
for (let it = node.value; it != this.end() && this.key_comp()(key, it.first) === false;)
{
this.erase(it);
it = this.erase(it);
++count;

@@ -173,0 +182,0 @@ }

@@ -32,6 +32,15 @@ import { SetElementList } from "../internal/container/associative/SetElementList";

@inline()
private key_eq(x: Key, y: Key): boolean
public swap(obj: TreeMultiSet<Key>): void
{
return !this.key_comp()(x, y) && !this.key_comp()(y, x);
// SWAP ELEMENTS
this.data_.swap(obj.data_);
const data: SetElementList<Key, true, TreeMultiSet<Key>> = this.data_;
this.data_ = obj.data_;
obj.data_ = data;
// SWAP TREE
const tree: IteratorTree<Key, TreeMultiSet.Iterator<Key>> = this.tree_;
this.tree_ = obj.tree_;
obj.tree_ = tree;
}

@@ -95,3 +104,3 @@

let ret: usize = 0;
for (let it = this.find(key); it != this.end() && this.key_eq(key, it.value); it = it.next())
for (let it = this.find(key); it != this.end() && this.key_comp()(key, it.value) === false; it = it.next())
++ret;

@@ -166,5 +175,5 @@ return ret;

let count: usize = 0;
for (let it = node.value; it != this.end() && this.key_eq(key, it.value); )
for (let it = node.value; it != this.end() && this.key_comp()(key, it.value) === false; )
{
this.erase(it);
it = this.erase(it);
++count;

@@ -171,0 +180,0 @@ }

@@ -30,2 +30,17 @@ import { SetElementList } from "../internal/container/associative/SetElementList";

public swap(obj: TreeSet<Key>): void
{
// SWAP ELEMENTS
this.data_.swap(obj.data_);
const data: SetElementList<Key, true, TreeSet<Key>> = this.data_;
this.data_ = obj.data_;
obj.data_ = data;
// SWAP TREE
const tree: IteratorTree<Key, TreeSet.Iterator<Key>> = this.tree_;
this.tree_ = obj.tree_;
obj.tree_ = tree;
}
/* ---------------------------------------------------------

@@ -32,0 +47,0 @@ ACCESSORS

import { VectorContainer } from "../internal/container/linear/VectorContainer";
import { ReverseIterator as ReverseBase } from "../internal/iterator/ReverseIterator";
import { ReverseIteratorBase } from "../internal/iterator/ReverseIteratorBase";

@@ -140,12 +140,33 @@ import { IForwardIterator } from "../iterator/IForwardIterator";

@inline()
public get value(): T
{
return this.source_.at(this.index_);
}
@inline()
public set value(val: T)
{
this.source_.set(this.index_, val);
}
/* ---------------------------------------------------------
OPERATORS
--------------------------------------------------------- */
@inline()
@operator("==")
public equals(obj: Vector.Iterator<T>): boolean
public equals(obj: Iterator<T>): boolean
{
return this.source_ === obj.source_
&& this.index_ === obj.index_;
return this.source_ === obj.source_ && this.index_ === obj.index_;
}
@inline()
@operator("<")
public less(obj: Iterator<T>): boolean
{
return this.index_ < obj.index_;
}
@inline()
@operator("!=")
public __not_equals(obj: Vector.Iterator<T>): boolean
protected __not_equals(obj: Iterator<T>): boolean
{

@@ -156,16 +177,20 @@ return !this.equals(obj);

@inline()
@operator("<")
public less(obj: Vector.Iterator<T>): boolean
@operator("<=")
protected __less_equals(obj: Iterator<T>): boolean
{
return this.index_ < obj.index_;
return this.source_ === obj.source_ && this.index_ <= obj.index_;
}
@inline()
public get value(): T
@operator(">")
protected __greater(obj: Iterator<T>): boolean
{
return this.source_.at(this.index_);
return this.index_ > obj.index_;
}
public set value(val: T)
@inline()
@operator(">=")
protected __greater_equals(obj: Iterator<T>): boolean
{
this.source_.set(this.index_, val);
return this.source_ === obj.source_ && this.index_ >= obj.index_;
}

@@ -175,4 +200,7 @@ }

export class ReverseIterator<T>
extends ReverseBase<T, Vector<T>, Vector<T>, Iterator<T>, ReverseIterator<T>, T>
{
extends ReverseIteratorBase<T, Vector<T>, Vector<T>, Iterator<T>, ReverseIterator<T>, T>
{
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
@inline()

@@ -195,2 +223,4 @@ public advance(n: isize): ReverseIterator<T>

}
@inline()
public set value(val: T)

@@ -200,3 +230,34 @@ {

}
/* ---------------------------------------------------------
OPERATORS
--------------------------------------------------------- */
@inline()
@operator("<")
public less(obj: ReverseIterator<T>): boolean
{
return this.index() > obj.index();
}
@inline()
@operator("<=")
protected __less_equals(obj: ReverseIterator<T>): boolean
{
return this.source() === obj.source() && this.index() >= obj.index();
}
@inline()
@operator(">")
protected __greater(obj: ReverseIterator<T>): boolean
{
return this.index() < obj.index();
}
@inline()
@operator(">=")
protected __greater_equals(obj: ReverseIterator<T>): boolean
{
return this.source() === obj.source() && this.index() <= obj.index();
}
}
}
import { IMapContainer } from "./IMapContainer";
import { IForwardIterator } from "../../../iterator/IForwardIterator";
import { ReverseIterator as ReverseBase } from "../../iterator/ReverseIterator";
import { ReverseIteratorBase as ReverseBase } from "../../iterator/ReverseIteratorBase";

@@ -25,2 +25,5 @@ import { IPair } from "../../../utility/IPair";

/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
public constructor(source: SourceT)

@@ -208,2 +211,5 @@ {

{
const source: SourceT = this.source_;
this.source_ = obj.source_;
obj.source_ = source;
}

@@ -328,11 +334,15 @@ }

@inline()
public get first(): Key
{
return this.value_!.first;
return this.value.first;
}
@inline()
public get second(): T
{
return this.value_!.second;
return this.value.second;
}
@inline()
public set second(val: T)

@@ -393,2 +403,3 @@ {

{
@inline()
public get value(): Entry<Key, T>

@@ -399,2 +410,3 @@ {

@inline()
public get first(): Key

@@ -405,2 +417,3 @@ {

@inline()
public get second(): T

@@ -410,2 +423,4 @@ {

}
@inline()
public set second(val: T)

@@ -412,0 +427,0 @@ {

import { ISetContainer } from "./ISetContainer";
import { IForwardIterator } from "../../../iterator/IForwardIterator";
import { ReverseIterator as ReverseBase } from "../../iterator/ReverseIterator";
import { ReverseIteratorBase as ReverseBase } from "../../iterator/ReverseIteratorBase";
import { Repeater } from "../../iterator/disposable/Repeater";

@@ -36,7 +36,2 @@ import { distance } from "../../../iterator/global";

public resize(n: usize): void
{
}
/* ---------------------------------------------------------

@@ -208,2 +203,5 @@ ACCCESSORS

{
const source: SourceT = this.source_;
this.source_ = obj.source_;
obj.source_ = source;
}

@@ -378,2 +376,3 @@ }

{
@inline()
public get value(): Key

@@ -380,0 +379,0 @@ {

@@ -74,3 +74,3 @@ import { distance } from "../../../iterator/global";

let i: usize = this.size() + length - 1;
let i: usize = this.size() - 1;
while (true)

@@ -77,0 +77,0 @@ {

@@ -6,2 +6,5 @@ export * from "./algorithm";

export * from "./iterator";
export * from "./utility";
export * from "./utility";
import * as experimental from "./experimental/module";
export { experimental };

@@ -9,3 +9,3 @@ {

},
"version": "0.0.3",
"version": "0.0.4",
"main": "./index.ts",

@@ -12,0 +12,0 @@ "scripts": {

@@ -46,6 +46,6 @@ # AssemblyScript Standard Template Library

- *Associative adaptors*
- ~~`FlatSet`~~
- ~~`FlatMultiSet`~~
- ~~`FlatMap`~~
- ~~`FlatMultiMap`~~
- `experimental.FlatSet`
- `experimental.FlatMultiSet`
- `experimental.FlatMap`
- `experimental.FlatMultiMap`

@@ -52,0 +52,0 @@ ### Algorithms

@@ -29,2 +29,3 @@ //----

//----
// LINEARS
import { test_vector } from "./features/containers/test_vector";

@@ -35,2 +36,3 @@ import { test_deque } from "./features/containers/test_deque";

// ASSOCIATIVES
import { test_tree_map } from "./features/containers/test_tree_map";

@@ -40,3 +42,2 @@ import { test_tree_multi_map } from "./features/containers/test_tree_multi_map";

import { test_tree_set } from "./features/containers/test_tree_set";
import { test_hash_map } from "./features/containers/test_hash_map";

@@ -47,5 +48,11 @@ import { test_hash_multi_map } from "./features/containers/test_hash_multi_map";

// ADAPTORS
import { test_priority_queue } from "./features/containers/test_priority_queue";
import { test_queue } from "./features/containers/test_queue";
import { test_stack } from "./features/containers/test_stack";
import { test_flat_map } from "./features/experimental/containers/test_flat_map";
import { test_flat_multi_map } from "./features/experimental/containers/test_flat_multi_map";
import { test_flat_multi_set } from "./features/experimental/containers/test_flat_multi_set";
import { test_flat_set } from "./features/experimental/containers/test_flat_set";
import { test_storing_objects } from "./features/containers/test_storing_objects";

@@ -70,3 +77,3 @@

// HEAP
test_make_heap();
// test_make_heap();
test_push_heap();

@@ -110,2 +117,6 @@ // test_sort_heap();

test_stack();
test_flat_map();
test_flat_multi_map();
test_flat_multi_set();
test_flat_set();

@@ -112,0 +123,0 @@ // ETC

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc