Package it.unimi.dsi.lang

Examples of it.unimi.dsi.lang.MutableString


      if ( ! hasNext() ) return null;
      return next();
    }
   
    public String toString() {
      MutableString result = new MutableString();
      result.append( '{' );
      boolean first = true;
      for( int[] i : interval ) {
        if ( ! first ) result.append( ',' );
        first = false;
        result.append( toString( i ) );
      }
      return result.append( '}' ).toString();
    }
View Full Code Here


  public void reset() {
    curr = -1;
  }
 
  public String toString() {
    MutableString result = new MutableString();
    result.append( '[' );
    for( int i = 0; i < document.length; i++ ) {
      if ( i != 0 ) result.append( ", " );
      result.append( '<' ).append( document[ i ] ).append( ':' ).append( new ArrayIntervalIterator( interval[ i ], intervalTerm[ i ] ) ).append( '>' );
    }
    return result.append( ']' ).toString();
  }
View Full Code Here

      public void close() {}
      public Object content( int field ) throws IOException {
        ensureDocumentIndex( index );
        ObjectArrayList<Anchor> result = new ObjectArrayList<Anchor>();
        for( Map.Entry<Integer, ? extends CharSequence> entry: virtual[ index ].entrySet() )
          result.add( new Anchor( new MutableString( entry.getKey().toString() ), new MutableString( entry.getValue() ) ) );
        return result;
      }
      public CharSequence title() { return null; }
      public CharSequence uri() { return null; }
      public WordReader wordReader( int field ) { return new FastBufferedReader(); }
View Full Code Here

   *  the second field as body.
   * 
   *  @param document the document.
   *  @return the HTML version of the document.
   */  private String getHTMLDocument( String[] document ) {
    MutableString res = new MutableString();
    res.append( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" );
    res.append( "<HTML>\n<HEAD>\n<TITLE>" + document[ 0 ] + "</TITLE>\n" );
    // Do NOT append the first part of the body
    res.append( "<BODY>\n" + document[ 1 ].substring( document[ 0 ].length() ) );
    res.append( "\n</BODY>\n" );
    res.append( "</HTML>" );
    return res.toString();
  }
View Full Code Here

  
   *  @param document the document.
   *  @return the HTML version of the document.
   */
  private String getMboxDocument( String[] document ) {
    MutableString res = new MutableString();
    res.append( "From MAILER-DAEMON Fri Apr 15 16:22:32 2005\n" );
    res.append( "Date: 15 Apr 2005 16:22:32 +0200\n" );
    res.append( "From: Mail System Internal Data <MAILER-DAEMON@sliver.usr.dsi.unimi.it>\n" );
    res.append( "Subject: " + document[ 0 ] + "\n" );
    res.append( "Message-ID: <1113574952@sliver.usr.dsi.unimi.it>\n" );
    res.append( "X-IMAP: 1102967122 0000138458\n" );
    res.append( "Return-Path: <matteo.xxx@unimi.it>\n" );
    res.append( "Received: from localhost (localhost.localdomain [127.0.0.1])\n" );
        res.append( "\tby sliver.usr.dsi.unimi.it (8.12.11/8.12.11) with ESMTP id iAUNtadn007305\n");
        res.append( "\tfor <vigna@localhost>; Wed, 1 Dec 2004 00:55:36 +0100\n" );
        res.append( "Received: from law5.usr.dsi.unimi.it [159.149.146.241]\n" );
        res.append( "\tby localhost with IMAP (fetchmail-6.2.5)\n" );
        res.append( "\tfor vigna@localhost (single-drop); Wed, 01 Dec 2004 00:55:36 +0100 (CET)\n" );
        res.append( "To: vigna@dsi.unimi.it\n" );
        res.append( "Message-id: <Pine.WNT.4.33.0412010051240.-209505@p233-mmx>\n" );
        res.append( "Content-type: TEXT/PLAIN; charset=iso-8859-15\n" );
        res.append( "X-Warning: UNAuthenticated Sender\n" );
        res.append( "Content-Transfer-Encoding: 8bit\n" );
        res.append( "Content-Length: " + document[ 1 ].length() + "\n" );
    res.append( "\n" );
    res.append( document[ 1 ] + "\n" );
    return res.toString();
  }
View Full Code Here

      }
    }

    // META REFRESH/LOCATION
    if (element == Element.META) {
      final MutableString equiv = attrMap.get(Attribute.HTTP_EQUIV);
      final MutableString content = attrMap.get(Attribute.CONTENT);
      if (equiv != null && content != null) {
        equiv.toLowerCase();

        // http-equiv="refresh" content="0;URL=http://foo.bar/..."
        if (equiv.equals("refresh") && (metaRefresh == null)) {

          final int pos = URLEQUAL_PATTERN.search(content);
          if (pos != -1)
            metaRefresh = content.substring(
                pos + URLEQUAL_PATTERN.length()).toString();
        }

        // http-equiv="location" content="http://foo.bar/..."
        if (equiv.equals("location") && (metaLocation == null))
View Full Code Here

   * @param wordReader the word reader.
   * @param tok the tokenizer.
   * @throws IOException
   */
  private void checkSameWords( WordReader wordReader, StringTokenizer tok ) throws IOException {
    MutableString word = new MutableString();
    MutableString nonWord = new MutableString();
    boolean aWordInDocum, aWordInDocument;
    boolean firstTime = true;
    for (;;) {
      aWordInDocum = wordReader.next( word, nonWord );
      if ( firstTime ) {
View Full Code Here

  }
 
  public void testInputStreamSequence() throws IOException, ConfigurationException {
    System.err.println( "Checking input stream (text field only)" );
    // Extract only field number 1, and write it out with separator '\u0000'
    MutableString res = new MutableString();
    String[][] justSecondField = new String[ ndoc ][ 1 ];
    for ( int i = 0; i < ndoc; i++ ) {
      res.append( document[ i ][ 1 ] + "\u0000" );
      justSecondField[ i ][ 0 ] = document[ i ][ 1 ];
    }
    String resString = res.toString();
    // Write the sequence on a file (in UTF-8)
    Writer resWriter = new OutputStreamWriter( new FileOutputStream( new File( tempDir, "stream" ) ), "UTF-8" );
    resWriter.write( resString );
    resWriter.close();
    // Read it as a input stream document sequence
View Full Code Here

                return new GobyAlignment(this, iterator.next());
            }

            @Override
            public MutableString getId(int targetIndex){
                return new MutableString("chrMock");
            }

        };

        ObjectArrayList<GobyAlignment> visitedEntries = new ObjectArrayList<GobyAlignment>();
View Full Code Here

            System.err.println(errorMessage);
            throw new UnsupportedOperationException(errorMessage);
        }
        final IndexedIdentifier identifiers = reader.getTargetIdentifiers();
        // add MT as a synonym for M:
        identifiers.put(new MutableString("M"), identifiers.getInt(new MutableString("MT")));
        targetIdentifiers = new DoubleIndexedIdentifier(identifiers);
        isIndexed = reader.isIndexed();
        // reader.close();
        // reader = null;
View Full Code Here

TOP

Related Classes of it.unimi.dsi.lang.MutableString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.