org.cip4.jdflib.datatypes
Class JDFRGBColor

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<Object>
              extended by org.cip4.jdflib.datatypes.JDFNumList
                  extended by org.cip4.jdflib.datatypes.JDFRGBColor
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Object>, Collection<Object>, List<Object>, RandomAccess, JDFBaseDataTypes

public class JDFRGBColor
extends JDFNumList

This class is a representation of a RGB color (JDFRGBColor). It is a blank separated list of double values consisting of R the red color, G the green color and B the blue color value.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
JDFBaseDataTypes.EnumFitsValue
 
Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
EPSILON, MAX_CMYK_COLOR, MAX_LAB_COLOR, MAX_MATRIX_DIMENSION, MAX_RECTANGLE_DIMENSION, MAX_RGB_COLOR, MAX_SHAPE_DIMENSION, MAX_XY_DIMENSION
 
Constructor Summary
JDFRGBColor()
          constructs a RGB color with all values set to 0.0 Double
JDFRGBColor(double r, double g, double b)
          constructs a new RGB color with the given double values
JDFRGBColor(JDFNumList nl)
          constructs a RGB color with all values set via a JDFNumberList
JDFRGBColor(String s)
          constructs a RGB color with all values set via a String
JDFRGBColor(Vector v)
          Deprecated. use typesafe constructors
 
Method Summary
static JDFRGBColor createRGBColor(String s)
          factory for JDFXYPair that silently returns null in case of illegal strings
 double getB()
          getBlue - returns the blue color
 double getG()
          getG - returns the green color
 String getHTMLColor()
          get the html color representation of this color in the format 0xrrggbb;
 double getR()
          getR - returns the red color
 boolean isValid()
          isValid - true if the size of the vector is 3 and all instances are Double types
 void setB(double blue)
          setBlue - sets the blue color
 void setG(double green)
          setGreen - sets the green color
 void setR(double red)
          setR - sets the red color
 
Methods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, clone, contains, containsAll, copyNumList, doubleAt, elementAt, equals, getDoubleList, getIntArray, getString, getString, hashCode, isValidString, matches, removeElementAt, replaceElementAt, scale, scaleFromCM, scaleFromMM, scaleToCM, scaleToMM, set, setString, subtract, toString, unify
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elements, ensureCapacity, firstElement, get, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

JDFRGBColor

public JDFRGBColor()
constructs a RGB color with all values set to 0.0 Double


JDFRGBColor

@Deprecated
public JDFRGBColor(Vector v)
            throws DataFormatException
Deprecated. use typesafe constructors

constructs a RGB color with all values set via a Vector of Double objects

Parameters:
v - Vector of Double
Throws:
DataFormatException - - if the Vector has not a valid format

JDFRGBColor

public JDFRGBColor(String s)
            throws DataFormatException
constructs a RGB color with all values set via a String

Parameters:
s - the given String
Throws:
DataFormatException - - if the String has not a valid format

JDFRGBColor

public JDFRGBColor(JDFNumList nl)
            throws DataFormatException
constructs a RGB color with all values set via a JDFNumberList

Parameters:
nl - the given number list
Throws:
DataFormatException - - if the String has not a valid format

JDFRGBColor

public JDFRGBColor(double r,
                   double g,
                   double b)
constructs a new RGB color with the given double values

Parameters:
r - the color red
g - the color green
b - the color blue
Method Detail

createRGBColor

public static JDFRGBColor createRGBColor(String s)
factory for JDFXYPair that silently returns null in case of illegal strings

Parameters:
s - the string to parse
Returns:
the JDFXYPair, null if s is not compatible

isValid

public boolean isValid()
                throws DataFormatException
isValid - true if the size of the vector is 3 and all instances are Double types

Specified by:
isValid in class JDFNumList
Returns:
boolean - true if all instances are Double or Integer types
Throws:
DataFormatException - - if the Vector has not a valid format

getR

public double getR()
getR - returns the red color

Returns:
double - the red color

setR

public void setR(double red)
setR - sets the red color

Parameters:
red - the red color

getG

public double getG()
getG - returns the green color

Returns:
double - the green color

setG

public void setG(double green)
setGreen - sets the green color

Parameters:
green - the green color

getB

public double getB()
getBlue - returns the blue color

Returns:
double - the blue color

setB

public void setB(double blue)
setBlue - sets the blue color

Parameters:
blue - the blue color

getHTMLColor

public String getHTMLColor()
get the html color representation of this color in the format 0xrrggbb;

Returns:
the formatted string


Copyright © 2013. All Rights Reserved.