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