2010-03-16 20:14:08 -07:00
|
|
|
|
#if !JAVA
|
|
|
|
|
/*
|
2009-09-07 03:44:18 -07:00
|
|
|
|
* ListIterator.cs
|
|
|
|
|
* Copyright (c) 2009 kbinani
|
|
|
|
|
*
|
2010-03-16 20:14:08 -07:00
|
|
|
|
* This file is part of bocoree.
|
2009-09-07 03:44:18 -07:00
|
|
|
|
*
|
2010-03-16 20:14:08 -07:00
|
|
|
|
* bocoree is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the BSD License.
|
2009-09-07 03:44:18 -07:00
|
|
|
|
*
|
2010-03-16 20:14:08 -07:00
|
|
|
|
* bocoree is distributed in the hope that it will be useful,
|
2009-09-07 03:44:18 -07:00
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
*/
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
2010-03-16 20:14:08 -07:00
|
|
|
|
namespace bocoree.java.util {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
|
|
|
|
|
public class ListIterator<T> : Iterator {
|
|
|
|
|
private List<T> m_list;
|
|
|
|
|
private int m_pos;
|
|
|
|
|
|
|
|
|
|
public ListIterator( Vector<T> list ) {
|
|
|
|
|
m_list = new List<T>();
|
|
|
|
|
int c = list.size();
|
|
|
|
|
for( int i = 0; i < c; i++ ){
|
|
|
|
|
m_list.Add( list.get( i ) );
|
|
|
|
|
}
|
|
|
|
|
m_pos = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ListIterator( List<T> list ) {
|
|
|
|
|
m_list = list;
|
|
|
|
|
m_pos = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean hasNext() {
|
|
|
|
|
if ( m_list != null && 0 <= m_pos + 1 && m_pos + 1 < m_list.Count ) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Object next() {
|
|
|
|
|
if ( m_list == null ) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
m_pos++;
|
|
|
|
|
return m_list[m_pos];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void remove() {
|
|
|
|
|
m_list.RemoveAt( m_pos );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2010-03-16 20:14:08 -07:00
|
|
|
|
#endif
|