abstractindexiterator.java

来自「MG4J (Managing Gigabytes for Java) is a 」· Java 代码 · 共 76 行

JAVA
76
字号
package it.unimi.dsi.mg4j.index;/*		  * MG4J: Managing Gigabytes for Java * * Copyright (C) 2006-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 java.io.IOException;import it.unimi.dsi.fastutil.ints.AbstractIntIterator;import it.unimi.dsi.mg4j.search.IntervalIterator;import it.unimi.dsi.mg4j.search.visitor.DocumentIteratorVisitor;/** A very basic abstract implementation of an index interator, * providing an obvious implementation of {@link #term()}, {@link #id()}, * and of the {@linkplain #accept(DocumentIteratorVisitor) visiting methods}. *  */public abstract class AbstractIndexIterator extends AbstractIntIterator implements IndexIterator {	protected String term;	protected int id;		public void term( final CharSequence term ) {		this.term = term == null ? null : term.toString();	}	public String term() { 		return term;	}	public void id( final int id ) {		this.id = id;	}		public int id() {		return id;	}	public boolean accept( DocumentIteratorVisitor visitor ) throws IOException {		// TODO: there used to be a visitPost(); check that this works		return visitor.visit( this );	}	public boolean acceptOnTruePaths( DocumentIteratorVisitor visitor ) throws IOException {		return visitor.visit( this );	}		@Deprecated	public IntervalIterator iterator() {		try {			return intervalIterator();		}		catch ( IOException e ) {			throw new RuntimeException( e );		}	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?