001/* Exception thrown on an attempt to evaluate an expression that 002 contains an unknown constant or identifier 003 004 Copyright (c) 2007-2015 The Regents of the University of California. 005 All rights reserved. 006 Permission is hereby granted, without written agreement and without 007 license or royalty fees, to use, copy, modify, and distribute this 008 software and its documentation for any purpose, provided that the above 009 copyright notice and the following two paragraphs appear in all copies 010 of this software. 011 012 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 013 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 014 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 015 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 016 SUCH DAMAGE. 017 018 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 019 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 020 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 021 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 022 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 023 ENHANCEMENTS, OR MODIFICATIONS. 024 025 PT_COPYRIGHT_VERSION_2 026 COPYRIGHTENDKEY 027 028 */ 029package ptolemy.data.expr; 030 031import ptolemy.kernel.util.IllegalActionException; 032 033/////////////////////////////////////////////////////////////////// 034//// UndefinedConstantOrIdentifer 035 036/** 037 Thrown on an attempt to evaluate an expression that contains an 038 unknown constant or identifier. 039 040 <p>This exception is used to catch missing constants or identifiers 041 during cut and paste operations by {@link ptolemy.data.expr.ParseTreeEvaluator#visitLeafNode(ptolemy.data.expr.ASTPtLeafNode)}. 042 043 @author Christopher Brooks 044 @version $Id$ 045 @since Ptolemy II 6.1 046 @Pt.ProposedRating Red (cxh) 047 @Pt.AcceptedRating Red (cxh) 048 */ 049@SuppressWarnings("serial") 050public class UndefinedConstantOrIdentifierException 051 extends IllegalActionException { 052 /** Constructs an Exception with a detail message that includes the 053 * name of the first argument. 054 * @param nodeName The name of the missing constant or identifier 055 */ 056 public UndefinedConstantOrIdentifierException(String nodeName) { 057 super("The ID " + nodeName + " is undefined."); 058 _nodeName = nodeName; 059 } 060 061 /////////////////////////////////////////////////////////////////// 062 //// public methods //// 063 064 /** Return the node name that caused the exception. 065 * @return the name of the unidentified constant or identifier 066 * that caused the exception. 067 */ 068 public String nodeName() { 069 return _nodeName; 070 } 071 072 /////////////////////////////////////////////////////////////////// 073 //// private variables //// 074 075 /** The name of the missing constant or identifier. 076 */ 077 private String _nodeName; 078}