Package java.util

Examples of java.util.Dictionary


        }
        return -1;
    }

    private static Integer getMaxSliderValue(JSlider slider) {
        Dictionary dictionary = slider.getLabelTable();
        if (dictionary != null) {
            Enumeration keys = dictionary.keys();
            int max = slider.getMinimum() - 1;
            while (keys.hasMoreElements()) {
                max = Math.max(max, ((Integer)keys.nextElement()).intValue());
            }
            if (max == slider.getMinimum() - 1) {
View Full Code Here


        }
        return null;
    }

    private static Integer getMinSliderValue(JSlider slider) {
        Dictionary dictionary = slider.getLabelTable();
        if (dictionary != null) {
            Enumeration keys = dictionary.keys();
            int min = slider.getMaximum() + 1;
            while (keys.hasMoreElements()) {
                min = Math.min(min, ((Integer)keys.nextElement()).intValue());
            }
            if (min == slider.getMaximum() + 1) {
View Full Code Here

     *  the default namespace, if any.
     * @param localName element tag, without any embedded colon
     */
    public ElementEx createElementEx (String namespace, String localName)
    {
  Dictionary  mapping = null;

  if (namespace == null)
      namespace = defaultNs;

  if (nsMappings != null)
View Full Code Here

    private void handleDevice(ServiceReference dev) {
        if (isUsed(dev))
            return;

        Dictionary props = collectProperties(dev);

        Vector /* MatchImpl */matches = new Vector();

        // Populate matches with driver locator recommendations
        DriverLocator[] dla = locators;
View Full Code Here

        }
    }

    private Dictionary /* String->Object */collectProperties(
            ServiceReference sr) {
        Dictionary props = new Hashtable();
        String[] keys = sr.getPropertyKeys();
        if (keys != null) {
            for (int i = 0; i < keys.length; i++) {
                String key = keys[i];
                props.put(key, sr.getProperty(key));
            }
        }
        return props;
    }
View Full Code Here

  // Initialize matchProps member with manifest headers +
  // bundle location and id
  protected void makeMatchProps() {
    matchProps = new Hashtable();
    Dictionary d = classLoader.bpkgs.bg.bundle.getHeaders();

    for(Enumeration e = d.keys(); e.hasMoreElements(); ) {
      Object key = e.nextElement();
      Object val = d.get(key);
      matchProps.put(key, val);
    }

    matchProps.put(PROP_LOCATION,  classLoader.archive.getBundleLocation());
    matchProps.put(PROP_BID,       new Long(classLoader.archive.getBundleId()));
View Full Code Here

        for(int i = 0; i < attrDefs.length; i++){
          AttributeDefinition ad = attrDefs[i];
          ADs.put(ad.getID(), ad);
        }
       
        Dictionary props = conf.getProperties();
       
        Enumeration attrsAssigns = currentAttributes.elements();
        while(attrsAssigns.hasMoreElements()){
          AE ae = (AE) attrsAssigns.nextElement();
          AttributeDefinition ad = (AttributeDefinition) ADs.get(ae.adref);
       
          if(ad != null){
            Object value = null;
            int card = ad.getCardinality();
           
            switch(ad.getType()){
                    case AttributeDefinition.STRING:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(values.nextElement());
                        }
                      }
                      else if(card > 0){
                        value = new String[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((String[])value)[i] = (String) values.nextElement();
                        }
                      }
                      else{
                        value = ae.values.elementAt(0);
                      }
                      break;
                    case AttributeDefinition.BOOLEAN:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(Boolean.valueOf((String)values.nextElement()));
                        }
                      }
                      else if(card > 0){
                        value = new Boolean[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((Boolean[])value)[i] = Boolean.valueOf((String) values.nextElement());
                        }
                      }
                      else{
                        value = Boolean.valueOf((String) ae.values.elementAt(0));
                      }
                      break;           
                    case AttributeDefinition.BYTE:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(Byte.valueOf((String)values.nextElement()));
                        }
                      }
                      else if(card > 0){
                        value = new Byte[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((Byte[])value)[i] = Byte.valueOf((String) values.nextElement());
                        }
                      }
                      else{
                        value = Byte.valueOf((String) ae.values.elementAt(0));
                      }
                      break
                    case AttributeDefinition.DOUBLE:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(Double.valueOf((String)values.nextElement()));
                        }
                      }
                      else if(card > 0){
                        value = new Double[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((Double[])value)[i] = Double.valueOf((String) values.nextElement());
                        }
                      }
                      else{
                        value = Double.valueOf((String) ae.values.elementAt(0));
                      }
                      break
                    case AttributeDefinition.FLOAT:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(Float.valueOf((String)values.nextElement()));
                        }
                      }
                      else if(card > 0){
                        value = new Float[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((Float[])value)[i] = Float.valueOf((String) values.nextElement());
                        }
                      }
                      else{
                        value = Float.valueOf((String) ae.values.elementAt(0));
                      }
                      break
                    case AttributeDefinition.INTEGER:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(Integer.valueOf((String)values.nextElement()));
                        }
                      }
                      else if(card > 0){
                        value = new Integer[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((Integer[])value)[i] = Integer.valueOf((String) values.nextElement());
                        }
                      }
                      else{
                        value = Integer.valueOf((String) ae.values.elementAt(0));
                      }
                      break
                    case AttributeDefinition.LONG:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(Long.valueOf((String)values.nextElement()));
                        }
                      }
                      else if(card > 0){
                        value = new Long[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((Long[])value)[i] = Long.valueOf((String) values.nextElement());
                        }
                      }
                      else{
                        value = Long.valueOf((String) ae.values.elementAt(0));
                      }
                      break
                    case AttributeDefinition.SHORT:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(Short.valueOf((String)values.nextElement()));
                        }
                      }
                      else if(card > 0){
                        value = new Integer[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((Short[])value)[i] = Short.valueOf((String) values.nextElement());
                        }
                      }
                      else{
                        value = Short.valueOf((String) ae.values.elementAt(0));
                      }
                      break
                    case AttributeDefinition.CHARACTER:
                      if(card < 0){
                        value = new Vector(-1 * card);
                        Enumeration values = ae.values.elements();
                        while(values.hasMoreElements()){
                          ((Vector)value).add(new Character(((String)values.nextElement()).charAt(0)));
                        }
                      }
                      else if(card > 0){
                        value = new Character[card];
                        Enumeration values = ae.values.elements();
                        for(int i = 0; values.hasMoreElements(); i++){
                          ((Character[])value)[i] = new Character(((String)values.nextElement()).charAt(0));
                        }
                      }
                      else{
                        value = new Character(((String) ae.values.elementAt(0)).charAt(0));
                      }
                      break;               
            }
             
          /*TODO  code along these lines would be less repetitive
          Class clazz = null;
           
          switch(ad.getType()){
                case AttributeDefinition.STRING:
                  clazz = null;
                  break;
                case AttributeDefinition.BOOLEAN:
                  clazz = Boolean.class;
                  break;           
                case AttributeDefinition.BYTE:
                  clazz = Byte.class;
                  break; 
                case AttributeDefinition.DOUBLE:
                  clazz = Double.class;
                  break; 
                case AttributeDefinition.FLOAT:
                  clazz = Float.class;
                  break; 
                case AttributeDefinition.INTEGER:
                  clazz = Integer.class;
                  break; 
                case AttributeDefinition.LONG:
                  clazz = Long.class;
                  break; 
                case AttributeDefinition.SHORT:
                  clazz = Short.class;
                  break; 
                case AttributeDefinition.CHARACTER:
                  clazz = Character.class;
                 
                  break;
                 
          } 
         
          Method method = null;
          try{
            method = clazz.getMethod("valueOf", new Class[]{String.class});
          }
          catch(NoSuchMethodException e){
           
          }
         
         
         
         
          Boolean val = null;
         
          try{
            val = (Boolean) method.invoke(null, new Object[]{"true"});
          }
          catch(IllegalAccessException e){
           
          }
              catch(InvocationTargetException e){
           
          } 
              */   
            if(value != null){
              props.put(ad.getName(), value);
            }
          }
             
        } //while
     
View Full Code Here

        }
        sb.append("</font>");
      } catch (Exception e) {
        e.printStackTrace();
      }
      Dictionary headers = b.getHeaders();

      sb.append("<table border=0 cellspacing=1 cellpadding=0>\n");

      sb.append("</table>");
      return sb;
View Full Code Here

                                    null,
                                    lastBundleLocation);

      if(lastBundleLocation != null && !"".equals(lastBundleLocation)) {
        Bundle b = Activator.getTargetBC().installBundle(lastBundleLocation);
        Dictionary headers = b.getHeaders();
        if(Util.doAutostart() && Util.canBeStarted(b)) {
          startBundle(b);
        }
      }
    } catch (Exception e) {
View Full Code Here

      r = null;
    }
  }

  public void configurationEvent(ConfigurationEvent event) {
    Dictionary props = new Hashtable();
    String topic = null;
    boolean knownMessageType = true;
    switch (event.getType()) {
    case ConfigurationEvent.CM_UPDATED:
      topic = CM_UPDATED_TOPIC;
View Full Code Here

TOP

Related Classes of java.util.Dictionary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.