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 nodes.
020 *
021 * comments: should a doubly linked list implement Enumeration?
022 */
023 class SpaceEffGraphNodeList implements Enumeration<SpaceEffGraphNodeList> {
024 SpaceEffGraphNode _node;
025 SpaceEffGraphNodeList _next;
026 SpaceEffGraphNodeList _prev;
027
028 SpaceEffGraphNodeList() {
029 _node = null;
030 _next = null;
031 _prev = null;
032 }
033
034 public boolean hasMoreElements() {
035 return _next != null;
036 }
037
038 // return the next GraphNodeList element.
039 public SpaceEffGraphNodeList nextElement() {
040 SpaceEffGraphNodeList tmp = _next;
041 _next = _next._next;
042 return tmp;
043 }
044
045 SpaceEffGraphNode node() {
046 return _node;
047 }
048
049 SpaceEffGraphNodeList next() {
050 return _next;
051 }
052
053 SpaceEffGraphNodeList prev() {
054 return _prev;
055 }
056 }