/**
  * Set the component values of this color attribute. The alpha component will be set to 1.0 (fully
  * opaque).
  *
  * <p>All color component values should be between 0.0 (none) and 1.0 (full).
  *
  * @param red The red component value which the color is to have.
  * @param green The green component value which the color is to have.
  * @param blue The blue component value which the color is to have.
  * @throws IllegalArgumentException If the specified red, green, blue or alpha values are outside
  *     the supported range from 0.0 to 1.0.
  */
 @XmlTransient
 public void set(float red, float green, float blue, float alpha) throws IllegalArgumentException {
   components.setRed(red);
   components.setGreen(green);
   components.setBlue(blue);
   components.setAlpha(alpha);
 }
 /**
  * Get a String representation of the Color attribute.
  *
  * @return A String representation of the color attribute.
  */
 @Override
 public String toString() {
   return String.format(
       "%s [red: %f, green: %f, blue: %f, alpha: %f]",
       getName(),
       components.getRed(),
       components.getGreen(),
       components.getBlue(),
       components.getAlpha());
 }
 /**
  * Create a copy of this ColorStyleAttribute.
  *
  * @return A copy of this ColorStyleAttribute.
  */
 @Override
 public StyleAttribute clone() {
   return new ColorStyleAttribute(
       getName(),
       getDescription(),
       components.getRed(),
       components.getGreen(),
       components.getBlue(),
       components.getAlpha());
 }
 /** {@inheritDoc} */
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof ColorStyleAttribute) {
     ColorStyleAttribute attribute = (ColorStyleAttribute) obj;
     return equal(attribute.getName(), getName())
         && equal(attribute.getDescription(), getDescription())
         && attribute.getRed() == components.getRed()
         && attribute.getGreen() == components.getGreen()
         && attribute.getBlue() == components.getBlue()
         && attribute.getAlpha() == components.getAlpha();
   }
   return false;
 }
 /** {@inheritDoc} */
 @XmlTransient
 @Override
 public boolean setFrom(StyleAttribute otherAttribute) {
   if (otherAttribute instanceof ColorStyleAttribute) {
     ColorStyleAttribute otherColorAttribute = (ColorStyleAttribute) otherAttribute;
     components.setRed(otherColorAttribute.getRed());
     components.setGreen(otherColorAttribute.getGreen());
     components.setBlue(otherColorAttribute.getBlue());
     components.setAlpha(otherColorAttribute.getAlpha());
     return true;
   }
   return false;
 }
 /**
  * Convert the color components to an array of RGBA float values.
  *
  * @return An array of four elements containing the red, green, blue and alpha values
  *     respectively.
  */
 public float[] toArray() {
   return new float[] {
     components.getRed(), components.getGreen(), components.getBlue(), components.getAlpha()
   };
 }
 /**
  * Set the alpha portion of the color value. Values should be between 0.0 (transparent) and 1.0
  * (opaque).
  *
  * @param alpha The alpha portion of the color value.
  * @throws IllegalArgumentException If the specified alpha value was outside the valid range from
  *     0.0 to 1.0.
  */
 @Override
 public void setAlpha(float alpha) throws IllegalArgumentException {
   components.setAlpha(alpha);
 }
 /**
  * Set the blue portion of the color value. Values should be between 0.0 (none) and 1.0 (full).
  *
  * @param blue The blue portion of the color value.
  * @throws IllegalArgumentException If the specified blue value was outside the valid range from
  *     0.0 to 1.0.
  */
 @Override
 public void setBlue(float blue) throws IllegalArgumentException {
   components.setBlue(blue);
 }
 /**
  * Get the alpha portion of the color value. Values should be between 0.0 (transparent) and 1.0
  * (opaque).
  *
  * @return The alpha portion of the color value.
  */
 @Override
 @XmlAttribute(name = "alpha")
 public float getAlpha() {
   return components.getAlpha();
 }
 /**
  * Get the blue portion of the color value. Values should be between 0.0 (none) and 1.0 (full).
  *
  * @return The blue portion of the color value.
  */
 @Override
 @XmlAttribute(name = "blue")
 public float getBlue() {
   return components.getBlue();
 }
 /**
  * Set the green portion of the color value. Values should be between 0.0 (none) and 1.0 (full).
  *
  * @param green The green portion of the color value.
  * @throws IllegalArgumentException If the specified green value was outside the valid range from
  *     0.0 to 1.0.
  */
 @Override
 public void setGreen(float green) throws IllegalArgumentException {
   components.setGreen(green);
 }
 /**
  * Get the green portion of the color value. Values should be between 0.0 (none) and 1.0 (full).
  *
  * @return The green portion of the color value.
  */
 @Override
 @XmlAttribute(name = "green")
 public float getGreen() {
   return components.getGreen();
 }
 /**
  * Set the red portion of the color value. Values should be between 0.0 and 1.0.
  *
  * @param red The red portion of the color value.
  * @throws IllegalArgumentException If the specified red value was outside the valid range from
  *     0.0 to 1.0.
  */
 @Override
 public void setRed(float red) throws IllegalArgumentException {
   components.setRed(red);
 }
 /**
  * Get the red portion of the color value. Values should be between 0.0 and 1.0.
  *
  * @return The red portion of the color value.
  */
 @Override
 @XmlAttribute(name = "red")
 public float getRed() {
   return components.getRed();
 }