src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/AugmentationsImpl.java
author joehw
Wed, 18 Oct 2017 13:25:49 -0700
changeset 47359 e1a6c0168741
parent 47216 71c04702a3d5
child 48409 5ab69533994b
permissions -rw-r--r--
8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked Reviewed-by: lancea, rriggs, mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
47359
e1a6c0168741 8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents: 47216
diff changeset
     2
 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
e1a6c0168741 8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents: 47216
diff changeset
     3
 * @LastModified: Oct 2017
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
     6
 * Licensed to the Apache Software Foundation (ASF) under one or more
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
     7
 * contributor license agreements.  See the NOTICE file distributed with
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
     8
 * this work for additional information regarding copyright ownership.
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
     9
 * The ASF licenses this file to You under the Apache License, Version 2.0
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
    10
 * (the "License"); you may not use this file except in compliance with
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
    11
 * the License.  You may obtain a copy of the License at
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *      http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
package com.sun.org.apache.xerces.internal.util;
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
    24
import com.sun.org.apache.xerces.internal.xni.Augmentations;
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
    25
import java.util.Collections;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
import java.util.Enumeration;
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
    27
import java.util.HashMap;
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
    28
import java.util.Map;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 * This class provides an implementation for Augmentations interface.
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
    32
 * Augmentations interface defines a map of additional data that could
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 * be passed along the document pipeline. The information can contain extra
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * arguments or infoset augmentations, for example PSVI. This additional
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 * information is identified by a String key.
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * <p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * @author Elena Litani, IBM
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
public class AugmentationsImpl implements Augmentations{
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
    private AugmentationsItemsContainer fAugmentationsContainer =
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
                                        new SmallContainer();
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
     * Add additional information identified by a key to the Augmentations structure.
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
     * @param key    Identifier, can't be <code>null</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
     * @param item   Additional information
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
     * @return the previous value of the specified key in the Augmentations strucutre,
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
     *         or <code>null</code> if it did not have one.
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
    public Object putItem (String key, Object item){
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
        Object oldValue = fAugmentationsContainer.putItem(key, item);
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
        if (oldValue == null && fAugmentationsContainer.isFull()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
            fAugmentationsContainer = fAugmentationsContainer.expand();
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
        return oldValue;
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
     * Get information identified by a key from the Augmentations structure
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
     * @param key    Identifier, can't be <code>null</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
     * @return the value to which the key is mapped in the Augmentations structure;
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
     *         <code>null</code> if the key is not mapped to any value.
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
    public Object getItem(String key){
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
        return fAugmentationsContainer.getItem(key);
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
     * Remove additional info from the Augmentations structure
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
     * @param key    Identifier, can't be <code>null</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
    public Object removeItem (String key){
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
        return fAugmentationsContainer.removeItem(key);
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
     * Returns an enumeration of the keys in the Augmentations structure
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
     */
47359
e1a6c0168741 8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents: 47216
diff changeset
    91
    public Enumeration<Object> keys (){
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
        return fAugmentationsContainer.keys();
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
     * Remove all objects from the Augmentations structure.
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
    public void removeAllItems() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
        fAugmentationsContainer.clear();
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
    public String toString() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
        return fAugmentationsContainer.toString();
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    abstract class AugmentationsItemsContainer {
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
        abstract public Object putItem(Object key, Object item);
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
        abstract public Object getItem(Object key);
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
        abstract public Object removeItem(Object key);
47359
e1a6c0168741 8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents: 47216
diff changeset
   110
        abstract public Enumeration<Object> keys();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
        abstract public void clear();
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
        abstract public boolean isFull();
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
        abstract public AugmentationsItemsContainer expand();
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
    class SmallContainer extends AugmentationsItemsContainer {
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
        final static int SIZE_LIMIT = 10;
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
        final Object[] fAugmentations = new Object[SIZE_LIMIT*2];
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
        int fNumEntries = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
47359
e1a6c0168741 8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents: 47216
diff changeset
   121
        public Enumeration<Object> keys() {
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
            return new SmallContainerKeyEnumeration();
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
        public Object getItem(Object key) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
            for (int i = 0; i < fNumEntries*2; i = i + 2) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
                if (fAugmentations[i].equals(key)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
                    return fAugmentations[i+1];
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
            return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
        public Object putItem(Object key, Object item) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
            for (int i = 0; i < fNumEntries*2; i = i + 2) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
                if (fAugmentations[i].equals(key)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
                    Object oldValue = fAugmentations[i+1];
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
                    fAugmentations[i+1] = item;
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
                    return oldValue;
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
            fAugmentations[fNumEntries*2] = key;
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
            fAugmentations[fNumEntries*2+1] = item;
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
            fNumEntries++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
            return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
        public Object removeItem(Object key) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
            for (int i = 0; i < fNumEntries*2; i = i + 2) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
                if (fAugmentations[i].equals(key)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
                    Object oldValue = fAugmentations[i+1];
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
                    for (int j = i; j < fNumEntries*2 - 2; j = j + 2) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
                        fAugmentations[j] = fAugmentations[j+2];
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
                        fAugmentations[j+1] = fAugmentations[j+3];
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
                    fAugmentations[fNumEntries*2-2] = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
                    fAugmentations[fNumEntries*2-1] = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
                    fNumEntries--;
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
                    return oldValue;
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
            return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
        public void clear() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
            for (int i = 0; i < fNumEntries*2; i = i + 2) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
                fAugmentations[i] = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
                fAugmentations[i+1] = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
            fNumEntries = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
        public boolean isFull() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
            return (fNumEntries == SIZE_LIMIT);
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
        public AugmentationsItemsContainer expand() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
            LargeContainer expandedContainer = new LargeContainer();
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
            for (int i = 0; i < fNumEntries*2; i = i + 2) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
                expandedContainer.putItem(fAugmentations[i],
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
                                          fAugmentations[i+1]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
            return expandedContainer;
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
        public String toString() {
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   199
            StringBuilder buff = new StringBuilder();
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   200
            buff.append("SmallContainer - fNumEntries == ").append(fNumEntries);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
            for (int i = 0; i < SIZE_LIMIT*2; i=i+2) {
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   203
                buff.append("\nfAugmentations[")
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   204
                    .append(i)
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   205
                    .append("] == ")
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   206
                    .append(fAugmentations[i])
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   207
                    .append("; fAugmentations[")
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   208
                    .append(i+1)
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   209
                    .append("] == ")
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   210
                    .append(fAugmentations[i+1]);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
            return buff.toString();
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
47359
e1a6c0168741 8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents: 47216
diff changeset
   216
        class SmallContainerKeyEnumeration implements Enumeration<Object> {
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
            Object [] enumArray = new Object[fNumEntries];
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
            int next = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
            SmallContainerKeyEnumeration() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
                for (int i = 0; i < fNumEntries; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
                    enumArray[i] = fAugmentations[i*2];
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
            public boolean hasMoreElements() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
                return next < enumArray.length;
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
            public Object nextElement() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
                if (next >= enumArray.length) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
                    throw new java.util.NoSuchElementException();
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
                Object nextVal = enumArray[next];
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
                enumArray[next] = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
                next++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
                return nextVal;
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
    class LargeContainer extends AugmentationsItemsContainer {
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   245
        final Map<Object, Object> fAugmentations = new HashMap<>();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
        public Object getItem(Object key) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
            return fAugmentations.get(key);
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
        public Object putItem(Object key, Object item) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
            return fAugmentations.put(key, item);
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
        public Object removeItem(Object key) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
            return fAugmentations.remove(key);
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
47359
e1a6c0168741 8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents: 47216
diff changeset
   259
        public Enumeration<Object> keys() {
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   260
            return Collections.enumeration(fAugmentations.keySet());
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
        public void clear() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
            fAugmentations.clear();
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
        public boolean isFull() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
            return false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
        public AugmentationsItemsContainer expand() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
            return this;
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
        public String toString() {
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   276
            StringBuilder buff = new StringBuilder();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
            buff.append("LargeContainer");
33349
975138b77cff 8068842: Better JAXP data handling
joehw
parents: 25868
diff changeset
   278
            for(Object key : fAugmentations.keySet()) {
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
                buff.append("\nkey == ");
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
                buff.append(key);
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
                buff.append("; value == ");
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
                buff.append(fAugmentations.get(key));
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
            return buff.toString();
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
}