## model
Class Rank

    java.lang.Object
      model.Rank

All Implemented Interfaces:
  java.lang.Comparable<java.lang.Object>

    public class Rank

extends java.lang.Object
implements java.lang.Comparable<java.lang.Object>

A class for representing Go ranks (7..1 dan, 1..30 kyu)

Field Summary
`private java.lang.String` `id`
`private boolean` `is_dan`
`private static Rank[]` `rank_list`
`private int` `value`

Constructor Summary
`protected` `Rank(int rank_value, boolean rank_dan)` Constructor creates a new Rank object that represents a Go rank.

Method Summary
`int` `compareTo(java.lang.Object other)` The compareTo method is overridden so that Rank objects can be sorted in the order of strongest to weakest or vice versa.
`boolean` `equals(java.lang.Object other)` Checks whether one Rank object is equal to another.
`java.lang.String` `getId()` Returns the rank id string.
`static Rank` `getLowestRank()` Returns lowest rank in the rank list.
`protected java.lang.String` `getMachMahonRank()` Returns the rank in a format compatible with the MacMahon program.
`protected static Rank[]` `getRankList()` Returns a list of all the Rank objects in the rank list.
`java.lang.String` `getRepresentation()` Returns a more readable String representation of the rank.
`int` `getValue()` Returns the value of the rank.
`boolean` `isDan()` Returns true if dan, false if kyu.
`static Rank` `parseRank(java.lang.String rank)` Parses a Rank object from a string.
`java.lang.String` `toString()` Returns a String that is created as follows: 1.

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

Field Detail

### rank_list

    private static Rank[] rank_list

### id

    private final transient java.lang.String id

### value

    private final transient int value

### is_dan

    private final transient boolean is_dan

Constructor Detail

### Rank

    protected Rank(int rank_value,
                   boolean rank_dan)

  Constructor creates a new Rank object that represents a Go rank.

  Parameters:
    `rank_value` - rank value
    `rank_dan` - true if dan, false if kyu.

Method Detail

### getId

    public final java.lang.String getId()

  Returns the rank id string. The string is of the same format as in the method toString.

  Returns:
    rank id

### getValue

    public final int getValue()

  Returns the value of the rank.

  Returns:
    rank value, i.e. the numeric part of the rank

### isDan

    public final boolean isDan()

  Returns true if dan, false if kyu.

  Returns:
    true if dan, false if kyu

### toString

    public final java.lang.String toString()

  Returns a String that is created as follows: 1. the first character is "d" if the rank is dan and "k" if kyu. 2. rest of the string is the numeral value of the rank.

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

### getRepresentation

    public final java.lang.String getRepresentation()

  Returns a more readable String representation of the rank.

  Returns:
    a string with the numeric value of the rank followed by a space and "kyu" or "dan" rank indicators.

### getMachMahonRank

    protected final java.lang.String getMachMahonRank()

  Returns the rank in a format compatible with the MacMahon program.

  Returns:
    rank in MacMahon format

### parseRank

    public static Rank parseRank(java.lang.String rank)
                          throws GoException

  Parses a Rank object from a string.

  Parameters:
    `rank` - string representing a rank
  Returns:
    corresponding rank in a Rank instance
  Throws:
    `GoException` - thrown if the string cannot be parsed a rank

### getLowestRank

    public static Rank getLowestRank()

  Returns lowest rank in the rank list.

  Returns:
    lowest rank in the rank list

### getRankList

    protected static Rank[] getRankList()

  Returns a list of all the Rank objects in the rank list.

  Returns:
    a Rank array

### equals

    public boolean equals(java.lang.Object other)

  Checks whether one Rank object is equal to another.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `other` - Rank instance to compare to
  Returns:
    true if both represent the same Go rank, otherwise false.

### compareTo

    public int compareTo(java.lang.Object other)

  The compareTo method is overridden so that Rank objects can be sorted in the order of strongest to weakest or vice versa.

  Specified by:
    `compareTo` in interface `java.lang.Comparable<java.lang.Object>`