PercentageRating

Added in 1.0.0
Deprecated in 1.3.0

public final class PercentageRating implements Rating


A class for rating expressed as a percentage.

Summary

Public constructors

Creates a unrated PercentageRating instance.

PercentageRating(float percent)

Creates a PercentageRating instance with the given percentage.

Public methods

boolean
float

Returns the percentage-based rating value.

int
boolean

Returns whether there is a rating value available.

String

Public constructors

PercentageRating

Added in 1.0.0
Deprecated in 1.3.0
public PercentageRating()

Creates a unrated PercentageRating instance.

PercentageRating

Added in 1.0.0
Deprecated in 1.3.0
public PercentageRating(float percent)

Creates a PercentageRating instance with the given percentage. If percent is less than 0f or greater than 100f, it will throw IllegalArgumentException.

Parameters
float percent

the value of the rating

Public methods

equals

public boolean equals(Object obj)

getPercentRating

Added in 1.0.0
Deprecated in 1.3.0
public float getPercentRating()

Returns the percentage-based rating value.

Returns
float

a rating value greater or equal to 0.0f, or a negative value if it is unrated.

hashCode

public int hashCode()

isRated

Added in 1.0.0
Deprecated in 1.3.0
public boolean isRated()

Returns whether there is a rating value available.

Returns
boolean

true if there is an available rating value.

toString

public String toString()