📄 bitvectorbooleaniterator.java
字号:
package it.unimi.dsi.mg4j.util;/* * MG4J: Managing Gigabytes for Java** Copyright (C) 2005-2007 Sebastiano Vigna ** This library is free software; you can redistribute it and/or modify it* under the terms of the GNU Lesser General Public License as published by the Free* Software Foundation; either version 2.1 of the License, or (at your option)* any later version.** This library is distributed in the hope that it will be useful, but* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License* for more details.** You should have received a copy of the GNU Lesser General Public License* along with this program; if not, write to the Free Software* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.**/import it.unimi.dsi.fastutil.booleans.AbstractBooleanListIterator;import java.util.NoSuchElementException;import cern.colt.bitvector.BitVector;/** A boolean iterator returning the bits of a bit vector. * * @deprecated Useless, since we now have the {@link it.unimi.dsi.bits.BitVector} implementations * in the <a href="http://dsiutils.dsi.unimi.it/">DSI utilities</a>. */@Deprecatedpublic class BitVectorBooleanIterator extends AbstractBooleanListIterator { private final BitVector bitVector; int pos = 0; public BitVectorBooleanIterator( final BitVector bitVector ) { this.bitVector = bitVector; } public boolean previousBoolean() { if ( ! hasPrevious() ) throw new NoSuchElementException(); return bitVector.get( --pos ); } public boolean nextBoolean() { if ( ! hasNext() ) throw new NoSuchElementException(); return bitVector.get( pos++ ); } public int nextIndex() { return pos; } public int previousIndex() { return pos - 1; } public boolean hasNext() { return pos < bitVector.size(); } public boolean hasPrevious() { return pos > 0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -