001/* A model for testing. 002 003 Copyright (c) 1997-2013 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.actor.gui.test; 029 030import java.util.List; 031 032import ptolemy.actor.TypedCompositeActor; 033import ptolemy.actor.lib.Ramp; 034import ptolemy.actor.lib.Recorder; 035import ptolemy.domains.sdf.kernel.SDFDirector; 036import ptolemy.kernel.util.Workspace; 037 038/////////////////////////////////////////////////////////////////// 039//// TestModel 040 041/** 042 A model for testing. 043 044 @author Edward A. Lee 045 @version $Id$ 046 @since Ptolemy II 0.4 047 @Pt.ProposedRating Red (eal) 048 @Pt.AcceptedRating Red (cxh) 049 */ 050public class TestModel extends TypedCompositeActor { 051 /** Construct the test model in the supplied workspace. 052 * @param workspace The workspace in which to build the model. 053 * @exception Exception If the model cannot be constructed. 054 */ 055 public TestModel(Workspace workspace) throws Exception { 056 super(workspace); 057 058 // Construct the model. 059 Ramp ramp = new Ramp(this, "ramp"); 060 _rec = new Recorder(this, "rec"); 061 connect(ramp.output, _rec.input); 062 063 // Attach a director. 064 SDFDirector dir = new SDFDirector(this, "director"); 065 dir.iterations.setExpression("3"); 066 } 067 068 /////////////////////////////////////////////////////////////////// 069 //// public methods //// 070 071 /** Return the history of the recorder. 072 * @return a list Tokens. 073 */ 074 public List getResults() { 075 return _rec.getHistory(0); 076 } 077 078 /////////////////////////////////////////////////////////////////// 079 //// private variables //// 080 private Recorder _rec; 081}