001/* Profile for an actor being debugged.
002
003 Copyright (c) 1998-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.vergil.debugger;
029
030import java.util.HashSet;
031
032import ptolemy.actor.FiringEvent.FiringEventType;
033import ptolemy.vergil.basic.BasicGraphController;
034
035///////////////////////////////////////////////////////////////////
036//// DebugProfile
037
038/**
039 Profile for an actor being debugged.  Contains the FiringEventTypes on
040 which the actor should break.
041
042 @author Elaine Cheong
043 @version $Id$
044 @since Ptolemy II 2.1
045 @Pt.ProposedRating Red (celaine)
046 @Pt.AcceptedRating Red (celaine)
047 */
048public class DebugProfile {
049    /** Construct a debug profile for an actor with the associated
050     *  GraphController.
051     *  @param graphController The GraphController.
052     */
053    public DebugProfile(BasicGraphController graphController) {
054        _graphController = graphController;
055        _firingEventTypes = new HashSet();
056    }
057
058    ///////////////////////////////////////////////////////////////////
059    ////                         public methods                    ////
060
061    /** Get the GraphController.
062     *  @return The GraphController.
063     */
064    public BasicGraphController getGraphController() {
065        return _graphController;
066    }
067
068    /** See if the DebugProfile contains this FiringEventType.
069     *  @param type the FiringEventType.
070     *  @return True if the DebugProfile contains this FiringEventType.
071     */
072    public boolean isListening(FiringEventType type) {
073        return _firingEventTypes.contains(type);
074    }
075
076    /** Add this FiringEventType to the DebugProfile.
077     *  @param type the FiringEventType.
078     */
079    public void listenForEvent(FiringEventType type) {
080        _firingEventTypes.add(type);
081    }
082
083    /** See if the DebugProfile contains this FiringEventType.
084     *  @param type the FiringEventType.
085     *  @return True if the DebugProfile contains this FiringEventType.
086     */
087    public boolean matches(FiringEventType type) {
088        // FIXME: is this method needed?
089        return false;
090    }
091
092    /** Remove this FiringEventType from the DebugProfile.
093     *  @param type the FiringEventType.
094     */
095    public void unlistenForEvent(FiringEventType type) {
096        _firingEventTypes.remove(type);
097    }
098
099    ///////////////////////////////////////////////////////////////////
100    ////                         private variables                 ////
101    // Set of firing event types we want to break on.
102    private HashSet _firingEventTypes;
103
104    // The GraphController associated with this actor.
105    private BasicGraphController _graphController;
106}