|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.velocity.DataTool
public class DataTool
Some helpful methods for dealing with data in velocity.
| Constructor Summary | |
|---|---|
DataTool()
|
|
| Method Summary | ||
|---|---|---|
double |
add(double a,
double b)
Double addition. |
|
float |
div(float a,
float b)
Floating point divide. |
|
Object |
get(Object array,
int index)
Returns the object in the array at index. |
|
int |
length(Object array)
Returns the length of the specified array. |
|
int |
percent(int num,
int denom)
Returns the numerator as a percentage of the denominator (100 * num / denom), handles 0/0 (returns 0), but will div0 on N/0 where N ! |
|
|
sort(Collection<T> data)
Copies the data from the supplied collection into a list, sorts it and returns the list. |
|
|
sort(Iterator<T> iter)
Copies the data from the supplied iterator into a list, sorts it and returns the list. |
|
|
sort(List<T> list)
Sorts the supplied list and returns it. |
|
Object |
unwrap(Object array)
Returns the object at location zero in the array, super useful for those length 1 arrays (like when you are storing primitives in a hash) |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DataTool()
| Method Detail |
|---|
public Object unwrap(Object array)
public Object get(Object array,
int index)
public int length(Object array)
public int percent(int num,
int denom)
public float div(float a,
float b)
public double add(double a,
double b)
public <T extends Comparable<? super T>> List<T> sort(List<T> list)
Comparable.
public <T extends Comparable<? super T>> List<T> sort(Collection<T> data)
Comparable.
public <T extends Comparable<? super T>> List<T> sort(Iterator<T> iter)
Comparable.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||