001/* 002 * Copyright (c) 2002-2010 The Regents of the University of California. 003 * All rights reserved. 004 * 005 * '$Author: welker $' 006 * '$Date: 2010-05-06 05:21:26 +0000 (Thu, 06 May 2010) $' 007 * '$Revision: 24234 $' 008 * 009 * Permission is hereby granted, without written agreement and without 010 * license or royalty fees, to use, copy, modify, and distribute this 011 * software and its documentation for any purpose, provided that the above 012 * copyright notice and the following two paragraphs appear in all copies 013 * of this software. 014 * 015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 019 * SUCH DAMAGE. 020 * 021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 026 * ENHANCEMENTS, OR MODIFICATIONS. 027 * 028 */ 029 030package org.geon; 031 032import ptolemy.actor.TypedAtomicActor; 033import ptolemy.actor.TypedIOPort; 034import ptolemy.data.IntToken; 035import ptolemy.data.StringToken; 036import ptolemy.data.type.BaseType; 037import ptolemy.kernel.CompositeEntity; 038import ptolemy.kernel.util.IllegalActionException; 039import ptolemy.kernel.util.NameDuplicationException; 040 041////////////////////////////////////////////////////////////////////////// 042//// DiagramTransitions 043/** 044 * This is a domain specific actor that holds all the information about rock 045 * naming diagrams and the transtions between them. It transfers the data along 046 * with initial information to a process that loops over the rock data. (As 047 * currently there are only two digitized diagram, there is no actual 048 * transitions table yet. The actor will be extended once more diagrams are 049 * available). 050 * 051 * @author Efrat Jaeger 052 * @version $Id: DiagramTransitions.java 24234 2010-05-06 05:21:26Z welker $ 053 * @since Ptolemy II 3.0.2 054 */ 055public class DiagramTransitions extends TypedAtomicActor { 056 057 /** 058 * Construct an actor with the given container and name. 059 * 060 * @param container 061 * The container. 062 * @param name 063 * The name of this actor. 064 * @exception IllegalActionException 065 * If the actor cannot be contained by the proposed 066 * container. 067 * @exception NameDuplicationException 068 * If the container already has an actor with this name. 069 */ 070 public DiagramTransitions(CompositeEntity container, String name) 071 throws NameDuplicationException, IllegalActionException { 072 super(container, name); 073 diagramsAndTransitions = new TypedIOPort(this, 074 "diagramsAndTransitions", false, true); 075 diagramsAndTransitions.setTypeEquals(BaseType.STRING); 076 index = new TypedIOPort(this, "index", false, true); 077 index.setTypeEquals(BaseType.INT); 078 079 _attachText("_iconDescription", "<svg>\n" 080 + "<rect x=\"-25\" y=\"-20\" " + "width=\"50\" height=\"40\" " 081 + "style=\"fill:yellow\"/>\n" 082 + "<polygon points=\"-15,-2 0,-15 15,-2 11,15 -11,15\" " 083 + "style=\"fill:white\"/>\n" + "</svg>\n"); 084 } 085 086 // ///////////////////////////////////////////////////////////////// 087 // // ports and parameters //// 088 089 /** 090 * All the diagrams and transitions information. 091 */ 092 public TypedIOPort diagramsAndTransitions; 093 094 /** 095 * A reference to the initial diagram. 096 */ 097 public TypedIOPort index; 098 099 // ///////////////////////////////////////////////////////////////// 100 // // public methods //// 101 102 /** 103 * Provide the diagrams and transitions between them along with a refernce 104 * to first diagram. 105 * 106 * @exception IllegalActionException 107 * If there's no director. 108 */ 109 public void fire() throws IllegalActionException { 110 111 // FIX ME: need to implement the transitions table as soon as we have 112 // more diagrams digitized. 113 diagramsAndTransitions.broadcast(new StringToken( 114 "Diagrams and Transitions")); 115 index.broadcast(new IntToken(1)); 116 } 117 118 /** 119 * Return false to indicate that the process has finished. 120 * 121 * @exception IllegalActionException 122 * If thrown by the super class. 123 */ 124 public boolean postfire() throws IllegalActionException { 125 return false; 126 } 127}