001/* A marker interface for attributes that extend their container's scope.
002
003 Copyright (c) 2001-2014 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 @ProposedRating Red (liuxj)
028 @AcceptedRating Red (liuxj)
029
030 */
031package ptolemy.kernel.util;
032
033import java.util.List;
034
035//////////////////////////////////////////////////////////////////////////
036//// ScopeExtender
037
038/**
039 An interface for attributes that extend their container's scope. Any
040 parameter contained by an attribute implementing this interface has the same
041 visibility as parameters of the container of the attribute.
042
043 @author Xiaojun Liu
044@version $Id$
045@since Ptolemy II 10.0
046 @version $Id$
047 @see ptolemy.data.expr.Variable
048 */
049public interface ScopeExtender {
050    /** Return a list of the attributes contained by this object.
051     *  If there are no attributes, return an empty list.
052     *  This method is read-synchronized on the workspace.
053     *  @return An unmodifiable list of instances of Attribute.
054     */
055    public List attributeList();
056
057    /** Expand the scope of the container by creating any required parameters.
058     *  This should set the expressions of the parameters, but not evaluate
059     *  them (not call validate().
060     *  @exception IllegalActionException If any required attribute cannot be
061     *   created.
062     */
063    public void expand() throws IllegalActionException;
064
065    /** Get the attribute with the given name. The name may be compound,
066     *  with fields separated by periods, in which case the attribute
067     *  returned is contained by a (deeply) contained attribute.
068     *  @param name The name of the desired attribute.
069     *  @return The requested attribute if it is found, null otherwise.
070     */
071    public Attribute getAttribute(String name);
072
073    /** Evaluate the expressions of all the parameters of the scope extender.
074     *  @exception IllegalActionException If any required attribute cannot be
075     *   created.
076     */
077    public void validate() throws IllegalActionException;
078}