//-----------------------------------------------------------------------

        /**
         * Gets the current key, which is the key returned by the last call
         * to <code>next()</code>.
         *
         * @return the current key
         * @throws IllegalStateException if <code>next()</code> has not yet been called
         */
        public Object getKey()
        {
            if (last == null)
            {
                throw new java.lang.IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
            }
            return(last.getKey());
        }
Exemple #2
0
 /**
  *  Adds all the mappings in the specified map to this map, replacing any
  *  mappings that already exist (as per {@link Map#putAll(Map)}).  The order
  *  in which the entries are added is determined by the iterator returned
  *  from {@link Map#entrySet()} for the specified map.
  *
  *  @param t the mappings that should be added to this map.
  *
  *  @throws NullPointerException if <code>t</code> is <code>null</code>
  */
 public virtual void putAll(java.util.Map <Object, Object> t)
 {
     java.util.Iterator <java.util.MapNS.Entry <Object, Object> > iter = t.entrySet().iterator();
     while (iter.hasNext())
     {
         java.util.MapNS.Entry <Object, Object> entry = iter.next();
         put(entry.getKey(), entry.getValue());
     }
 }
Exemple #3
0
 public virtual void remove()
 {
     if (last == null)
     {
         throw new java.lang.IllegalStateException();
     }
     root.remove(last.getKey());
     last = null;
 }
        //-----------------------------------------------------------------------

        /**
         * Write the map out using a custom routine.
         * @param out  the output stream
         * @throws IOException
         */
        protected virtual void doWriteObject(java.io.ObjectOutputStream outJ)
        {//throws IOException {
            outJ.writeInt(map.size());
            for (java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = map.entrySet().iterator(); it.hasNext();)
            {
                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)it.next();
                outJ.writeObject(entry.getKey());
                outJ.writeInt(((MutableInteger)entry.getValue()).value);
            }
        }
 /**
  * Constructor copying elements from another map.
  *
  * @param map  the map to copy, must be size 1
  * @throws NullPointerException if the map is null
  * @throws IllegalArgumentException if the size is not 1
  */
 public SingletonMap(java.util.Map <Object, Object> map)
 {
     if (map.size() != 1)
     {
         throw new java.lang.IllegalArgumentException("The map size must be 1");
     }
     java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)map.entrySet().iterator().next();
     this.key   = entry.getKey();
     this.value = entry.getValue();
 }
 public java.util.Map <AttributedCharacterIteratorNS.Attribute, System.Object> getAttributes()
 {
     java.util.Map <AttributedCharacterIteratorNS.Attribute, System.Object> result = new java.util.HashMap <AttributedCharacterIteratorNS.Attribute, System.Object>();//(attrString.attributeMap.size() * 4 / 3) + 1);
     java.util.Iterator <java.util.MapNS.Entry <AttributedCharacterIteratorNS.Attribute, java.util.List <IAC_Range> > > it = attrString.attributeMap
                                                                                                                             .entrySet().iterator();
     while (it.hasNext())
     {
         java.util.MapNS.Entry <AttributedCharacterIteratorNS.Attribute, java.util.List <IAC_Range> > entry = it.next();
         if (attributesAllowed == null ||
             attributesAllowed.contains(entry.getKey()))
         {
             System.Object value = currentValue(entry.getValue());
             if (value != null)
             {
                 result.put(entry.getKey(), value);
             }
         }
     }
     return(result);
 }
Exemple #7
0
 public override void putAll(java.util.Map <Object, Object> mapToCopy)
 {
     java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = mapToCopy.entrySet().iterator();
     while (it.hasNext())
     {
         java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)it.next();
         Object key   = entry.getKey();
         Object value = entry.getValue();
         validate(key, value);
     }
     map.putAll(mapToCopy);
 }
 /**
  * Applies a given set of attributes to the given range of the string.
  *
  * @param attributes
  *            the set of attributes that will be applied to this string.
  * @param start
  *            the start of the range where the attribute will be applied.
  * @param end
  *            the end of the range where the attribute will be applied.
  * @throws IllegalArgumentException
  *             if {@code start < 0}, {@code end} is greater than the length
  *             of this string, or if {@code start >= end}.
  */
 public void addAttributes(
     java.util.Map <AttributedCharacterIteratorNS.Attribute, System.Object> attributes,
     int start, int end)
 {
     java.util.Iterator <java.util.MapNS.Entry <AttributedCharacterIteratorNS.Attribute, System.Object> > it = attributes.entrySet().iterator();
     while (it.hasNext())
     {
         java.util.MapNS.Entry <AttributedCharacterIteratorNS.Attribute, System.Object> entry = it.next();
         addAttribute(entry.getKey(),
                      entry.getValue(), start, end);
     }
 }
Exemple #9
0
            public override bool Equals(Object obj)
            {
                if (obj == null)
                {
                    return(false);
                }
                if (obj == this)
                {
                    return(true);
                }
                if (!(obj is java.util.MapNS.Entry <Object, Object>))
                {
                    return(false);
                }

                java.util.MapNS.Entry <Object, Object> other = (java.util.MapNS.Entry <Object, Object>)obj;

                // implemented per api docs for java.util.MapNS.Entry<Object,Object>.equals(Object)
                return(
                    (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) &&
                    (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue())));
            }
        /**
         * Gets a hash code for the Bag compatible with the definition of equals.
         * The hash code is defined as the sum total of a hash code for each element.
         * The per element hash code is defined as
         * <code>(e==null ? 0 : e.hashCode()) ^ noOccurances)</code>.
         * This hash code is compatible with the Set interface.
         *
         * @return the hash code of the Bag
         */
        public override int GetHashCode()
        {
            int total = 0;

            for (java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = map.entrySet().iterator(); it.hasNext();)
            {
                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)it.next();
                Object         element = entry.getKey();
                MutableInteger count   = (MutableInteger)entry.getValue();
                total += (element == null ? 0 : element.GetHashCode()) ^ count.value;
            }
            return(total);
        }
Exemple #11
0
 public override Object[] toArray <Object>(Object[] arr)
 {
     // special implementation to handle disappearing entries
     java.util.ArrayList <Object> list = new java.util.ArrayList <Object>();
     java.util.Iterator <Object>  it   = (java.util.Iterator <Object>) this.iterator();
     while (it.hasNext())
     {
         java.util.MapNS.Entry <Object, Object> e = (java.util.MapNS.Entry <Object, Object>)it.next(); //? right???
         object o  = new DefaultMapEntry(e.getKey(), e.getValue());
         Object o2 = (Object)o;
         list.add(o2);
     }
     return(list.toArray(arr));
 }
 /**
  * Transforms a map.
  * <p>
  * The transformer itself may throw an exception if necessary.
  *
  * @param map  the map to transform
  * @throws the transformed object
  */
 protected virtual java.util.Map <Object, Object> transformMap(java.util.Map <Object, Object> map)
 {
     if (map.isEmpty())
     {
         return(map);
     }
     java.util.Map <Object, Object> result = new LinkedMap(map.size());
     for (java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = map.entrySet().iterator(); it.hasNext();)
     {
         java.util.MapNS.Entry <Object, Object> entry = it.next();
         result.put(transformKey(entry.getKey()), transformValue(entry.getValue()));
     }
     return(result);
 }
            public bool equals(Object o)
            {
                if (o == null)
                {
                    return(false);
                }
                if (o == this)
                {
                    return(true);
                }

                if (!(o is java.util.MapNS.Entry <Object, Object>))
                {
                    return(false);
                }

                java.util.MapNS.Entry <Object, Object> e2 = (java.util.MapNS.Entry <Object, Object>)o;

                return((key == null ?
                        e2.getKey() == null : key.equals(e2.getKey())) &&
                       (value == null ?
                        e2.getValue() == null : value.equals(e2.getValue())));
            }
Exemple #14
0
        //-----------------------------------------------------------------------

        /**
         * Constructor that wraps (not copies).
         *
         * @param map  the map to decorate, must not be null
         * @param keyPredicate  the predicate to validate the keys, null means no check
         * @param valuePredicate  the predicate to validate to values, null means no check
         * @throws IllegalArgumentException if the map is null
         */
        protected internal PredicatedMap(java.util.Map <Object, Object> map, Predicate keyPredicate, Predicate valuePredicate)
            : base(map)
        {
            this.keyPredicate   = keyPredicate;
            this.valuePredicate = valuePredicate;

            java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = map.entrySet().iterator();
            while (it.hasNext())
            {
                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)it.next();
                Object key   = entry.getKey();
                Object value = entry.getValue();
                validate(key, value);
            }
        }
 public override bool Equals(Object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj is java.util.MapNS.Entry <Object, Object> == false)
     {
         return(false);
     }
     java.util.MapNS.Entry <Object, Object> other = (java.util.MapNS.Entry <Object, Object>)obj;
     return
         ((getKey() == other.getKey()) &&
          (getValue() == other.getValue()));
 }
 public Object next()
 {
     if (parent.modCount != mods)
     {
         throw new java.util.ConcurrentModificationException();
     }
     if (itemCount == 0)
     {
         current   = (java.util.MapNS.Entry <Object, Object>)entryIterator.next();
         itemCount = ((MutableInteger)current.getValue()).value;
     }
     canRemove = true;
     itemCount--;
     return(current.getKey());
 }
        /**
         * Puts the values from the specified map into this map.
         * <p>
         * The map must be of size 0 or size 1.
         * If it is size 1, the key must match the key of this map otherwise an
         * IllegalArgumentException is thrown.
         *
         * @param map  the map to add, must be size 0 or 1, and the key must match
         * @throws NullPointerException if the map is null
         * @throws IllegalArgumentException if the key does not match
         */
        public virtual void putAll(java.util.Map <Object, Object> map)
        {
            switch (map.size())
            {
            case 0:
                return;

            case 1:
                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)map.entrySet().iterator().next();
                put(entry.getKey(), entry.getValue());
                return;

            default:
                throw new java.lang.IllegalArgumentException("The map size must be 0 or 1");
            }
        }
Exemple #18
0
            public override bool contains(Object obj)
            {
                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)obj;
                int hash = root.getHash(entry.getKey());

                lock (root.locks[hash])
                {
                    for (Node n = root.buckets[hash]; n != null; n = n.next)
                    {
                        if (n.equals(entry))
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
 /**
  * Compares this map with another.
  *
  * @param obj  the object to compare to
  * @return true if equal
  */
 public override bool Equals(Object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj is java.util.Map <Object, Object> == false)
     {
         return(false);
     }
     java.util.Map <Object, Object> other = (java.util.Map <Object, Object>)obj;
     if (other.size() != 1)
     {
         return(false);
     }
     java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)other.entrySet().iterator().next();
     return(isEqualKey(entry.getKey()) && isEqualValue(entry.getValue()));
 }
 /**
  * Override superclass to ensure that MultiMap instances are
  * correctly handled.
  * <p>
  * NOTE: Prior to version 3.2, putAll(map) did not work properly
  * when passed a MultiMap.
  *
  * @param map  the map to copy (either a normal or multi map)
  */
 public override void putAll(java.util.Map <Object, Object> map)
 {
     if (map is MultiMap)
     {
         for (java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = map.entrySet().iterator(); it.hasNext();)
         {
             java.util.MapNS.Entry <Object, Object> entry = it.next();
             java.util.Collection <Object>          coll  = (java.util.Collection <Object>)entry.getValue();
             putAll(entry.getKey(), coll);
         }
     }
     else
     {
         for (java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = map.entrySet().iterator(); it.hasNext();)
         {
             java.util.MapNS.Entry <Object, Object> entry = it.next();
             put(entry.getKey(), entry.getValue());
         }
     }
 }
        public override bool remove(Object obj)
        {
            if (obj is java.util.MapNS.Entry <Object, Object> == false)
            {
                return(false);
            }
            java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)obj;
            Object key = entry.getKey();

            if (parent.containsKey(key))
            {
                Object value = parent.maps[0].get(key);
                if (value == null ? entry.getValue() == null : value.equals(entry.getValue()))
                {
                    parent.maps[0].remove(key);
                    parent.maps[1].remove(value);
                    return(true);
                }
            }
            return(false);
        }
            public override bool remove(Object obj)
            {
                if (obj is java.util.MapNS.Entry <Object, Object> == false)
                {
                    return(false);
                }
                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)obj;
                int hash = root.getHash(entry.getKey());

                lock (root.m_locks[hash])
                {
                    for (Node n = root.m_buckets[hash]; n != null; n = n.next)
                    {
                        if (n.equals(entry))
                        {
                            root.remove(n.getKey());
                            return(true);
                        }
                    }
                }
                return(false);
            }
Exemple #23
0
            // helper
            private Entry findEntry(Object o)
            {
                if (o == null)
                {
                    return(null);
                }
                if (!(o is java.util.MapNS.Entry <Object, Object>))
                {
                    return(null);
                }

                java.util.MapNS.Entry <Object, Object> e = (java.util.MapNS.Entry <Object, Object>)o;
                Entry entry = (Entry)root.entries.get(e.getKey());

                if (entry != null && entry.equals(e))
                {
                    return(entry);
                }
                else
                {
                    return(null);
                }
            }
Exemple #24
0
        public void putAll(java.util.Map <Object, Object> m)
        {
            if (m is RenderingHints)
            {
                map.putAll(((RenderingHints)m).map);
            }
            else
            {
                java.util.Set <java.util.MapNS.Entry <Object, Object> > entries = m.entrySet();

                if (entries != null)
                {
                    java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = entries.iterator();
                    while (it.hasNext())
                    {
                        java.util.MapNS.Entry <Object, Object> entry = it.next();
                        Key    key = (Key)entry.getKey();
                        Object val = entry.getValue();
                        put(key, val);
                    }
                }
            }
        }
Exemple #25
0
        /**
         * Create a new Closure that uses the input object as a key to find the
         * closure to call.
         * <p>
         * The Map consists of object keys and Closure values. A closure
         * is called if the input object equals the key. If there is no match, the
         * default closure is called. The default closure is set in the map
         * using a null key.
         *
         * @see org.apache.commons.collections.functors.SwitchClosure
         *
         * @param objectsAndClosures  a map of objects to closures
         * @return the closure
         * @throws IllegalArgumentException if the map is null
         * @throws IllegalArgumentException if the map is empty
         * @throws IllegalArgumentException if any closure in the map is null
         */
        public static Closure switchMapClosure(java.util.Map <Object, Object> objectsAndClosures)
        {
            Closure[]   trs   = null;
            Predicate[] preds = null;
            if (objectsAndClosures == null)
            {
                throw new java.lang.IllegalArgumentException("The object and closure map must not be null");
            }
            Closure def  = (Closure)objectsAndClosures.remove(null);
            int     size = objectsAndClosures.size();

            trs   = new Closure[size];
            preds = new Predicate[size];
            int i = 0;

            for (java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = objectsAndClosures.entrySet().iterator(); it.hasNext();)
            {
                java.util.MapNS.Entry <Object, Object> entry = it.next();
                preds[i] = EqualPredicate.getInstance(entry.getKey());
                trs[i]   = (Closure)entry.getValue();
                i++;
            }
            return(switchClosure(preds, trs, def));
        }
Exemple #26
0
 /**
  * Creates an {@code AttributedString} from the given text and the
  * attributes. The whole text has the given attributes applied.
  *
  * @param value
  *            the text to take as base for this attributed string.
  * @param attributes
  *            the attributes that the text is associated with.
  * @throws IllegalArgumentException
  *             if the length of {@code value} is 0 but the size of {@code
  *             attributes} is greater than 0.
  * @throws NullPointerException
  *             if {@code value} is {@code null}.
  */
 public AttributedString(System.String value,
                         java.util.Map <AttributedCharacterIteratorNS.Attribute, System.Object> attributes)
 {
     if (value == null)
     {
         throw new java.lang.NullPointerException();
     }
     if (value.Length == 0 && !attributes.isEmpty())
     {
         // text.0B=Cannot add attributes to empty string
         throw new java.lang.IllegalArgumentException("Cannot add attributes to empty string"); //$NON-NLS-1$
     }
     text         = value;
     attributeMap = new java.util.HashMap <AttributedCharacterIteratorNS.Attribute, java.util.List <IAC_Range> >();//(attributes.size() * 4 / 3) + 1);
     java.util.Iterator <java.util.MapNS.Entry <AttributedCharacterIteratorNS.Attribute, System.Object> > it = attributes.entrySet().iterator();
     while (it.hasNext())
     {
         java.util.MapNS.Entry <AttributedCharacterIteratorNS.Attribute, System.Object> entry = it.next();
         java.util.ArrayList <IAC_Range> ranges = new java.util.ArrayList <IAC_Range>(1);
         ranges.add(new IAC_Range(0, text.Length, entry.getValue()));
         attributeMap.put((AttributedCharacterIteratorNS.Attribute)entry
                          .getKey(), ranges);
     }
 }
Exemple #27
0
            /**
             * Compares this map entry to another.
             * <p>
             * This implementation uses <code>isEqualKey</code> and
             * <code>isEqualValue</code> on the main map for comparison.
             *
             * @param obj  the other map entry to compare to
             * @return true if equal, false if not
             */
            public override bool Equals(Object obj)
            {
                if (obj == this)
                {
                    return(true);
                }
                if (obj is java.util.MapNS.Entry <Object, Object> == false)
                {
                    return(false);
                }

                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)obj;
                Object entryKey   = entry.getKey();   // convert to hard reference
                Object entryValue = entry.getValue(); // convert to hard reference

                if ((entryKey == null) || (entryValue == null))
                {
                    return(false);
                }
                // compare using map methods, aiding identity subclass
                // note that key is direct access and value is via method
                return(parent.isEqualKey(entryKey, key) &&
                       parent.isEqualValue(entryValue, getValue()));
            }
        /**
         * Create a new Transformer that uses the input object as a key to find the
         * transformer to call.
         * <p>
         * The Map consists of object keys and Transformer values. A transformer
         * is called if the input object equals the key. If there is no match, the
         * default transformer is called. The default transformer is set in the map
         * using a null key. If no default is set, null will be returned in a default case.
         *
         * @see org.apache.commons.collections.functors.SwitchTransformer
         *
         * @param objectsAndTransformers  a map of objects to transformers
         * @return the transformer
         * @throws IllegalArgumentException if the map is null
         * @throws IllegalArgumentException if the map is empty
         * @throws IllegalArgumentException if any transformer in the map is null
         */
        public static Transformer switchMapTransformer(java.util.Map <Object, Object> objectsAndTransformers)
        {
            Transformer[] trs   = null;
            Predicate[]   preds = null;
            if (objectsAndTransformers == null)
            {
                throw new java.lang.IllegalArgumentException("The object and transformer map must not be null");
            }
            Transformer def  = (Transformer)objectsAndTransformers.remove(null);
            int         size = objectsAndTransformers.size();

            trs   = new Transformer[size];
            preds = new Predicate[size];
            int i = 0;

            for (java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = objectsAndTransformers.entrySet().iterator(); it.hasNext();)
            {
                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)it.next();
                preds[i] = EqualPredicate.getInstance(entry.getKey());
                trs[i]   = (Transformer)entry.getValue();
                i++;
            }
            return(switchTransformer(preds, trs, def));
        }
 /**
  * Gets the next <em>key</em> from the <code>Map</code>.
  *
  * @return the next key in the iteration
  * @throws java.util.NoSuchElementException if the iteration is finished
  */
 public Object next()
 {
     last = (java.util.MapNS.Entry<Object, Object>)iterator.next();
     canRemove = true;
     return last.getKey();
 }
Exemple #30
0
        // Update provider Services if the properties was changed
        private void updatePropertyServiceTable()
        {
            Object _key;
            Object _value;

            Provider.Service s;
            String           serviceName;
            String           algorithm;

            if (changedProperties == null || changedProperties.isEmpty())
            {
                return;
            }
            java.util.Iterator <java.util.MapNS.Entry <String, String> > it = changedProperties.entrySet().iterator();
            for (; it.hasNext();)
            {
                java.util.MapNS.Entry <String, String> entry = it.next();
                _key   = entry.getKey();
                _value = entry.getValue();
                if (_key == null || _value == null || !(_key is String) ||
                    !(_value is String))
                {
                    continue;
                }
                String key   = (String)_key;
                String value = (String)_value;
                if (key.startsWith("Provider"))
                { // Provider service type is reserved //$NON-NLS-1$
                    continue;
                }
                int i;
                if (key.startsWith("Alg.Alias."))
                { // Alg.Alias.<crypto_service>.<aliasName>=<stanbdardName> //$NON-NLS-1$
                    String aliasName;
                    String service_alias = key.substring(10);
                    i           = service_alias.indexOf('.');
                    serviceName = service_alias.substring(0, i);
                    aliasName   = service_alias.substring(i + 1);
                    algorithm   = value;
                    String algUp = algorithm.toUpperCase();
                    Object o     = null;
                    if (propertyServiceTable == null)
                    {
                        propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128);
                    }
                    else
                    {
                        o = propertyServiceTable.get(serviceName, algUp);
                    }
                    if (o != null)
                    {
                        s = (Provider.Service)o;
                        s.aliases.add(aliasName);
                        if (propertyAliasTable == null)
                        {
                            propertyAliasTable = new TwoKeyHashMap <String, String, Service>(256);
                        }
                        propertyAliasTable.put(serviceName,
                                               aliasName.toUpperCase(), s);
                    }
                    else
                    {
                        String className = (String)changedProperties
                                           .get(serviceName + "." + algorithm); //$NON-NLS-1$
                        if (className != null)
                        {
                            java.util.ArrayList <String> l = new java.util.ArrayList <String>();
                            l.add(aliasName);
                            s = new Provider.Service(this, serviceName, algorithm,
                                                     className, l, new java.util.HashMap <String, String>());
                            propertyServiceTable.put(serviceName, algUp, s);
                            if (propertyAliasTable == null)
                            {
                                propertyAliasTable = new TwoKeyHashMap <String, String, Service>(256);
                            }
                            propertyAliasTable.put(serviceName, aliasName
                                                   .toUpperCase(), s);
                        }
                    }
                    continue;
                }
                int j = key.indexOf('.');
                if (j == -1)
                { // unknown format
                    continue;
                }
                i = key.indexOf(' ');
                if (i == -1)
                { // <crypto_service>.<algorithm_or_type>=<className>
                    serviceName = key.substring(0, j);
                    algorithm   = key.substring(j + 1);
                    String alg = algorithm.toUpperCase();
                    Object o   = null;
                    if (propertyServiceTable != null)
                    {
                        o = propertyServiceTable.get(serviceName, alg);
                    }
                    if (o != null)
                    {
                        s           = (Provider.Service)o;
                        s.className = value;
                    }
                    else
                    {
                        s = new Provider.Service(this, serviceName, algorithm,
                                                 value, new java.util.ArrayList <String>(), new java.util.HashMap <String, String>());
                        if (propertyServiceTable == null)
                        {
                            propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128);
                        }
                        propertyServiceTable.put(serviceName, alg, s);
                    }
                }
                else
                { // <crypto_service>.<algorithm_or_type>
                    // <attribute_name>=<attrValue>
                    serviceName = key.substring(0, j);
                    algorithm   = key.substring(j + 1, i);
                    String attribute = key.substring(i + 1);
                    String alg       = algorithm.toUpperCase();
                    Object o         = null;
                    if (propertyServiceTable != null)
                    {
                        o = propertyServiceTable.get(serviceName, alg);
                    }
                    if (o != null)
                    {
                        s = (Provider.Service)o;
                        s.attributes.put(attribute, value);
                    }
                    else
                    {
                        String className = (String)changedProperties
                                           .get(serviceName + "." + algorithm); //$NON-NLS-1$
                        if (className != null)
                        {
                            java.util.HashMap <String, String> m = new java.util.HashMap <String, String>();
                            m.put(attribute, value);
                            s = new Provider.Service(this, serviceName, algorithm,
                                                     className, new java.util.ArrayList <String>(), m);
                            if (propertyServiceTable == null)
                            {
                                propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128);
                            }
                            propertyServiceTable.put(serviceName, alg, s);
                        }
                    }
                }
            }
            servicesChanged();
            changedProperties.clear();
        }
Exemple #31
0
 /**
  * Constructs a new pair from the specified <code>Map.Entry</code>.
  *
  * @param entry  the entry to copy, must not be null
  * @throws NullPointerException if the entry is null
  */
 public DefaultKeyValue(java.util.MapNS.Entry <Object, Object> entry)
     : base(entry.getKey(), entry.getValue())
 {
 }
 public virtual Object previous()
 {
     last = (java.util.MapNS.Entry<Object, Object>)iterator.previous();
     return last.getKey();
 }