From: Nick Burch Date: Tue, 14 Jul 2015 23:22:53 +0000 (+0000) Subject: Lookup X-Git-Tag: REL_3_13_BETA1~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=44b5f4f3346c05d5170117770a2d86a377d24715;p=poi.git Lookup git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691104 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/ss/usermodel/IconMultiStateFormatting.java b/src/java/org/apache/poi/ss/usermodel/IconMultiStateFormatting.java index a46717a594..84279c82a8 100644 --- a/src/java/org/apache/poi/ss/usermodel/IconMultiStateFormatting.java +++ b/src/java/org/apache/poi/ss/usermodel/IconMultiStateFormatting.java @@ -19,6 +19,9 @@ package org.apache.poi.ss.usermodel; +import java.util.HashMap; +import java.util.Map; + /** * High level representation for the Icon / Multi-State Formatting * component of Conditional Formatting settings @@ -31,11 +34,23 @@ public interface IconMultiStateFormatting { public final int num; /** Name (system) of the set */ public final String name; + public String toString() { - return id + " - " + (name==null?"default":name); + return id + " - " + getName(); + } + private String getName() { + return (name==null?"default":name); } + + public static IconSet byId(int id) { return byId[id]; } + public static IconSet byName(String name) { return byName.get(name); } + + private static final IconSet[] byId = new IconSet[0x10]; + private static final Map byName = new HashMap(); private IconSet(int id, int num, String name) { this.id = id; this.num = num; this.name = name; + byId[id] = this; + byName.put(getName(),this); } } /** Green Up / Yellow Side / Red Down arrows */ @@ -92,7 +107,7 @@ public interface IconMultiStateFormatting { void setIconOnly(boolean only); boolean isReversed(); - void setReversed(); + void setReversed(boolean reversed); // TODO States }