mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-05 00:38:14 +00:00
Add received priority value to IllegalArgumentException message.
This commit is contained in:
@@ -21,26 +21,26 @@ public final class OnDemandRequest implements Comparable<OnDemandRequest> {
|
|||||||
*/
|
*/
|
||||||
HIGH(0),
|
HIGH(0),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Medium priority - used while loading the 'bare minimum' required to run the game.
|
||||||
|
*/
|
||||||
|
MEDIUM(1),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Low priority - used when a file is not required urgently. The client login screen says
|
* Low priority - used when a file is not required urgently. The client login screen says
|
||||||
* "loading extra files.." when low priority loading is being performed.
|
* "loading extra files.." when low priority loading is being performed.
|
||||||
*/
|
*/
|
||||||
LOW(2),
|
LOW(2);
|
||||||
|
|
||||||
/**
|
|
||||||
* Medium priority - used while loading the 'bare minimum' required to run the game.
|
|
||||||
*/
|
|
||||||
MEDIUM(1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the integer value to a priority.
|
* Converts the integer value to a priority.
|
||||||
*
|
*
|
||||||
* @param v The integer value.
|
* @param value The integer value.
|
||||||
* @return The priority.
|
* @return The priority.
|
||||||
* @throws IllegalArgumentException If the value is outside of the range 1-3 inclusive.
|
* @throws IllegalArgumentException If the value is outside of the range 1-3 inclusive.
|
||||||
*/
|
*/
|
||||||
public static Priority valueOf(int v) {
|
public static Priority valueOf(int value) {
|
||||||
switch (v) {
|
switch (value) {
|
||||||
case 0:
|
case 0:
|
||||||
return HIGH;
|
return HIGH;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -48,22 +48,22 @@ public final class OnDemandRequest implements Comparable<OnDemandRequest> {
|
|||||||
case 2:
|
case 2:
|
||||||
return LOW;
|
return LOW;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Priority out of range.");
|
throw new IllegalArgumentException("Priority out of range - received " + value + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The integer value.
|
* The integer value.
|
||||||
*/
|
*/
|
||||||
private final int intValue;
|
private final int value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a priority.
|
* Creates a priority.
|
||||||
*
|
*
|
||||||
* @param intValue The integer value.
|
* @param value The integer value.
|
||||||
*/
|
*/
|
||||||
private Priority(int intValue) {
|
private Priority(int value) {
|
||||||
this.intValue = intValue;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +72,7 @@ public final class OnDemandRequest implements Comparable<OnDemandRequest> {
|
|||||||
* @return The integer value.
|
* @return The integer value.
|
||||||
*/
|
*/
|
||||||
public int toInteger() {
|
public int toInteger() {
|
||||||
return intValue;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -99,9 +99,9 @@ public final class OnDemandRequest implements Comparable<OnDemandRequest> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(OnDemandRequest o) {
|
public int compareTo(OnDemandRequest other) {
|
||||||
int thisPriority = priority.toInteger();
|
int thisPriority = priority.toInteger();
|
||||||
int otherPriority = o.priority.toInteger();
|
int otherPriority = other.priority.toInteger();
|
||||||
|
|
||||||
if (thisPriority < otherPriority) {
|
if (thisPriority < otherPriority) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user