cvs commit: xml-fop/src/org/apache/fop/configuration ConfigurationParser.java

2002-05-07 Thread pbwest

pbwest  02/05/07 08:11:15

  Modified:src/org/apache/fop/configuration Tag: FOP_0-20-0_Alt-Design
ConfigurationParser.java
  Log:
  Vector->ArrayList Hashtable->HashMap
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.9.4.1   +21 -21
xml-fop/src/org/apache/fop/configuration/ConfigurationParser.java
  
  Index: ConfigurationParser.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/configuration/ConfigurationParser.java,v
  retrieving revision 1.9
  retrieving revision 1.9.4.1
  diff -u -r1.9 -r1.9.4.1
  --- ConfigurationParser.java  30 Jul 2001 20:29:18 -  1.9
  +++ ConfigurationParser.java  7 May 2002 15:11:15 -   1.9.4.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: ConfigurationParser.java,v 1.9 2001/07/30 20:29:18 tore Exp $
  + * $Id: ConfigurationParser.java,v 1.9.4.1 2002/05/07 15:11:15 pbwest Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
  @@ -14,8 +14,8 @@
   import org.xml.sax.Locator;
   
   // java
  -import java.util.Hashtable;
  -import java.util.Vector;
  +import java.util.HashMap;
  +import java.util.ArrayList;
   
   // fop
   import org.apache.fop.messaging.MessageHandler;
  @@ -45,12 +45,12 @@
   private int datatype = -1;
   
   // store the result configuration
  -private static Hashtable configuration;
  -private static Hashtable activeConfiguration;
  +private static HashMap configuration;
  +private static HashMap activeConfiguration;
   
   // stores key for new config entry
   private String key = "";
  -private Vector keyStack = new Vector();
  +private ArrayList keyStack = new ArrayList();
   
   // stores string value
   private String value = "";
  @@ -59,10 +59,10 @@
   private String subkey = "";
   
   // stores list value
  -private Vector list = new Vector(15);
  +private ArrayList list = new ArrayList(15);
   
   // stores hashtable value
  -private Hashtable map = new Hashtable(15);
  +private HashMap map = new HashMap(15);
   
   /**
* locator for line number information
  @@ -75,7 +75,7 @@
   private String role = "standard";
   
   // stores fonts
  -private Vector fontList = null;
  +private ArrayList fontList = null;
   
   // stores information on one font
   private FontInfo fontInfo = null;
  @@ -86,7 +86,7 @@
   // information on a font
   private String fontName, metricsFile, embedFile, kerningAsString;
   private boolean kerning;
  -private Vector fontTriplets;
  +private ArrayList fontTriplets;
   
   // information on a font triplet
   private String fontTripletName, weight, style;
  @@ -125,7 +125,7 @@
   }
   } else if (localName.equals("configuration")) {}
   else if (localName.equals("fonts")) {// list of fonts starts
  -fontList = new Vector(10);
  +fontList = new ArrayList(10);
   } else if (localName.equals("font")) {
   kerningAsString = attributes.getValue("kerning");
   if (kerningAsString.equalsIgnoreCase("yes")) {
  @@ -136,13 +136,13 @@
   metricsFile = attributes.getValue("metrics-file");
   embedFile = attributes.getValue("embed-file");
   fontName = attributes.getValue("name");
  -fontTriplets = new Vector(5);
  +fontTriplets = new ArrayList(5);
   } else if (localName.equals("font-triplet")) {
   fontTripletName = attributes.getValue("name");
   weight = attributes.getValue("weight");
   style = attributes.getValue("style");
   fontTriplet = new FontTriplet(fontTripletName, weight, style);
  -fontTriplets.addElement(fontTriplet);
  +fontTriplets.add(fontTriplet);
   } else {
   // to make sure that user knows about false tag
   MessageHandler.errorln("Unknown tag in configuration file: "
  @@ -168,10 +168,10 @@
   status = OUT;
   role = "standard";
   if (keyStack.size() > 0) {
  -keyStack.removeElementAt(keyStack.size() - 1);
  +keyStack.remove(keyStack.size() - 1);
   }
   if (keyStack.size() > 0) {
  -key = (String)keyStack.elementAt(keyStack.size() - 1);
  +key = (String)keyStack.get(keyStack.size() - 1);
   } else {
   key = "";
   }
  @@ -180,17 +180,17 @@
   map.put(subkey, value);
   status -= IN_SUBENTRY;
   if (keyStack.size() > 0) {
  -keyStack.removeElementAt(keyStack.size() - 1);
  +key

cvs commit: xml-fop/src/org/apache/fop/configuration ConfigurationParser.java

2001-07-02 Thread keiron

keiron  01/07/02 03:45:38

  Modified:src/org/apache/fop/configuration ConfigurationParser.java
  Log:
  handles key values a bit better
  
  Revision  ChangesPath
  1.8   +97 -83
xml-fop/src/org/apache/fop/configuration/ConfigurationParser.java
  
  Index: ConfigurationParser.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/configuration/ConfigurationParser.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ConfigurationParser.java  2001/02/27 12:28:14 1.7
  +++ ConfigurationParser.java  2001/07/02 10:45:35 1.8
  @@ -1,7 +1,7 @@
  -/* 
  +/*
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the 
  - * LICENSE file included with these sources."
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources.
*/
   
   
  @@ -24,7 +24,6 @@
* SAX2 Handler which retrieves the configuration information and stores them in 
Configuration.
* Normally this class doesn't need to be accessed directly.
*/
  -
   public class ConfigurationParser extends DefaultHandler {
   private final int OUT = 0;
   private final int IN_ENTRY = 1;
  @@ -33,8 +32,8 @@
   private final int IN_LIST = 8;
   private final int IN_SUBENTRY = 16;
   private final int IN_SUBKEY = 32;
  - private final int IN_FONTS = 64;
  - private final int IN_FONT = 128;
  +private final int IN_FONTS = 64;
  +private final int IN_FONT = 128;
   
   private final int STRING = 0;
   private final int LIST = 1;
  @@ -50,6 +49,7 @@
   
   //stores key for new config entry
   private String key = "";
  +private Vector keyStack = new Vector();
   
   //stores string value
   private String value = "";
  @@ -71,21 +71,21 @@
   
   //stores fonts
   private Vector fontList = null;
  - 
  +
   //stores information on one font
   private FontInfo fontInfo = null;
  +
  +//stores information on a font triplet
  +private FontTriplet fontTriplet = null;
   
  - //stores information on a font triplet
  - private FontTriplet fontTriplet = null;
  - 
  - //information on a font
  - private String fontName, metricsFile, embedFile, kerningAsString;
  - private boolean kerning;
  - private Vector fontTriplets;
  - 
  - //information on a font triplet
  - private String fontTripletName, weight, style;
  - 
  +//information on a font
  +private String fontName, metricsFile, embedFile, kerningAsString;
  +private boolean kerning;
  +private Vector fontTriplets;
  +
  +//information on a font triplet
  +private String fontTripletName, weight, style;
  +
   public void startDocument() {
   configuration = Configuration.getConfiguration();
   }
  @@ -96,8 +96,8 @@
   }
   
   /**
  -  * extracts the element and attribute name and sets the fitting status and 
datatype values
  -  * */
  + * extracts the element and attribute name and sets the fitting status and 
datatype values
  + */
   public void startElement(String uri, String localName,
String qName, Attributes attributes) {
   if (localName.equals("key")) {
  @@ -108,34 +108,34 @@
   status += IN_LIST;
   } else if (localName.equals("subentry")) {
   status += IN_SUBENTRY;
  -} else if (localName.equals("entry"))   {
  +} else if (localName.equals("entry")) {
   //role=standard as default
   if (attributes.getLength() == 0) {
   role = "standard";
  -//retrieve attribute value for "role" which determines configuration 
target
  +//retrieve attribute value for "role" which determines 
configuration target
   } else {
   role = attributes.getValue("role");
   }
  -} else if (localName.equals("configuration") ) {
  - } else if (localName.equals("fonts") ) {  //list of fonts starts
  - fontList = new Vector (10);
  - } else if (localName.equals("font") ) {
  - kerningAsString = attributes.getValue("kerning");
  - if (kerningAsString.equalsIgnoreCase("yes")) {
  - kerning = true;
  - } else {
  - kerning = false;
  - }
  - metricsFile = attributes.getValue("metrics-file");
  - embedFile = attributes.getValue("embed-file");
  - fontName = attributes.getValue("name");
  - fontTriplets = new Vector(5);
  - } else if (localName.equals("font-triplet") ) { 
  -