org.apache.nutch.crawl

## Class UrlWithScore

- java.lang.Object
- - org.apache.nutch.crawl.UrlWithScore

- All Implemented Interfaces:
    Comparable<UrlWithScore>, Writable, WritableComparable<UrlWithScore>

      public final class UrlWithScore
      extends Object
      implements WritableComparable<UrlWithScore>

  A writable comparable container for an url with score. Provides a `Partitioner` and `RawComparator` implementations for easy integration with jobs.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UrlWithScore.UrlOnlyPartitioner` A partitioner by {url}.
    `static class` | `UrlWithScore.UrlScoreComparator` Compares by {url,score}.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UrlWithScore()` Creates instance with empty url and zero score.
    `UrlWithScore(String url, float score)` Creates instance with provided non-writable types.
    `UrlWithScore(Text url, FloatWritable score)` Creates instance with provided writables.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(UrlWithScore other)`
    `FloatWritable` | `getScore()`
    `Text` | `getUrl()`
    `void` | `readFields(DataInput in)`
    `void` | `setScore(float score)`
    `void` | `setScore(FloatWritable score)`
    `void` | `setUrl(String url)`
    `void` | `setUrl(Text url)`
    `String` | `toString()`
    `void` | `write(DataOutput out)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### UrlWithScore

          public UrlWithScore()

      Creates instance with empty url and zero score.

    - #### UrlWithScore

          public UrlWithScore(Text url,
                      FloatWritable score)

      Creates instance with provided writables.
      Parameters:
        `url` -
        `score` -

    - #### UrlWithScore

          public UrlWithScore(String url,
                      float score)

      Creates instance with provided non-writable types.
      Parameters:
        `url` -
        `score` -

  - ### Method Detail

    - #### write

          public void write(DataOutput out)
                     throws IOException

      Specified by:
        `write` in interface `Writable`
      Throws:
        `IOException`

    - #### readFields

          public void readFields(DataInput in)
                          throws IOException

      Specified by:
        `readFields` in interface `Writable`
      Throws:
        `IOException`

    - #### getUrl

          public Text getUrl()

    - #### setUrl

          public void setUrl(Text url)

    - #### setUrl

          public void setUrl(String url)

    - #### getScore

          public FloatWritable getScore()

    - #### setScore

          public void setScore(FloatWritable score)

    - #### setScore

          public void setScore(float score)

    - #### compareTo

          public int compareTo(UrlWithScore other)

      Specified by:
        `compareTo` in interface `Comparable<UrlWithScore>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2015 The Apache Software Foundation