namespace weka.core;

class WekaEnumeration
{
  isA RevisionHandler;
 depend java.util.Enumeration;
 depend java.util.List;
/** 
 * The counter. 
 */
private int m_Counter;

/** 
 * The vector. 
 */
private final List<E> m_Vector;

/** 
 * Special element. Skipped during enumeration. 
 */
private final int m_SpecialElement;

/** 
 * Constructs an enumeration.
 * @param vector the vector which is to be enumerated
 */
public WekaEnumeration(List<E> vector){
  m_Counter=0;
  m_Vector=vector;
  m_SpecialElement=-1;
}

/** 
 * Constructs an enumeration with a special element. The special element is skipped during the enumeration.
 * @param vector the vector which is to be enumerated
 * @param special the index of the special element
 */
public WekaEnumeration(List<E> vector,int special){
  m_Vector=vector;
  m_SpecialElement=special;
  if (special == 0) {
    m_Counter=1;
  }
 else {
    m_Counter=0;
  }
}

/** 
 * Tests if there are any more elements to enumerate.
 * @return true if there are some elements left
 */
@Override public final boolean hasMoreElements(){
  if (m_Counter < m_Vector.size()) {
    return true;
  }
  return false;
}

/** 
 * Returns the next element.
 * @return the next element to be enumerated
 */
@Override public final E nextElement(){
  E result=m_Vector.get(m_Counter);
  m_Counter++;
  if (m_Counter == m_SpecialElement) {
    m_Counter++;
  }
  return result;
}

/** 
 * Returns the revision string.
 * @return the revision
 */
@Override public String getRevision(){
  return RevisionUtils.extract("$Revision: 10203 $");
}
}
