001/* 002 * Copyright (c) 2007-2010 The Regents of the University of California. 003 * All rights reserved. 004 * 005 * '$Author: crawl $' 006 * '$Date: 2017-08-10 23:35:13 +0000 (Thu, 10 Aug 2017) $' 007 * '$Revision: 34598 $' 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.kepler.provenance; 031 032import java.util.Map; 033 034import ptolemy.actor.Actor; 035import ptolemy.kernel.util.DebugEvent; 036import ptolemy.kernel.util.NamedObj; 037 038/** An event that is published by actors as they fire to report provenance. 039 * 040 * Any actor that wants to record extra provenance about how it is carrying 041 * out its job, can create and publish these events using the _debug method. 042 * 043 * @see ptolemy.actor.FiringEvent; 044 * @see ptolemy.kernel.util.DebugListener 045 * 046 * @author Karen Schuchardt 047 * @version $Id: ProvenanceEvent.java 34598 2017-08-10 23:35:13Z crawl $ 048 */ 049 050public class ProvenanceEvent implements DebugEvent 051{ 052 public ProvenanceEvent(Actor actor, Map<String,String> map) 053 { 054 _actor = actor; 055 _map = map; 056 } 057 058 public Map<String,String> getMap() 059 { 060 return _map; 061 } 062 063 /////////////////////////////////////////////////////////////////// 064 //// DebugEvent interface 065 066 /** Return the source of the event. 067 * @return The ptolemy object that published this event. 068 */ 069 @Override 070 public NamedObj getSource() 071 { 072 return (NamedObj)_actor; 073 } 074 075 /** Return a string representation of this event. 076 * @return A user-readable string describing the event. 077 */ 078 @Override 079 public String toString() 080 { 081 return "Provenance table for actor " + _actor.getFullName() + ": " + 082 _map.toString(); 083 } 084 085 /////////////////////////////////////////////////////////////////// 086 //// protected variables //// 087 088 protected Actor _actor; 089 protected Map<String,String> _map; 090}