Back to index

moin  1.9.0~rc2
ReverseVectorEnumerator.java
Go to the documentation of this file.
00001 /*
00002  * @(#)ReverseVectorEnumerator.java 5.1
00003  *
00004  */
00005 
00006 package CH.ifa.draw.util;
00007 
00008 import java.util.*;
00009 
00013 public class ReverseVectorEnumerator
00014 implements Enumeration {
00015 
00016     Vector vector;
00017     int count;
00018 
00019     public ReverseVectorEnumerator(Vector v) {
00020            vector = v;
00021            count = vector.size() - 1;
00022     }
00023 
00024     public boolean hasMoreElements() {
00025            return count >= 0;
00026     }
00027 
00028     public Object nextElement() {
00029            if (count >= 0) {
00030                   return vector.elementAt(count--);
00031            }
00032            throw new NoSuchElementException("ReverseVectorEnumerator");
00033     }
00034 
00035 }