-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
InsertIterator.ts
61 lines (54 loc) · 1.21 KB
/
InsertIterator.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/// <reference path="../API.ts" />
/// <reference path="../base/iterators/_InsertIterator.ts" />
namespace std
{
/**
* Insert iterator.
*
* @author Jeongho Nam <http://samchon.org>
*/
export class InsertIterator<T,
Container extends base._IInsert<T, Iterator>,
Iterator extends IForwardIterator<T, Iterator>>
extends base._InsertIterator<T, InsertIterator<T, Container, Iterator>>
{
/**
* @hidden
*/
private container_: Container;
/**
* @hidden
*/
private it_: Iterator;
/* ---------------------------------------------------------
METHODS
--------------------------------------------------------- */
/**
* Initializer Constructor.
*
* @param container Target container to insert.
* @param it Iterator to the position to insert.
*/
public constructor(container: Container, it: Iterator)
{
super();
this.container_ = container;
this.it_ = it;
}
/**
* @inheritDoc
*/
public set value(val: T)
{
this.container_.insert(this.it_, val);
this.it_ = this.it_.next() as Iterator;
}
/**
* @inheritDoc
*/
public equals(obj: InsertIterator<T, Container, Iterator>): boolean
{
return std.equal_to(this.it_, obj.it_);
}
}
}