Changeset 10866 in josm


Ignore:
Timestamp:
2016-08-21T05:59:42+02:00 (8 years ago)
Author:
Don-vip
Message:

see #13232 - remove unused classes from JCS and SvgSalamander

Location:
trunk
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/.classpath

    r10850 r10866  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<classpath>
    3         <classpathentry excluding="org/apache/commons/compress/compressors/CompressorStreamFactory.java|org/apache/commons/compress/compressors/deflate/|org/apache/commons/compress/compressors/gzip/|org/apache/commons/compress/compressors/lzma/|org/apache/commons/compress/compressors/lzw/|org/apache/commons/compress/compressors/pack200/|org/apache/commons/compress/compressors/snappy/|org/apache/commons/compress/compressors/xz/|org/apache/commons/compress/compressors/z/|org/apache/commons/jcs/auxiliary/disk/jdbc/|org/apache/commons/jcs/utils/servlet/|org/apache/commons/logging/impl/AvalonLogger.java|org/apache/commons/logging/impl/Log4JLogger.java|org/apache/commons/logging/impl/LogKitLogger.java|org/apache/commons/logging/impl/ServletContextCleaner.java|org/apache/commons/jcs/admin/servlet/|org/apache/commons/jcs/auxiliary/remote/http/|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java|org/apache/commons/jcs/auxiliary/remote/RemoteCache.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheRestore.java|org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java|org/apache/commons/jcs/auxiliary/remote/server/TimeoutConfigurableRMISocketFactory.java|org/apache/commons/logging/impl/Jdk13LumberjackLogger.java|org/apache/commons/compress/compressors/bzip2/BZip2Utils.java|org/apache/commons/compress/compressors/CompressorException.java|org/apache/commons/compress/compressors/FileNameUtil.java|org/apache/commons/jcs/auxiliary/lateral/socket/tcp/|org/apache/commons/jcs/auxiliary/lateral/LateralCache.java|org/apache/commons/jcs/auxiliary/lateral/LateralCacheAttributes.java|org/apache/commons/jcs/auxiliary/lateral/LateralCacheMonitor.java|org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java|org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/lateral/LateralCommand.java|org/apache/commons/jcs/auxiliary/lateral/LateralElementDescriptor.java|org/apache/commons/jcs/engine/ZombieCacheService.java|org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java|org/apache/commons/jcs/engine/ZombieCacheWatch.java|org/apache/commons/jcs/utils/discovery/|org/apache/commons/jcs/utils/net/|org/apache/commons/jcs/utils/access/|org/apache/commons/jcs/JCS.java|org/apache/commons/jcs/access/PartitionedCacheAccess.java|org/apache/commons/jcs/utils/props/" kind="src" path="src"/>
     3        <classpathentry excluding="org/apache/commons/compress/compressors/CompressorException.java|org/apache/commons/compress/compressors/CompressorStreamFactory.java|org/apache/commons/compress/compressors/FileNameUtil.java|org/apache/commons/compress/compressors/bzip2/BZip2Utils.java|org/apache/commons/compress/compressors/deflate/|org/apache/commons/compress/compressors/gzip/|org/apache/commons/compress/compressors/lzma/|org/apache/commons/compress/compressors/lzw/|org/apache/commons/compress/compressors/pack200/|org/apache/commons/compress/compressors/snappy/|org/apache/commons/compress/compressors/xz/|org/apache/commons/compress/compressors/z/|org/apache/commons/jcs/JCS.java|org/apache/commons/jcs/access/PartitionedCacheAccess.java|org/apache/commons/jcs/admin/servlet/|org/apache/commons/jcs/auxiliary/disk/jdbc/|org/apache/commons/jcs/auxiliary/lateral/|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/remote/RemoteCache.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheRestore.java|org/apache/commons/jcs/auxiliary/remote/http/|org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java|org/apache/commons/jcs/auxiliary/remote/server/TimeoutConfigurableRMISocketFactory.java|org/apache/commons/jcs/engine/ZombieCacheService.java|org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java|org/apache/commons/jcs/engine/ZombieCacheWatch.java|org/apache/commons/jcs/utils/access/|org/apache/commons/jcs/utils/discovery/|org/apache/commons/jcs/utils/net/|org/apache/commons/jcs/utils/props/|org/apache/commons/jcs/utils/servlet/|org/apache/commons/logging/impl/AvalonLogger.java|org/apache/commons/logging/impl/Jdk13LumberjackLogger.java|org/apache/commons/logging/impl/Log4JLogger.java|org/apache/commons/logging/impl/LogKitLogger.java|org/apache/commons/logging/impl/ServletContextCleaner.java|org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCacheMonitor.java|org/apache/commons/jcs/engine/CacheAdaptor.java|org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java|org/apache/commons/jcs/engine/CacheGroup.java|org/apache/commons/jcs/engine/CacheWatchRepairable.java|org/apache/commons/jcs/access/GroupCacheAccess.java|org/apache/commons/jcs/access/behavior/IGroupCacheAccess.java|org/apache/commons/jcs/access/exception/InvalidGroupException.java" kind="src" path="src"/>
    44        <classpathentry including="data/|images/|resources/|styles/" kind="src" path=""/>
    55        <classpathentry kind="src" path="test/unit"/>
  • trunk/build.xml

    r10850 r10866  
    239239            <exclude name="org/apache/commons/compress/compressors/z/**"/>
    240240            <exclude name="org/apache/commons/jcs/JCS.java"/>
     241            <exclude name="org/apache/commons/jcs/access/GroupCacheAccess.java"/>
    241242            <exclude name="org/apache/commons/jcs/access/PartitionedCacheAccess.java"/>
     243            <exclude name="org/apache/commons/jcs/access/behavior/IGroupCacheAccess.java"/>
     244            <exclude name="org/apache/commons/jcs/access/exception/InvalidGroupException.java"/>
    242245            <exclude name="org/apache/commons/jcs/admin/servlet/**"/>
     246            <exclude name="org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCacheMonitor.java"/>
    243247            <exclude name="org/apache/commons/jcs/auxiliary/disk/jdbc/**"/>
    244             <exclude name="org/apache/commons/jcs/auxiliary/lateral/Lateral*.java"/>
    245             <exclude name="org/apache/commons/jcs/auxiliary/lateral/socket/**"/>
     248            <exclude name="org/apache/commons/jcs/auxiliary/lateral/**"/>
    246249            <exclude name="org/apache/commons/jcs/auxiliary/remote/**"/>
     250            <exclude name="org/apache/commons/jcs/engine/CacheAdaptor.java"/>
     251            <exclude name="org/apache/commons/jcs/engine/CacheGroup.java"/>
     252            <exclude name="org/apache/commons/jcs/engine/CacheWatchRepairable.java"/>
    247253            <exclude name="org/apache/commons/jcs/engine/Zombie*.java"/>
     254            <exclude name="org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java"/>
    248255            <exclude name="org/apache/commons/jcs/utils/access/**"/>
    249256            <exclude name="org/apache/commons/jcs/utils/discovery/**"/>
  • trunk/src/com/kitfox/svg/xml/XMLParseUtil.java

    r8084 r10866  
    3838
    3939import com.kitfox.svg.SVGConst;
    40 import org.w3c.dom.*;
    4140import java.awt.*;
    42 import java.net.*;
    4341import java.util.*;
    4442import java.util.regex.*;
    45 import java.lang.reflect.*;
    4643import java.util.logging.Level;
    4744import java.util.logging.Logger;
     
    6158    }
    6259
    63     /**
    64      * Scans the tag's children and returns the first text element found
    65      */
    66     public static String getTagText(Element ele)
    67     {
    68         NodeList nl = ele.getChildNodes();
    69         int size = nl.getLength();
    70 
    71         Node node = null;
    72         int i = 0;
    73         for (; i < size; i++)
    74         {
    75             node = nl.item(i);
    76             if (node instanceof Text) break;
    77         }
    78         if (i == size || node == null) return null;
    79 
    80         return ((Text)node).getData();
    81     }
    82 
    83     /**
    84      * Returns the first node that is a direct child of root with the coresponding
    85      * name.  Does not search children of children.
    86      */
    87     public static Element getFirstChild(Element root, String name)
    88     {
    89         NodeList nl = root.getChildNodes();
    90         int size = nl.getLength();
    91         for (int i = 0; i < size; i++)
    92         {
    93             Node node = nl.item(i);
    94             if (!(node instanceof Element)) continue;
    95             Element ele = (Element)node;
    96             if (ele.getTagName().equals(name)) return ele;
    97         }
    98 
    99         return null;
    100     }
    101 
    10260    public static String[] parseStringList(String list)
    10361    {
    104 //        final Pattern patWs = Pattern.compile("\\s+");
    10562        final Matcher matchWs = Pattern.compile("[^\\s]+").matcher("");
    10663        matchWs.reset(list);
     
    11673    }
    11774
    118     public static boolean isDouble(String val)
    119     {
    120         fpMatch.reset(val);
    121         return fpMatch.matches();
    122     }
    123    
    12475    public static double parseDouble(String val)
    12576    {
     
    233184    }
    234185
    235     public static float parseFloat(String val)
    236     {
    237         /*
    238         if (val == null) return 0f;
    239 
    240         float retVal = 0f;
    241         try
    242         { retVal = Float.parseFloat(val); }
    243         catch (Exception e)
    244         {}
    245         return retVal;
    246          */
    247         return findFloat(val);
    248     }
    249 
    250186    /**
    251187     * Searches the given string for the first floating point number it contains,
     
    298234    }
    299235
    300     public static int parseInt(String val)
     236    /**
     237     * Searches the given string for the first integer point number it contains,
     238     * parses and returns it.
     239     */
     240    public static int findInt(String val)
    301241    {
    302242        if (val == null) return 0;
     243
     244        intMatch.reset(val);
     245        if (!intMatch.find()) return 0;
     246
     247        val = intMatch.group();
    303248
    304249        int retVal = 0;
     
    310255    }
    311256
    312     /**
    313      * Searches the given string for the first integer point number it contains,
    314      * parses and returns it.
    315      */
    316     public static int findInt(String val)
    317     {
    318         if (val == null) return 0;
    319 
    320         intMatch.reset(val);
    321         if (!intMatch.find()) return 0;
    322 
    323         val = intMatch.group();
    324         //System.err.println("Parsing " + val);
    325 
    326         int retVal = 0;
    327         try
    328         { retVal = Integer.parseInt(val); }
    329         catch (Exception e)
    330         {}
    331         return retVal;
    332     }
    333 
    334257    public static int[] parseIntList(String list)
    335258    {
     
    355278        return retArr;
    356279    }
    357 /*
    358     public static int parseHex(String val)
    359     {
    360         int retVal = 0;
    361        
    362         for (int i = 0; i < val.length(); i++)
    363         {
    364             retVal <<= 4;
    365            
    366             char ch = val.charAt(i);
    367             if (ch >= '0' && ch <= '9')
    368             {
    369                 retVal |= ch - '0';
    370             }
    371             else if (ch >= 'a' && ch <= 'z')
    372             {
    373                 retVal |= ch - 'a' + 10;
    374             }
    375             else if (ch >= 'A' && ch <= 'Z')
    376             {
    377                 retVal |= ch - 'A' + 10;
    378             }
    379             else throw new RuntimeException();
    380         }
    381        
    382         return retVal;
    383     }
    384 */
     280
    385281    /**
    386282     * The input string represents a ratio.  Can either be specified as a
     
    403299
    404300        return new NumberWithUnits(val);
    405     }
    406 /*
    407     public static Color parseColor(String val)
    408     {
    409         Color retVal = null;
    410 
    411         if (val.charAt(0) == '#')
    412         {
    413             String hexStrn = val.substring(1);
    414            
    415             if (hexStrn.length() == 3)
    416             {
    417                 hexStrn = "" + hexStrn.charAt(0) + hexStrn.charAt(0) + hexStrn.charAt(1) + hexStrn.charAt(1) + hexStrn.charAt(2) + hexStrn.charAt(2);
    418             }
    419             int hexVal = parseHex(hexStrn);
    420 
    421             retVal = new Color(hexVal);
    422         }
    423         else
    424         {
    425             final Matcher rgbMatch = Pattern.compile("rgb\\((\\d+),(\\d+),(\\d+)\\)", Pattern.CASE_INSENSITIVE).matcher("");
    426 
    427             rgbMatch.reset(val);
    428             if (rgbMatch.matches())
    429             {
    430                 int r = Integer.parseInt(rgbMatch.group(1));
    431                 int g = Integer.parseInt(rgbMatch.group(2));
    432                 int b = Integer.parseInt(rgbMatch.group(3));
    433                 retVal = new Color(r, g, b);
    434             }
    435             else
    436             {
    437                 Color lookupCol = ColorTable.instance().lookupColor(val);
    438                 if (lookupCol != null) retVal = lookupCol;
    439             }
    440         }
    441 
    442         return retVal;
    443     }
    444 */
    445     /**
    446      * Parses the given attribute of this tag and returns it as a String.
    447      */
    448     public static String getAttribString(Element ele, String name)
    449     {
    450         return ele.getAttribute(name);
    451     }
    452 
    453     /**
    454      * Parses the given attribute of this tag and returns it as an int.
    455      */
    456     public static int getAttribInt(Element ele, String name)
    457     {
    458         String sval = ele.getAttribute(name);
    459         int val = 0;
    460         try { val = Integer.parseInt(sval); } catch (Exception e) {}
    461 
    462         return val;
    463     }
    464 
    465     /**
    466      * Parses the given attribute of this tag as a hexadecimal encoded string and
    467      * returns it as an int
    468      */
    469     public static int getAttribIntHex(Element ele, String name)
    470     {
    471         String sval = ele.getAttribute(name);
    472         int val = 0;
    473         try { val = Integer.parseInt(sval, 16); } catch (Exception e) {}
    474 
    475         return val;
    476     }
    477 
    478     /**
    479      * Parses the given attribute of this tag and returns it as a float
    480      */
    481     public static float getAttribFloat(Element ele, String name)
    482     {
    483         String sval = ele.getAttribute(name);
    484         float val = 0.0f;
    485         try { val = Float.parseFloat(sval); } catch (Exception e) {}
    486 
    487         return val;
    488     }
    489 
    490     /**
    491      * Parses the given attribute of this tag and returns it as a double.
    492      */
    493     public static double getAttribDouble(Element ele, String name)
    494     {
    495         String sval = ele.getAttribute(name);
    496         double val = 0.0;
    497         try { val = Double.parseDouble(sval); } catch (Exception e) {}
    498 
    499         return val;
    500     }
    501 
    502     /**
    503      * Parses the given attribute of this tag and returns it as a boolean.
    504      * Essentially compares the lower case textual value to the string "true"
    505      */
    506     public static boolean getAttribBoolean(Element ele, String name)
    507     {
    508         String sval = ele.getAttribute(name);
    509 
    510         return sval.toLowerCase().equals("true");
    511     }
    512 
    513     public static URL getAttribURL(Element ele, String name, URL docRoot)
    514     {
    515         String sval = ele.getAttribute(name);
    516 
    517         URL url;
    518         try
    519         {
    520             return new URL(docRoot, sval);
    521         }
    522         catch (Exception e)
    523         {
    524             return null;
    525         }
    526     }
    527 
    528     /**
    529      * Returns the first ReadableXMLElement with the given name
    530      */
    531     public static ReadableXMLElement getElement(Class classType, Element root, String name, URL docRoot)
    532     {
    533         if (root == null) return null;
    534 
    535         //Do not process if not a LoadableObject
    536         if (!ReadableXMLElement.class.isAssignableFrom(classType))
    537         {
    538             return null;
    539         }
    540 
    541         NodeList nl = root.getChildNodes();
    542         int size = nl.getLength();
    543         for (int i = 0; i < size; i++)
    544         {
    545             Node node = nl.item(i);
    546             if (!(node instanceof Element)) continue;
    547             Element ele = (Element)node;
    548             if (!ele.getTagName().equals(name)) continue;
    549 
    550             ReadableXMLElement newObj = null;
    551             try
    552             {
    553                 newObj = (ReadableXMLElement)classType.newInstance();
    554             }
    555             catch (Exception e)
    556             {
    557                 Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
    558                 continue;
    559             }
    560             newObj.read(ele, docRoot);
    561 
    562             if (newObj == null) continue;
    563 
    564             return newObj;
    565         }
    566 
    567         return null;
    568     }
    569 
    570     /**
    571      * Returns a HashMap of nodes that are children of root.  All nodes will
    572      * be of class classType and have a tag name of 'name'.  'key' is
    573      * an attribute of tag 'name' who's string value will be used as the key
    574      * in the HashMap
    575      */
    576     public static HashMap getElementHashMap(Class classType, Element root, String name, String key, URL docRoot)
    577     {
    578         if (root == null) return null;
    579 
    580         //Do not process if not a LoadableObject
    581         if (!ReadableXMLElement.class.isAssignableFrom(classType))
    582         {
    583             return null;
    584         }
    585 
    586         HashMap retMap = new HashMap();
    587 
    588         NodeList nl = root.getChildNodes();
    589         int size = nl.getLength();
    590         for (int i = 0; i < size; i++)
    591         {
    592             Node node = nl.item(i);
    593             if (!(node instanceof Element)) continue;
    594             Element ele = (Element)node;
    595             if (!ele.getTagName().equals(name)) continue;
    596 
    597             ReadableXMLElement newObj = null;
    598             try
    599             {
    600                 newObj = (ReadableXMLElement)classType.newInstance();
    601             }
    602             catch (Exception e)
    603             {
    604                 Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
    605                 continue;
    606             }
    607             newObj.read(ele, docRoot);
    608 
    609             if (newObj == null) continue;
    610 
    611             String keyVal = getAttribString(ele, key);
    612             retMap.put(keyVal, newObj);
    613         }
    614 
    615         return retMap;
    616     }
    617 
    618     public static HashSet getElementHashSet(Class classType, Element root, String name, URL docRoot)
    619     {
    620         if (root == null) return null;
    621 
    622         //Do not process if not a LoadableObject
    623         if (!ReadableXMLElement.class.isAssignableFrom(classType))
    624         {
    625             return null;
    626         }
    627 
    628         HashSet retSet = new HashSet();
    629 
    630         NodeList nl = root.getChildNodes();
    631         int size = nl.getLength();
    632         for (int i = 0; i < size; i++)
    633         {
    634             Node node = nl.item(i);
    635             if (!(node instanceof Element)) continue;
    636             Element ele = (Element)node;
    637             if (!ele.getTagName().equals(name)) continue;
    638 
    639             ReadableXMLElement newObj = null;
    640             try
    641             {
    642                 newObj = (ReadableXMLElement)classType.newInstance();
    643             }
    644             catch (Exception e)
    645             {
    646                 Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
    647                 continue;
    648             }
    649             newObj.read(ele, docRoot);
    650 
    651             if (newObj == null)
    652             {
    653                 continue;
    654             }
    655 
    656             retSet.add(newObj);
    657         }
    658 
    659         return retSet;
    660     }
    661 
    662 
    663     public static LinkedList getElementLinkedList(Class classType, Element root, String name, URL docRoot)
    664     {
    665         if (root == null) return null;
    666 
    667         //Do not process if not a LoadableObject
    668         if (!ReadableXMLElement.class.isAssignableFrom(classType))
    669         {
    670             return null;
    671         }
    672 
    673         NodeList nl = root.getChildNodes();
    674         LinkedList elementCache = new LinkedList();
    675         int size = nl.getLength();
    676         for (int i = 0; i < size; i++)
    677         {
    678             Node node = nl.item(i);
    679             if (!(node instanceof Element)) continue;
    680             Element ele = (Element)node;
    681             if (!ele.getTagName().equals(name)) continue;
    682 
    683             ReadableXMLElement newObj = null;
    684             try
    685             {
    686                 newObj = (ReadableXMLElement)classType.newInstance();
    687             }
    688             catch (Exception e)
    689             {
    690                 Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
    691                 continue;
    692             }
    693             newObj.read(ele, docRoot);
    694 
    695             elementCache.addLast(newObj);
    696         }
    697 
    698         return elementCache;
    699     }
    700 
    701     public static Object[] getElementArray(Class classType, Element root, String name, URL docRoot)
    702     {
    703         if (root == null) return null;
    704 
    705         //Do not process if not a LoadableObject
    706         if (!ReadableXMLElement.class.isAssignableFrom(classType))
    707         {
    708             return null;
    709         }
    710 
    711         LinkedList elementCache = getElementLinkedList(classType, root, name, docRoot);
    712 
    713         Object[] retArr = (Object[])Array.newInstance(classType, elementCache.size());
    714         return elementCache.toArray(retArr);
    715     }
    716 
    717     /**
    718      * Takes a number of tags of name 'name' that are children of 'root', and
    719      * looks for attributes of 'attrib' on them.  Converts attributes to an
    720      * int and returns in an array.
    721      */
    722     public static int[] getElementArrayInt(Element root, String name, String attrib)
    723     {
    724         if (root == null) return null;
    725 
    726         NodeList nl = root.getChildNodes();
    727         LinkedList elementCache = new LinkedList();
    728         int size = nl.getLength();
    729 
    730         for (int i = 0; i < size; i++)
    731         {
    732             Node node = nl.item(i);
    733             if (!(node instanceof Element)) continue;
    734             Element ele = (Element)node;
    735             if (!ele.getTagName().equals(name)) continue;
    736 
    737             String valS = ele.getAttribute(attrib);
    738             int eleVal = 0;
    739             try { eleVal = Integer.parseInt(valS); }
    740             catch (Exception e) {}
    741 
    742             elementCache.addLast(new Integer(eleVal));
    743         }
    744 
    745         int[] retArr = new int[elementCache.size()];
    746         Iterator it = elementCache.iterator();
    747         int idx = 0;
    748         while (it.hasNext())
    749         {
    750             retArr[idx++] = ((Integer)it.next()).intValue();
    751         }
    752 
    753         return retArr;
    754     }
    755 
    756     /**
    757      * Takes a number of tags of name 'name' that are children of 'root', and
    758      * looks for attributes of 'attrib' on them.  Converts attributes to an
    759      * int and returns in an array.
    760      */
    761     public static String[] getElementArrayString(Element root, String name, String attrib)
    762     {
    763         if (root == null) return null;
    764 
    765         NodeList nl = root.getChildNodes();
    766         LinkedList elementCache = new LinkedList();
    767         int size = nl.getLength();
    768 
    769         for (int i = 0; i < size; i++)
    770         {
    771             Node node = nl.item(i);
    772             if (!(node instanceof Element)) continue;
    773             Element ele = (Element)node;
    774             if (!ele.getTagName().equals(name)) continue;
    775 
    776             String valS = ele.getAttribute(attrib);
    777 
    778             elementCache.addLast(valS);
    779         }
    780 
    781         String[] retArr = new String[elementCache.size()];
    782         Iterator it = elementCache.iterator();
    783         int idx = 0;
    784         while (it.hasNext())
    785         {
    786             retArr[idx++] = (String)it.next();
    787         }
    788 
    789         return retArr;
    790     }
    791 
    792     /**
    793      * Takes a CSS style string and retursn a hash of them.
    794      * @param styleString - A CSS formatted string of styles.  Eg,
    795      *     "font-size:12;fill:#d32c27;fill-rule:evenodd;stroke-width:1pt;"
    796      */
    797     public static HashMap parseStyle(String styleString) {
    798         return parseStyle(styleString, new HashMap());
    799301    }
    800302
Note: See TracChangeset for help on using the changeset viewer.