com.ibm.wala.util.graph.impl.NumberedNodeIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.ibm.wala.util Show documentation
Show all versions of com.ibm.wala.util Show documentation
T. J. Watson Libraries for Analysis
The newest version!
/*
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*/
package com.ibm.wala.util.graph.impl;
import com.ibm.wala.util.graph.NumberedNodeManager;
import com.ibm.wala.util.intset.IntIterator;
import com.ibm.wala.util.intset.IntSet;
import java.util.Iterator;
import java.util.NoSuchElementException;
/** */
public class NumberedNodeIterator implements Iterator {
final IntIterator numbers;
final NumberedNodeManager nodeManager;
/**
* @throws IllegalArgumentException if s is null
*/
public NumberedNodeIterator(IntSet s, NumberedNodeManager nodeManager) {
if (s == null) {
throw new IllegalArgumentException("s is null");
}
this.numbers = s.intIterator();
this.nodeManager = nodeManager;
}
@Override
public boolean hasNext() {
return numbers.hasNext();
}
@Override
public T next() throws NoSuchElementException {
int i = numbers.next();
T result = nodeManager.getNode(i);
assert result != null : "null node for " + i;
return result;
}
@Override
public void remove() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy