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    //
019    // List of Graph Edges.
020    
021    //
022    class SpaceEffGraphEdgeList implements Enumeration<SpaceEffGraphEdgeList> {
023      SpaceEffGraphEdge _edge;
024      SpaceEffGraphEdgeList _next;
025      SpaceEffGraphEdgeList _prev;
026    
027      public boolean hasMoreElements() {
028        return _next != null;
029      }
030    
031      public SpaceEffGraphEdgeList nextElement() {
032        SpaceEffGraphEdgeList tmp = _next;
033        _next = _next._next;
034        return tmp;
035      }
036    
037      public SpaceEffGraphEdge edge() {
038        return _edge;
039      }
040    
041      public SpaceEffGraphEdgeList next() {
042        return _next;
043      }
044    
045      public SpaceEffGraphEdgeList prev() {
046        return _prev;
047      }
048    
049      public boolean inGraphEdgeList(SpaceEffGraphEdge edge) {
050        SpaceEffGraphEdgeList n = this;
051        while (n != null) {
052          if (n._edge == edge) {
053            return true;
054          }
055          n = n._next;
056        }
057        return false;
058      }
059    }