|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.slashie.util.Util
public class Util
Various utilities to make things easier.
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static int |
abs(int a)
Returns the absolute value of a number. |
static boolean |
chance(int p)
Tells if a random percent roll is at or below a certain number. |
static int |
greater(int a,
int b)
Compares two numbers and returns the larger of them. |
static java.util.Vector |
page(java.util.Vector source,
int elementsOnPage,
int pageNumber)
|
static int |
rand(int low,
int hi)
Used to get a random number within a range, with all numbers being equally likely. |
static java.lang.Object |
randomElementOf(java.util.ArrayList array)
|
static int |
randomElementOf(int[] array)
|
static java.lang.Object |
randomElementOf(java.lang.Object[] array)
|
static java.lang.String |
randomElementOf(java.lang.String[] array)
|
static java.lang.Object |
randomElementOf(java.util.Vector array)
|
static int |
sign(int n)
Gives an indication of the sign (negative or positive) of a specific number. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static int rand(int low, int hi)
low
- low end of rangehi
- high end of range
public static int greater(int a, int b)
a
- b
-
public static int abs(int a)
a
- number to be used
public static boolean chance(int p)
p
- number to test
public static java.util.Vector page(java.util.Vector source, int elementsOnPage, int pageNumber)
public static java.lang.String randomElementOf(java.lang.String[] array)
array
-
public static int randomElementOf(int[] array)
array
-
public static java.lang.Object randomElementOf(java.util.Vector array)
array
-
public static java.lang.Object randomElementOf(java.util.ArrayList array)
array
-
public static java.lang.Object randomElementOf(java.lang.Object[] array)
array
-
public static int sign(int n)
n
- number specified
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |