/gist:34795524f96908446d9f Secret
Created
February 12, 2015 18:11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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