@Test public void ColorNameTest() { for (GralogColor.Color c : GralogColor.Color.values()) { String expectedResult = c.name(); GralogColor color = new GralogColor(c.value); assertEquals(expectedResult, color.name()); } String expectedResult = "WHITE"; GralogColor color = new GralogColor(0xFFFFFF); assertEquals(expectedResult, color.name()); }
public String name() { for (Color c : Color.values()) { if (c.value == (((r & 0x0FF) << 16) | ((g & 0x0FF) << 8) | (b & 0x0FF))) { return c.name(); } } return Integer.toHexString(r) + Integer.toHexString(g) + Integer.toHexString(b); }
GralogColor implements Serializable { public String name() { for (Color c : Color.values()) { if (c.value == (((r & 0x0FF) << 16) | ((g & 0x0FF) << 8) | (b & 0x0FF))) { return c.name(); } } return Integer.toHexString(r) + Integer.toHexString(g) + Integer.toHexString(b); } }
GralogColor implements Serializable { public String name() { for (Color c : Color.values()) { if (c.value == (((r & 0x0FF) << 16) | ((g & 0x0FF) << 8) | (b & 0x0FF))) { return c.name(); } } return Integer.toHexString(r) + Integer.toHexString(g) + Integer.toHexString(b); } GralogColor(String hex);  GralogColor(int red, int green, int blue);  GralogColor(short red, short green, short blue);  GralogColor(int rgb);  GralogColor(GralogColor c); }
GralogColor implements Serializable { public String name() { for (Color c : Color.values()) { if (c.value == (((r & 0x0FF) << 16) | ((g & 0x0FF) << 8) | (b & 0x0FF))) { return c.name(); } } return Integer.toHexString(r) + Integer.toHexString(g) + Integer.toHexString(b); } GralogColor(String hex);  GralogColor(int red, int green, int blue);  GralogColor(short red, short green, short blue);  GralogColor(int rgb);  GralogColor(GralogColor c); static GralogColor parseColor(String htmlString); static GralogColor parseColorAlpha(String htmlString); int getValue(Color c); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); String toHtmlString(); static boolean isColor(String s); String name(); GralogColor inverse(); static int numberNamedColors(); static HashMap<Integer, Color> IntegerToColor(); }
GralogColor implements Serializable { public String name() { for (Color c : Color.values()) { if (c.value == (((r & 0x0FF) << 16) | ((g & 0x0FF) << 8) | (b & 0x0FF))) { return c.name(); } } return Integer.toHexString(r) + Integer.toHexString(g) + Integer.toHexString(b); } GralogColor(String hex);  GralogColor(int red, int green, int blue);  GralogColor(short red, short green, short blue);  GralogColor(int rgb);  GralogColor(GralogColor c); static GralogColor parseColor(String htmlString); static GralogColor parseColorAlpha(String htmlString); int getValue(Color c); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); String toHtmlString(); static boolean isColor(String s); String name(); GralogColor inverse(); static int numberNamedColors(); static HashMap<Integer, Color> IntegerToColor(); static final GralogColor BLACK; static final GralogColor RED; static final GralogColor GREEN; static final GralogColor BLUE; static final GralogColor WHITE; final short r; final short g; final short b; }