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 */
013package org.jikesrvm.compilers.opt.util;
014
015import java.util.Enumeration;
016
017
018/**
019 * A generic interface for graph nodes.  All graph utilities should be
020 * defined in terms of this interface, and all graph implementations
021 * should make sure their nodes implement this interface.
022 *
023 * @see Graph
024 * @see GraphEdge
025 * @see GraphUtilities
026 */
027public interface GraphNode {
028
029  /**
030   * Get an enumeration of all the edges to which edges sourced at
031   * this node point.
032   * @return an enumeration of all the edges to which edges sourced
033   * at this node point.
034   */
035  Enumeration<GraphNode> outNodes();
036
037  /**
038   * Get an enumeration of all the edges at which edges that point
039   * to this node are sourced.
040   * @return an enumeration of all the edges at which edges that
041   * point to this node are sourced.
042   */
043  Enumeration<GraphNode> inNodes();
044
045  /**
046   *  The index of this node in its graph.  In general, this can e
047   * anarbitrary number, but after a call to
048   * {@link Graph#compactNodeNumbering
049   * Graph.compactNodeNumbering} the nodes of a graph should be
050   * numbered 0 thru (# of nodes in graph - 1).
051   *
052   * @return the index of this node in its graph.
053   */
054  int getIndex();
055
056  void setIndex(int i);
057}
058
059
060