public boolean hasNext() { if ( toAdvance ) { try { k = 1 - k; hasNext = fastBufferedReader.readLine( s[ k ] ) != null; } catch (IOException e) { throw new RuntimeException( e ); } toAdvance = false; } return hasNext; }
public boolean hasNext() { if ( toAdvance ) { try { k = 1 - k; hasNext = fastBufferedReader.readLine( s[ k ] ) != null; } catch (IOException e) { throw new RuntimeException( e ); } toAdvance = false; } return hasNext; }
@Override public boolean hasNext() { if (toAdvance) { try { k = 1 - k; hasNext = fastBufferedReader.readLine(s[k]) != null; } catch (IOException e) { throw new RuntimeException(e); } toAdvance = false; } return hasNext; }
public boolean hasNext() { if ( toAdvance ) { try { next = fbr.readLine( s ); if ( next == null ) close(); } catch (IOException e) { throw new RuntimeException( e ); } toAdvance = false; } return next != null; }
@Override public boolean next(final MutableString word, final MutableString nonWord) throws IOException { nonWord.length(0); return fastBufferedReader.readLine(word) != null; }
public boolean hasNext() { if ( toAdvance ) { try { next = fbr.readLine( s ); if ( next == null ) close(); } catch (IOException e) { throw new RuntimeException( e ); } toAdvance = false; } return next != null; }
public boolean hasNext() { if ( toAdvance ) { try { next = fbr.readLine( s ); if ( next == null ) close(); } catch (IOException e) { throw new RuntimeException( e ); } toAdvance = false; } return next != null; }
public boolean hasNext() { if ( toAdvance ) { try { next = fbr.readLine( s ); if ( next == null ) close(); } catch (IOException e) { throw new RuntimeException( e ); } toAdvance = false; } return next != null; }
@Override public boolean hasNext() { if (toAdvance) { try { next = fbr.readLine(s); if (next == null) close(); } catch (final IOException e) { throw new RuntimeException(e); } toAdvance = false; } return next != null; }
public boolean next( final MutableString word, final MutableString nonWord ) throws IOException { nonWord.length( 0 ); return fastBufferedReader.readLine( word ) != null; }
@Override public boolean hasNext() { if (toAdvance) { try { next = fbr.readLine(s); if (next == null) close(); } catch (final IOException e) { throw new RuntimeException(e); } toAdvance = false; } return next != null; }
public boolean next( final MutableString word, final MutableString nonWord ) throws IOException { nonWord.length( 0 ); return fastBufferedReader.readLine( word ) != null; }
/** Creates a read-once ASCII graph. Instances created using this constructor can be * only accessed using a single call to {@link #nodeIterator(int)}. * * @param is an input stream containing an ASCII graph. */ public ASCIIGraph(final InputStream is) throws NumberFormatException, IOException { graphFile = null; fbr = new FastBufferedReader(new InputStreamReader(is, "ASCII")); n = Integer.parseInt(fbr.readLine(new MutableString()).toString()); if (n < 0) throw new IllegalArgumentException("Number of nodes must be nonnegative"); }
public enum IndexType { /** An old-style, interleaved index. */ INTERLEAVED, /** A high-performance index which stores position separately. */ HIGH_PERFORMANCE, /** A quasi-succinct index. */ QUASI_SUCCINCT }
public enum IndexType { /** An old-style, interleaved index. */ INTERLEAVED, /** A high-performance index which stores position separately. */ HIGH_PERFORMANCE, /** A quasi-succinct index. */ QUASI_SUCCINCT }
public static void main( final String[] arg ) throws JSAPException, IOException, ConfigurationException, SecurityException, URISyntaxException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { final SimpleJSAP jsap = new SimpleJSAP( SubsetLexicalStrategy.class.getName(), "Builds a subset-based lexical partitioning strategy reading an UTF-8 encoded term list from standard input.", new Parameter[] { new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the index." ), new UnflaggedOption( "strategy", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename for the strategy." ) }); JSAPResult jsapResult = jsap.parse( arg ); if ( jsap.messagePrinted() ) return; final Index index = Index.getInstance( jsapResult.getString( "basename" ) ); @SuppressWarnings("resource") final FastBufferedReader reader = new FastBufferedReader( new InputStreamReader( System.in, "UTF-8" ) ); final MutableString s = new MutableString(); final IntOpenHashSet subset = new IntOpenHashSet(); while( reader.readLine( s ) != null ) { final int t = (int)index.termMap.getLong( s ); if ( t == -1 ) throw new IllegalArgumentException( "Unknown term " + s ); subset.add( t ); } reader.close(); BinIO.storeObject( new SubsetLexicalStrategy( subset ), jsapResult.getString( "strategy" ) ); }
public static void main( final String[] arg ) throws IOException, JSAPException, NoSuchMethodException { final SimpleJSAP jsap = new SimpleJSAP( TernaryIntervalSearchTree.class.getName(), "Builds a ternary interval search tree reading from standard input a newline-separated list of terms.", new Parameter[] { new FlaggedOption( "bufferSize", JSAP.INTSIZE_PARSER, "64Ki", JSAP.NOT_REQUIRED, 'b', "buffer-size", "The size of the I/O buffer used to read terms." ), new FlaggedOption( "encoding", ForNameStringParser.getParser( Charset.class ), "UTF-8", JSAP.NOT_REQUIRED, 'e', "encoding", "The term file encoding." ), new UnflaggedOption( "tree", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename for the serialised tree." ) }); JSAPResult jsapResult = jsap.parse( arg ); if ( jsap.messagePrinted() ) return; final TernaryIntervalSearchTree tree = new TernaryIntervalSearchTree(); MutableString term = new MutableString(); final ProgressLogger pl = new ProgressLogger(); pl.itemsName = "terms"; final FastBufferedReader terms = new FastBufferedReader( new InputStreamReader( System.in, (Charset)jsapResult.getObject( "encoding" ) ), jsapResult.getInt( "bufferSize" ) ); pl.start( "Reading terms..." ); while( terms.readLine( term ) != null ) { pl.update(); tree.add( term ); } pl.done(); BinIO.storeObject( tree, jsapResult.getString( "tree" ) ); }
public static void main(final String[] arg) throws IOException, JSAPException, NoSuchMethodException { final SimpleJSAP jsap = new SimpleJSAP(TernaryIntervalSearchTree.class.getName(), "Builds a ternary interval search tree reading from standard input a newline-separated list of terms.", new Parameter[] { new FlaggedOption("bufferSize", JSAP.INTSIZE_PARSER, "64Ki", JSAP.NOT_REQUIRED, 'b', "buffer-size", "The size of the I/O buffer used to read terms."), new FlaggedOption("encoding", ForNameStringParser.getParser(Charset.class), "UTF-8", JSAP.NOT_REQUIRED, 'e', "encoding", "The term file encoding."), new UnflaggedOption("tree", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename for the serialised tree.") }); JSAPResult jsapResult = jsap.parse(arg); if (jsap.messagePrinted()) return; final TernaryIntervalSearchTree tree = new TernaryIntervalSearchTree(); MutableString term = new MutableString(); final ProgressLogger pl = new ProgressLogger(); pl.itemsName = "terms"; @SuppressWarnings("resource") final FastBufferedReader terms = new FastBufferedReader(new InputStreamReader(System.in, (Charset)jsapResult.getObject("encoding")), jsapResult.getInt("bufferSize")); pl.start("Reading terms..."); while(terms.readLine(term) != null) { pl.update(); tree.add(term); } pl.done(); BinIO.storeObject(tree, jsapResult.getString("tree")); }
public static void main( final String[] arg ) throws IOException, JSAPException, NoSuchMethodException { final SimpleJSAP jsap = new SimpleJSAP( TernaryIntervalSearchTree.class.getName(), "Builds a ternary interval search tree reading from standard input a newline-separated list of terms.", new Parameter[] { new FlaggedOption( "bufferSize", JSAP.INTSIZE_PARSER, "64Ki", JSAP.NOT_REQUIRED, 'b', "buffer-size", "The size of the I/O buffer used to read terms." ), new FlaggedOption( "encoding", ForNameStringParser.getParser( Charset.class ), "UTF-8", JSAP.NOT_REQUIRED, 'e', "encoding", "The term file encoding." ), new UnflaggedOption( "tree", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename for the serialised tree." ) }); JSAPResult jsapResult = jsap.parse( arg ); if ( jsap.messagePrinted() ) return; final TernaryIntervalSearchTree tree = new TernaryIntervalSearchTree(); MutableString term = new MutableString(); final ProgressLogger pl = new ProgressLogger(); pl.itemsName = "terms"; final FastBufferedReader terms = new FastBufferedReader( new InputStreamReader( System.in, (Charset)jsapResult.getObject( "encoding" ) ), jsapResult.getInt( "bufferSize" ) ); pl.start( "Reading terms..." ); while( terms.readLine( term ) != null ) { pl.update(); tree.add( term ); } pl.done(); BinIO.storeObject( tree, jsapResult.getString( "tree" ) ); }
public static void main(final String[] arg) throws IOException, JSAPException, NoSuchMethodException { final SimpleJSAP jsap = new SimpleJSAP(TernaryIntervalSearchTree.class.getName(), "Builds a ternary interval search tree reading from standard input a newline-separated list of terms.", new Parameter[] { new FlaggedOption("bufferSize", JSAP.INTSIZE_PARSER, "64Ki", JSAP.NOT_REQUIRED, 'b', "buffer-size", "The size of the I/O buffer used to read terms."), new FlaggedOption("encoding", ForNameStringParser.getParser(Charset.class), "UTF-8", JSAP.NOT_REQUIRED, 'e', "encoding", "The term file encoding."), new UnflaggedOption("tree", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename for the serialised tree.") }); JSAPResult jsapResult = jsap.parse(arg); if (jsap.messagePrinted()) return; final TernaryIntervalSearchTree tree = new TernaryIntervalSearchTree(); MutableString term = new MutableString(); final ProgressLogger pl = new ProgressLogger(); pl.itemsName = "terms"; @SuppressWarnings("resource") final FastBufferedReader terms = new FastBufferedReader(new InputStreamReader(System.in, (Charset)jsapResult.getObject("encoding")), jsapResult.getInt("bufferSize")); pl.start("Reading terms..."); while(terms.readLine(term) != null) { pl.update(); tree.add(term); } pl.done(); BinIO.storeObject(tree, jsapResult.getString("tree")); }