Added //count and //distr.

This commit is contained in:
sk89q
2010-11-16 22:59:53 -08:00
parent 7f2391649e
commit f810b18f07
3 changed files with 167 additions and 1 deletions

View File

@ -23,7 +23,7 @@ package com.sk89q.worldedit;
*
* @author sk89q
*/
public class Countable<T> {
public class Countable<T> implements Comparable<Countable<T>> {
/**
* ID.
*/
@ -71,4 +71,34 @@ public class Countable<T> {
public void setAmount(int amount) {
this.amount = amount;
}
/**
* Decrement the amount.
*/
public void decrement() {
this.amount--;
}
/**
* Increment the amount.
*/
public void increment() {
this.amount++;
}
/**
* Comparison.
*
* @param other
* @return
*/
public int compareTo(Countable<T> other) {
if (amount > other.amount) {
return 1;
} else if (amount == other.amount) {
return 0;
} else {
return -1;
}
}
}