Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.klomp.snark
Class Piece

    java.lang.Object
      org.klomp.snark.Piece

All Implemented Interfaces:
  Comparable

    public class Piece

extends Object
implements Comparable

Constructor Summary
`Piece(int id)`

Method Summary
`boolean` | `addPeer(Peer peer)`
`int` | `compareTo(Object o)` Highest priority first, then rarest first
`boolean` | `equals(Object o)`
`int` | `getId()`
`Set<PeerID>` | `getPeers()` Deprecated. unused
`int` | `getPriority()`
`int` | `hashCode()`
`boolean` | `isDisabled()`
`boolean` | `isRequested()`
`boolean` | `removePeer(Peer peer)`
`void` | `setDisabled()`
`void` | `setPriority(int p)`
`void` | `setRequested(boolean requested)`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Piece

    public Piece(int id)

Method Detail

### compareTo

    public int compareTo(Object o)
                  throws ClassCastException

  Highest priority first, then rarest first

  Specified by:
    `compareTo` in interface `Comparable`
  Throws:
    `ClassCastException`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### getId

    public int getId()

### getPeers

    public Set<PeerID> getPeers()

  Deprecated. unused

### addPeer

    public boolean addPeer(Peer peer)

### removePeer

    public boolean removePeer(Peer peer)

### isRequested

    public boolean isRequested()

### setRequested

    public void setRequested(boolean requested)

### getPriority

    public int getPriority()

  Returns:
    default 0 @since 0.8.1

### setPriority

    public void setPriority(int p)

  Since:
    0.8.1

### isDisabled

    public boolean isDisabled()

  Since:
    0.8.1

### setDisabled

    public void setDisabled()

  Since:
    0.8.1

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD