You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/04/17 10:42:26 UTC

svn commit: r1739554 - /poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java

Author: onealj
Date: Sun Apr 17 08:42:26 2016
New Revision: 1739554

URL: http://svn.apache.org/viewvc?rev=1739554&view=rev
Log:
add comments

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java?rev=1739554&r1=1739553&r2=1739554&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java Sun Apr 17 08:42:26 2016
@@ -177,35 +177,49 @@ public class HSSFColor implements Color
     }
 
     /**
+     * returns color standard palette index (0x08)
      * @return index to the standard palette
      */
 
     public short getIndex()
     {
+        // this will be overridden by the specific color subclass
         return BLACK.index;
     }
 
     /**
+     * returns  RGB triplet (0, 0, 0)
      * @return  triplet representation like that in Excel
      */
 
     public short [] getTriplet()
     {
+        // this will be overridden by the specific color subclass
         return BLACK.triplet;
     }
 
-    // its a hack but its a good hack
-
     /**
+     * returns colon-delimited hex string "0:0:0"
      * @return a hex string exactly like a gnumeric triplet
      */
 
     public String getHexString()
     {
+        // this will be overridden by the specific color subclass
         return BLACK.hexString;
     }
     
+    /**
+     * Checked type cast <tt>color</tt> to an HSSFColor.
+     *
+     * @param color the color to type cast
+     * @return the type casted color
+     * @throws IllegalArgumentException if color is null or is not an instance of HSSFColor
+     */
     public static HSSFColor toHSSFColor(Color color) {
+        // FIXME: this method would be more useful if it could convert any Color to an HSSFColor
+        // Currently the only benefit of this method is to throw an IllegalArgumentException
+        // instead of a ClassCastException.
         if (color != null && !(color instanceof HSSFColor)) {
             throw new IllegalArgumentException("Only HSSFColor objects are supported");
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org