Package org.apache.sis.io.wkt
Class Colors
- Object
-
- Colors
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class Colors extends Object implements Cloneable, Serializable
The colors to use for formatting Well Known Text (WKT) objects. Colors are identified by their names and can be mapped toElementKind
. The currently supported color names are:"red"
,"green"
,"yellow"
,"blue"
,"magenta"
,"cyan"
,"gray"
.
- Since:
- 0.4
- See Also:
WKTFormat.getColors()
,WKTFormat.setColors(Colors)
, Serialized Form
Defined in the
sis-referencing
module
-
-
Field Summary
Fields Modifier and Type Field Description static Colors
DEFAULT
The default colors used byFormattableObject.print()
.static Colors
NAMING
Emphases on identification information (name and identifiers) only.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Colors
clone()
Returns a clone of thisColors
.boolean
equals(Object other)
Compares thisColors
with the given object for equality.String
getName(ElementKind key)
Returns the color for the given syntactic element.int
hashCode()
Returns a hash code value for this object.void
setName(ElementKind key, String color)
Sets the color of the given syntactic element from a color name.
-
-
-
Field Detail
-
DEFAULT
public static final Colors DEFAULT
The default colors used byFormattableObject.print()
. Those colors give better results on aConsole
with black background. This map is immutable.- See Also:
FormattableObject.print()
-
NAMING
public static final Colors NAMING
Emphases on identification information (name and identifiers) only. This map is immutable.
-
-
Constructor Detail
-
Colors
public Colors()
Creates a new, initially empty, set of colors.
-
Colors
public Colors(Colors colors)
Creates a new set of colors initialized to a copy of the given one.- Parameters:
colors
- the set of colors to copy.
-
-
Method Detail
-
setName
public void setName(ElementKind key, String color) throws IllegalArgumentException
Sets the color of the given syntactic element from a color name. The color names supported in the current implementation are"red"
,"green"
,"yellow"
,"blue"
,"magenta"
,"cyan"
and"gray"
, case-insensitive.- Parameters:
key
- the syntactic element for which to set the color.color
- the color to give to the specified element, ornull
if none.- Throws:
IllegalArgumentException
- if the given color name is not recognized.
-
getName
public final String getName(ElementKind key)
Returns the color for the given syntactic element.- Parameters:
key
- the syntactic element for which to get the color.- Returns:
- the color of the specified element, or
null
if none.
-
clone
public Colors clone()
Returns a clone of thisColors
.
-
equals
public boolean equals(Object other)
Compares thisColors
with the given object for equality.
-
-