001/* An analysis for schedules on graphs. 002 003 Copyright (c) 2003-2014 The Regents of the University of California. 004 All rights reserved. 005 Permission is hereby granted, without written agreement and without 006 license or royalty fees, to use, copy, modify, and distribute this 007 software and its documentation for any purpose, provided that the above 008 copyright notice and the following two paragraphs appear in all copies 009 of this software. 010 011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 015 SUCH DAMAGE. 016 017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 022 ENHANCEMENTS, OR MODIFICATIONS. 023 024 PT_COPYRIGHT_VERSION_2 025 COPYRIGHTENDKEY 026 027 */ 028package ptolemy.graph.sched; 029 030import ptolemy.graph.analysis.Analysis; 031import ptolemy.graph.analysis.analyzer.Analyzer; 032 033/////////////////////////////////////////////////////////////////// 034//// ScheduleAnalysis 035 036/** 037 An analysis for schedules on graphs. The analyzer associate with this analysis 038 which is supposed to implement the ScheduleAnalyzer interface generates a 039 Schedule for a given Graph. The analyzer that for a given implementation would 040 extend the Strategy ( or CachedStrategy) class contains the scheduling 041 algorithm. Scheduling strategies can be dynamically changed, therefore dynamic 042 schedulings are also supported. 043 <p> 044 @see ptolemy.graph.Graph 045 @see ptolemy.graph.analysis.Analysis 046 @see ptolemy.graph.analysis.strategy.CachedStrategy 047 @see ptolemy.graph.sched.ScheduleAnalysis 048 @see ptolemy.graph.sched.ScheduleAnalyzer 049 @since Ptolemy II 4.0 050 @Pt.ProposedRating red (shahrooz) 051 @Pt.AcceptedRating red (ssb) 052 @author Shahrooz Shahparnia 053 */ 054public class ScheduleAnalysis extends Analysis { 055 /** Construct an instance of this class with the given analyzer. 056 * 057 * @param analyzer The given analyzer. 058 */ 059 public ScheduleAnalysis(ScheduleAnalyzer analyzer) { 060 super(analyzer); 061 } 062 063 /////////////////////////////////////////////////////////////////// 064 //// public classes //// 065 066 /** Return the schedule computed by the associated analyzer. 067 * 068 * @return Return the schedule computed by the associated analyzer. 069 */ 070 public Schedule schedule() { 071 return ((ScheduleAnalyzer) analyzer()).schedule(); 072 } 073 074 /** Check if a given analyzer is compatible with this analysis. 075 * In other words if it is possible to use it to compute the computation 076 * associated with this analysis. 077 * Derived classes should override this method to provide the valid type 078 * of analyzer that they need. 079 * 080 * @param analyzer The given analyzer. 081 * @return True if the given analyzer is valid for this analysis. 082 */ 083 @Override 084 public boolean validAnalyzerInterface(Analyzer analyzer) { 085 return analyzer instanceof ScheduleAnalyzer; 086 } 087}