001/* An interface for interpreters that work with the ShellTextArea.
002
003 Copyright (c) 1998-2005 The Regents of the University of California.
004 All rights reserved.
005
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
009 above copyright notice and the following two paragraphs appear in all
010 copies 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 */
028package ptolemy.gui;
029
030//////////////////////////////////////////////////////////////////////////
031//// ShellInterpreter
032
033/**
034 An interface for interpreters that work with the ShellTextArea.
035
036 @see ShellTextArea
037 @author Edward A. Lee
038 @version $Id$
039 @since Ptolemy II 3.0
040 @Pt.ProposedRating Red (cxh)
041 @Pt.AcceptedRating Red (cxh)
042 */
043public interface ShellInterpreter {
044    /** Evaluate the specified command. If this method returns null, then
045     *  the associated ShellTextArea will not display a prompt until
046     *  returnResult() is called. If this method returns an empty string,
047     *  then the associated ShellTextArea will display the prompt.
048     *  @see ShellTextArea#returnResult(String)
049     *  @param command The command.
050     *  @return The return value of the command, or null if there is none.
051     *  @exception Exception If something goes wrong processing the command.
052     */
053    public String evaluateCommand(String command) throws Exception;
054
055    /** Return true if the specified command is complete (ready
056     *  to be interpreted).
057     *  @param command The command.
058     *  @return True if the command is complete.
059     */
060    public boolean isCommandComplete(String command);
061}