@@ -0,0 +1,2638 @@
+/*%0D%0A * Licensed to the Apache Software Foundation (ASF) under one%0D%0A * or more contributor license agreements.  See the NOTICE file%0D%0A * distributed with this work for additional information%0D%0A * regarding copyright ownership.  The ASF licenses this file%0D%0A * to you under the Apache License, Version 2.0 (the%0D%0A * %22License%22); you may not use this file except in compliance%0D%0A * with the License.  You may obtain a copy of the License at%0D%0A * %0D%0A *   http://www.apache.org/licenses/LICENSE-2.0%0D%0A * %0D%0A * Unless required by applicable law or agreed to in writing,%0D%0A * software distributed under the License is distributed on an%0D%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0D%0A * KIND, either express or implied.  See the License for the%0D%0A * specific language governing permissions and limitations%0D%0A * under the License.%0D%0A */%0D%0Apackage org.apache.uima.cas.impl;%0D%0A%0D%0Aimport java.util.IdentityHashMap;%0D%0A%0D%0Aimport org.apache.uima.internal.util.PositiveIntSet;%0D%0Aimport org.apache.uima.internal.util.PositiveIntSet_impl;%0D%0A%0D%0A%0D%0A%0D%0A  /**%0D%0A   * for XCAS and XMI deserialization, need to remember%0D%0A   * what's being added to the indices and/or removed, because%0D%0A   * the actual FSs are not yet %22fixed up%22 (adjusted for %0D%0A   * reference id's -%3E actual addresses, including the sofa refs)%0D%0A   * for non-delta updates.  %0D%0A   * %0D%0A   * Workaround (2014) is to remember the information, and do the%0D%0A   * adds / removes after the fixups.%0D%0A   * %0D%0A   * The information to be remembered is:%0D%0A   *   1) the View reference (a ref to the FSIndexRepository%0D%0A   *       a) for each of these, the list of FSaddrs to be added or removed%0D%0A   *       %0D%0A   * The list of FSaddrs ought to be a set with no duplicates, but because%0D%0A   * it could be sourced from a hand-edited source, we cannot depend on that%0D%0A   * so we store the list as a %22set%22 to prevent duplicates.%0D%0A   * %0D%0A   * The remove operation only removes 1 instance (in case multiple instances%0D%0A   * of the same FS are in the indices). %0D%0A   * %0D%0A   * Currently only used by XMI deserialization%0D%0A   *%0D%0A   * Constructor - done by caller - constructs IdentityHashMap%0D%0A   */%0D%0A  %0D%0A@SuppressWarnings(%22serial%22)  %0D%0Aclass DeferredIndexUpdates extends IdentityHashMap%3CFSIndexRepositoryImpl, PositiveIntSet%3E %7B%0D%0A    %0D%0A  void addTodo(FSIndexRepositoryImpl ir, int fsAddr) %7B%0D%0A    getTodos(ir).add(fsAddr);%0D%0A  %7D%0D%0A  %0D%0A  /**%0D%0A   * Does just-in-time creation of PositiveIntSet if needed before adding%0D%0A   * @param ir%0D%0A   * @param fsAddr%0D%0A   */%0D%0A  PositiveIntSet getTodos(FSIndexRepositoryImpl ir) %7B%0D%0A    PositiveIntSet s = get(ir);%0D%0A    if (null == s) %7B%0D%0A      put(ir, s = new PositiveIntSet_impl());%0D%0A    %7D%0D%0A    return s;%0D%0A  %7D%0D%0A%7D

support Xmi deserialization - data structure to remember adds and removes to do after fixups/finalizes