Skip to content

Instantly share code, notes, and snippets.

@ollieread
Created February 12, 2015 18:11
/**
* The available sizes for eletromagnetic pockets, including the maximum
* size.
*
* @author ollieread
*
*/
public static enum PocketSize {
SMALL(16), MEDIUM(32), LARGE(64), SUPER(128);
public final int maxSize;
private PocketSize(int maxSize)
{
this.maxSize = maxSize;
}
public static PocketSize getPocketSize(int size)
{
PocketSize[] types = PocketSize.values();
for (int i = 0; i < types.length; i++) {
if (types[i].maxSize > size) {
return types[i];
}
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment