001/* A variable is an attribute that contains a token and can be referenced
002 in expressions.
003
004 Copyright (c) 2006 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
029 */
030package ptolemy.data.expr;
031
032import ptolemy.kernel.util.IllegalActionException;
033import ptolemy.kernel.util.NameDuplicationException;
034import ptolemy.kernel.util.NamedObj;
035
036//////////////////////////////////////////////////////////////////////////
037//// TemporaryVariable
038
039/**
040 This is identical to a Variable except that creating it does not
041 increment the workspace version. It should be used to create
042 a variable to store information and make that information visible
043 to the user, but where the presence of this variable has no bearing
044 on type resolution, scheduling, model structure, or any other
045 property of the model that might invalidate cached information.
046 This variable should be used with caution, but use of this
047 variable can significantly improve performance since it makes
048 caching of information that is expensive to compute much more
049 effective.
050
051 @author Edward A. Lee
052 @version $Id$
053 @since Ptolemy II 5.2
054 @Pt.ProposedRating Green (eal)
055 @Pt.AcceptedRating Red (cxh)
056 */
057public class TemporaryVariable extends Variable {
058
059    /** Construct a variable with the given name as an attribute of the
060     *  given container. The container argument must not be null, otherwise
061     *  a NullPointerException will be thrown. This variable will use the
062     *  workspace of the container for synchronization and version counts,
063     *  but creation of this variable will not increment the version number
064     *  of that workspace.
065     *  If the name argument is null, then the name is set to the empty
066     *  string.
067     *  @param container The container.
068     *  @param name The name of the variable.
069     *  @exception IllegalActionException If the container does not accept
070     *   a variable as its attribute.
071     *  @exception NameDuplicationException If the name coincides with a
072     *   variable already in the container.
073     */
074    public TemporaryVariable(NamedObj container, String name)
075            throws IllegalActionException, NameDuplicationException {
076        super(container, name, null, false);
077    }
078}