slib.utils.impl
Class QueryFileIterator

java.lang.Object
  extended by slib.utils.impl.QueryFileIterator
All Implemented Interfaces:
QueryIterator

public class QueryFileIterator
extends Object
implements QueryIterator

Query Iterator implementing the QueryIterator interface used to iterate through the queries defined in a tabular delimited file i.e. e1\te2

Author:
Sebastien Harispe

Constructor Summary
QueryFileIterator(String filepath)
          Constructor of a QueryFileIterator
QueryFileIterator(String filepath, String uriPrefix)
          Constructor of a QueryFileIterator
 
Method Summary
 void close()
          Close the opened repository
 long getNumberQueries()
           
 boolean hasNext()
           
 QueryEntry next()
          Note the Query Entry returned can be equal to null if the line is not in agreement with the expectations i.e.
 List<QueryEntry> nextValids(int nbValues)
          Return a List containing the next valid queries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryFileIterator

public QueryFileIterator(String filepath)
                  throws IOException
Constructor of a QueryFileIterator

Parameters:
filepath - the file to load as repository
Throws:
IOException - if an IO exception appends

QueryFileIterator

public QueryFileIterator(String filepath,
                         String uriPrefix)
                  throws IOException
Constructor of a QueryFileIterator

Parameters:
filepath - the file to load as repository
uriPrefix -
Throws:
IOException - if an IO exception appends
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface QueryIterator
Returns:
boolean return true if a query is available else either

next

public QueryEntry next()
Note the Query Entry returned can be equal to null if the line is not in agreement with the expectations i.e. e1 \t e2

Specified by:
next in interface QueryIterator
Returns:
the next available QueryEntry. Also return null if the row repository do not correspond to a well formed entry.

close

public void close()
           throws IOException
Description copied from interface: QueryIterator
Close the opened repository

Specified by:
close in interface QueryIterator
Throws:
IOException

nextValids

public List<QueryEntry> nextValids(int nbValues)
Description copied from interface: QueryIterator
Return a List containing the next valid queries. If the number of the next queries is lower than the requested. number of queries only the available number of queries is returned.

Specified by:
nextValids in interface QueryIterator
Parameters:
nbValues - the number of values the query list must contains.
Returns:
a List of QueryEntry

getNumberQueries

public long getNumberQueries()
                      throws Exception
Specified by:
getNumberQueries in interface QueryIterator
Returns:
a long corresponding to the number of query available in the number of queries available in the repository
Throws:
Exception


Copyright © 2013. All Rights Reserved.