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     * Interface to allow building top-sort, by calling TopSort.buildTopSort()
018     * 5/25/1999
019     */
020    public interface TopSortInterface {
021    
022      /**
023       * Return the start node if forward = true for forward topsort,
024       * and return the end node if forward = false for backward topsort.
025       * @param forward whether we are viewing the graph in the forward direction
026       * @return the start node if forward = true for forward topsort,
027       *         the end node if forward = false for backward topsort.
028       */
029      SortedGraphNode startNode(boolean forward);
030    
031      /**
032       * Return the number of nodes in the graph
033       * @return the number of nodes in the graph
034       */
035      int numberOfNodes();
036    
037      /**
038       * Return true if no resetTopSorted(forward) has been executed
039       * since the last setTopSorted(forward) has been executed
040       * @param forward whether we are viewing the graph in the forward direction
041       * @return true if no resetTopSorted(forward) has been executed
042       * since the last setTopSorted(forward) has been executed
043       */
044      boolean isTopSorted(boolean forward);
045    
046      /**
047       * Should have a side effect such that isTopSorted(forward)
048       * returns the correct value.
049       * @param forward whether we are viewing the graph in the forward direction
050       */
051      void setTopSorted(boolean forward);
052    
053      /**
054       * Should have a side effect such that isTopSorted(forward)
055       * returns the correct value.
056       */
057      void resetTopSorted();
058    }
059    
060    
061