001    /*
002     *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003     *
004     *  This file is licensed to You under the Eclipse Public License (EPL);
005     *  You may not use this file except in compliance with the License. You
006     *  may obtain a copy of the License at
007     *
008     *      http://www.opensource.org/licenses/eclipse-1.0.php
009     *
010     *  See the COPYRIGHT.txt file distributed with this work for information
011     *  regarding copyright ownership.
012     */
013    package org.jikesrvm.compilers.opt.util;
014    
015    import java.util.Enumeration;
016    
017    
018    class SpaceEffGraphEdgeList implements Enumeration<SpaceEffGraphEdgeList> {
019      SpaceEffGraphEdge _edge;
020      SpaceEffGraphEdgeList _next;
021      SpaceEffGraphEdgeList _prev;
022    
023      @Override
024      public boolean hasMoreElements() {
025        return _next != null;
026      }
027    
028      @Override
029      public SpaceEffGraphEdgeList nextElement() {
030        SpaceEffGraphEdgeList tmp = _next;
031        _next = _next._next;
032        return tmp;
033      }
034    
035      public SpaceEffGraphEdge edge() {
036        return _edge;
037      }
038    
039      public SpaceEffGraphEdgeList next() {
040        return _next;
041      }
042    
043      public SpaceEffGraphEdgeList prev() {
044        return _prev;
045      }
046    
047      public boolean inGraphEdgeList(SpaceEffGraphEdge edge) {
048        SpaceEffGraphEdgeList n = this;
049        while (n != null) {
050          if (n._edge == edge) {
051            return true;
052          }
053          n = n._next;
054        }
055        return false;
056      }
057    }