-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLabelIterator.java
More file actions
43 lines (34 loc) · 870 Bytes
/
LabelIterator.java
File metadata and controls
43 lines (34 loc) · 870 Bytes
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
// Copyright (c) 2019-2020 Nicholas Corgan
// SPDX-License-Identifier: BSL-1.0
package Pothos;
import java.util.Iterator;
import java.util.NoSuchElementException;
public class LabelIterator implements Iterator<Label>
{
static
{
LoadNative.loadNative();
}
private Proxy labelIteratorProxy;
private long index = 0;
private long length = 0;
public LabelIterator(Proxy proxy)
{
labelIteratorProxy = proxy;
}
public boolean hasNext()
{
return (index < length);
}
public Label next()
{
if(!hasNext())
{
throw new NoSuchElementException(""+length);
}
Proxy indexedProxy = labelIteratorProxy
.call("begin")
.call("[]", (index++));
return new Label(indexedProxy);
}
}