/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.uima.cas.impl;

import java.util.Comparator;
import java.util.NoSuchElementException;

import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.jcas.cas.TOP;

/**
 * An empty Low-level FS iterator
 */
public class LowLevelIterator_empty<T extends FeatureStructure> implements LowLevelIterator<T> {
  
  private final static FeatureStructure[] EMPTY_ARRAY = new FeatureStructure[0];

  @Override
  public boolean isValid() { return false; }
  @Override
  public T getNvc() { throw new NoSuchElementException(); }
  @Override
  public void moveToFirstNoReinit() {}
  @Override
  public void moveToLastNoReinit() {}
  @Override
  public void moveToNoReinit(FeatureStructure fs) {}

  @Override
  public LowLevelIterator_empty<T> copy() { return this; }
  @Override
  public void moveToNextNvc() {}
  @Override
  public void moveToPreviousNvc() {}
  @Override
  public int ll_indexSizeMaybeNotCurrent() { return 0; }
  @Override
  public int ll_maxAnnotSpan() { return Integer.MAX_VALUE; }
  @Override
  public LowLevelIndex<T> ll_getIndex() { return null; }
  @Override
  public boolean isIndexesHaveBeenUpdated() { return false; }
  @Override
  public boolean maybeReinitIterator() { return false; }
  @Override
  public Comparator<TOP> getComparator() { return null; }
  @Override
  public FeatureStructure[] getArray() { return EMPTY_ARRAY; }
}

@@ -856,24 +856,57 @@
 as.impl;%0D%0A%0D%0A
+import java.lang.reflect.Array;%0D%0A
 import java.
@@ -1013,16 +1013,50 @@
 cture;%0D%0A
+import org.apache.uima.cas.Type;%0D%0A
 import o
@@ -1238,92 +1238,8 @@
   %0D%0A
-  private final static FeatureStructure%5B%5D EMPTY_ARRAY = new FeatureStructure%5B0%5D;%0D%0A%0D%0A
   @O
@@ -2174,58 +2174,175 @@
 lic 
-FeatureStructure%5B%5D getArray() %7B return EMPTY_ARRAY
+T%5B%5D getArray(Class%3C? super T%3E clazz) %7B return (T%5B%5D) Array.newInstance(clazz, 0); %7D%0D%0A  @Override%0D%0A  public Type getType() %7B return TypeSystemImpl.staticTsi.getTopType()
 ; %7D%0D

support getType for empty iterator