001    /*
002     * Copyright 2005 Stephen J. McConnell.
003     *
004     * Licensed  under the  Apache License,  Version 2.0  (the "License");
005     * you may not use  this file  except in  compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *   http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed  under the  License is distributed on an "AS IS" BASIS,
012     * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
013     * implied.
014     *
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    
019    package net.dpml.state;
020    
021    /**
022     * Interface describing an application state.
023     *
024     * @author <a href="http://www.dpml.net">Digital Product Management Laboratory</a>
025     * @version 2.0.2
026     */
027    public interface State
028    {   
029       /**
030        * Constant artifact type for a state graph.
031        */
032        static final String TYPE = "state";
033         
034       /**
035        * Return the name of the state.
036        * @return the state name
037        */
038        String getName();
039        
040       /**
041        * Set the parent state. 
042        * @param state the parent state
043        */
044        void setParent( State state );
045    
046       /**
047        * Return the parent state to this state or null if this is 
048        * the root of a state graph.
049        * @return the parent state
050        */
051        State getParent();
052        
053       /**
054        * Return the state path.  The path is composed of a sequence of 
055        * states from the root to this state.
056        * @return the state path
057        */
058        State[] getStatePath();
059        
060       /**
061        * Return the substates within this state.
062        * @return the substate array
063        */
064        State[] getStates();
065        
066       /**
067        * Return the array of triggers associated with the state.
068        * @return the trigger array
069        */
070        Trigger[] getTriggers();
071        
072       /**
073        * Return the array of transtions associated with the state.
074        * @return the transition array
075        */
076        Transition[] getTransitions();
077        
078       /**
079        * Return the array of operations associated with the state.
080        * @return the operation array
081        */
082        Operation[] getOperations();
083        
084       /**
085        * Return the array of management interfaces associated with 
086        * the state.
087        * @return the interfaces array
088        */
089        Interface[] getInterfaces();
090        
091       /**
092        * Test is the state is a terminal state.
093        * @return true if terminal
094        */
095        boolean isTerminal();
096    }