Lines 19-25
package org.apache.poi.hssf.util;
Link Here
|
19 |
|
19 |
|
20 |
import java.lang.reflect.Field; |
20 |
import java.lang.reflect.Field; |
21 |
import java.util.Collections; |
21 |
import java.util.Collections; |
22 |
import java.util.Hashtable; |
22 |
import java.util.HashMap; |
23 |
import java.util.Map; |
23 |
import java.util.Map; |
24 |
|
24 |
|
25 |
import org.apache.poi.ss.usermodel.Color; |
25 |
import org.apache.poi.ss.usermodel.Color; |
Lines 57-74
public class HSSFColor implements Color {
Link Here
|
57 |
return indexHash; |
57 |
return indexHash; |
58 |
} |
58 |
} |
59 |
/** |
59 |
/** |
60 |
* This function returns all the Colours, stored in a Hashtable that |
60 |
* This function returns all the Colours, stored in a Map that |
61 |
* can be edited. No caching is performed. If you don't need to edit |
61 |
* can be edited. No caching is performed. If you don't need to edit |
62 |
* the table, then call {@link #getIndexHash()} which returns a |
62 |
* the table, then call {@link #getIndexHash()} which returns a |
63 |
* statically cached imuatable map of colours. |
63 |
* statically cached imuatable map of colours. |
64 |
*/ |
64 |
*/ |
65 |
public final static Hashtable<Integer,HSSFColor> getMutableIndexHash() { |
65 |
public final static Map<Integer,HSSFColor> getMutableIndexHash() { |
66 |
return createColorsByIndexMap(); |
66 |
return createColorsByIndexMap(); |
67 |
} |
67 |
} |
68 |
|
68 |
|
69 |
private static Hashtable<Integer,HSSFColor> createColorsByIndexMap() { |
69 |
private static Map<Integer,HSSFColor> createColorsByIndexMap() { |
70 |
HSSFColor[] colors = getAllColors(); |
70 |
HSSFColor[] colors = getAllColors(); |
71 |
Hashtable<Integer,HSSFColor> result = new Hashtable<Integer,HSSFColor>(colors.length * 3 / 2); |
71 |
Map<Integer,HSSFColor> result = new HashMap<Integer,HSSFColor>(colors.length * 3 / 2); |
72 |
|
72 |
|
73 |
for (int i = 0; i < colors.length; i++) { |
73 |
for (int i = 0; i < colors.length; i++) { |
74 |
HSSFColor color = colors[i]; |
74 |
HSSFColor color = colors[i]; |
Lines 148-163
public class HSSFColor implements Color {
Link Here
|
148 |
* it takes to create it once per request but you will not hold onto it |
148 |
* it takes to create it once per request but you will not hold onto it |
149 |
* if you have none of those requests. |
149 |
* if you have none of those requests. |
150 |
* |
150 |
* |
151 |
* @return a hashtable containing all colors keyed by String gnumeric-like triplets |
151 |
* @return a Map containing all colors keyed by String gnumeric-like triplets |
152 |
*/ |
152 |
*/ |
153 |
public final static Hashtable<String,HSSFColor> getTripletHash() |
153 |
public final static Map<String,HSSFColor> getTripletHash() |
154 |
{ |
154 |
{ |
155 |
return createColorsByHexStringMap(); |
155 |
return createColorsByHexStringMap(); |
156 |
} |
156 |
} |
157 |
|
157 |
|
158 |
private static Hashtable<String,HSSFColor> createColorsByHexStringMap() { |
158 |
private static Map<String,HSSFColor> createColorsByHexStringMap() { |
159 |
HSSFColor[] colors = getAllColors(); |
159 |
HSSFColor[] colors = getAllColors(); |
160 |
Hashtable<String,HSSFColor> result = new Hashtable<String,HSSFColor>(colors.length * 3 / 2); |
160 |
Map<String,HSSFColor> result = new HashMap<String,HSSFColor>(colors.length * 3 / 2); |
161 |
|
161 |
|
162 |
for (int i = 0; i < colors.length; i++) { |
162 |
for (int i = 0; i < colors.length; i++) { |
163 |
HSSFColor color = colors[i]; |
163 |
HSSFColor color = colors[i]; |
Lines 1683-1689
public class HSSFColor implements Color {
Link Here
|
1683 |
|
1683 |
|
1684 |
/** |
1684 |
/** |
1685 |
* Special Default/Normal/Automatic color. |
1685 |
* Special Default/Normal/Automatic color. |
1686 |
* <p><i>Note:</i> This class is NOT in the default HashTables returned by HSSFColor. |
1686 |
* <p><i>Note:</i> This class is NOT in the default Map returned by HSSFColor. |
1687 |
* The index is a special case which is interpreted in the various setXXXColor calls. |
1687 |
* The index is a special case which is interpreted in the various setXXXColor calls. |
1688 |
* |
1688 |
* |
1689 |
* @author Jason |
1689 |
* @author Jason |