Last active
November 24, 2016 22:46
-
-
Save CalebWhiting/74c51600106d6074503c to your computer and use it in GitHub Desktop.
DTMCentral
This file contains hidden or 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
| import java.awt.*; | |
| /** | |
| * @author Caleb Date: 28/03/12 Time: 15:22 | |
| */ | |
| public class DTMCentral { | |
| private final Color color; | |
| private final int tolerance; | |
| /** | |
| * @param string "r_g_b_t" | |
| * | |
| * @return returns the String converted into a DTMCentral | |
| */ | |
| public static DTMCentral fromString(final String string) { | |
| final String[] split = string.split("_"); | |
| for (int x = 0; x < split.length; x++) { | |
| split[x] = split[x].replaceFirst("_", ""); | |
| } | |
| final int r = Integer.parseInt(split[0]); | |
| final int g = Integer.parseInt(split[1]); | |
| final int b = Integer.parseInt(split[2]); | |
| final int t = Integer.parseInt(split[3]); | |
| return new DTMCentral(new Color(r, g, b), t); | |
| } | |
| public DTMCentral(final Color color, final int tolerance) { | |
| this.color = color; | |
| this.tolerance = tolerance; | |
| } | |
| public Color getColor() { | |
| return this.color; | |
| } | |
| public int getTolerance() { | |
| return this.tolerance; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment