org.apache.nutch.crawl

## Class UrlWithScore

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

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

      public final class UrlWithScore
      extends java.lang.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(java.lang.String url, float score)` Creates instance with provided non-writable types.
    `UrlWithScore(Text url, FloatWritable score)` Creates instance with provided writables.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(UrlWithScore other)`
    `FloatWritable` | `getScore()`
    `Text` | `getUrl()`
    `void` | `readFields(java.io.DataInput in)`
    `void` | `setScore(float score)`
    `void` | `setScore(FloatWritable score)`
    `void` | `setUrl(java.lang.String url)`
    `void` | `setUrl(Text url)`
    `java.lang.String` | `toString()`
    `void` | `write(java.io.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(java.lang.String url,
                              float score)

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

  - ### Method Detail

    - #### write

          public void write(java.io.DataOutput out)
                     throws java.io.IOException

      Specified by:
        `write` in interface `Writable`
      Throws:
        `java.io.IOException`

    - #### readFields

          public void readFields(java.io.DataInput in)
                          throws java.io.IOException

      Specified by:
        `readFields` in interface `Writable`
      Throws:
        `java.io.IOException`

    - #### getUrl

          public Text getUrl()

    - #### setUrl

          public void setUrl(Text url)

    - #### setUrl

          public void setUrl(java.lang.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 `java.lang.Comparable<UrlWithScore>`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 2019 The Apache Software Foundation