From: Stefan T. <th...@us...> - 2002-04-08 16:45:14
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine In directory usw-pr-cvs1:/tmp/cvs-serv15599/statemachine Modified Files: XMLHandler.java PrimitiveStateMachine.java Parser.java DataObject.java Log Message: Debug Messages Index: XMLHandler.java =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XMLHandler.java 4 Apr 2002 05:42:24 -0000 1.7 --- XMLHandler.java 8 Apr 2002 14:13:15 -0000 1.8 *************** *** 26,31 **** import org.xml.sax.helpers.DefaultHandler; ! import org.dinopolis.util.DFactory; ! //---------------------------------------------------------------------- --- 26,30 ---- import org.xml.sax.helpers.DefaultHandler; ! import edu.iicm.xpg.util.Debug; //---------------------------------------------------------------------- *************** *** 53,57 **** public XMLHandler(PrimitiveStateMachine state_machine,DataObject data) ! throws IllegalArgumentException { super(); --- 52,56 ---- public XMLHandler(PrimitiveStateMachine state_machine,DataObject data) ! throws IllegalArgumentException { super(); *************** *** 59,64 **** if (state_machine == null || data == null) { ! throw (new IllegalArgumentException ! ("initialize XMLHandler with statemachine or data equal null!")); } state_machine_=state_machine; --- 58,63 ---- if (state_machine == null || data == null) { ! throw (new IllegalArgumentException ! ("initialize XMLHandler with statemachine or data equal null!")); } state_machine_=state_machine; *************** *** 108,122 **** try { ! if (length > 0) ! { ! data_.getXMLElement().setValue(new String(chars, start, length)); ! } ! state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length)); } catch(Exception exc) { ! // FIXXME: think of better exception handling; no system.exit? ! exc.printStackTrace(); ! System.exit(1); } } --- 107,121 ---- try { ! if (length > 0) ! { ! data_.getXMLElement().setValue(new String(chars, start, length)); ! } ! state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length)); } catch(Exception exc) { ! // FIXXME: think of better exception handling; no system.exit? ! exc.printStackTrace(); ! System.exit(1); } } *************** *** 140,144 **** if (attributes != null) { ! xml_element.setAttributes(attributes); } data_.getXMLElementStack().push(xml_element); --- 139,143 ---- if (attributes != null) { ! xml_element.setAttributes(attributes); } data_.getXMLElementStack().push(xml_element); *************** *** 195,202 **** public void error(SAXParseException exc) { ! System.err.println("SAX Error: " ! + ", line " + exc.getLineNumber() ! + "\n, uri " + exc.getSystemId()); ! System.err.println(" " + exc.getMessage()); } --- 194,202 ---- public void error(SAXParseException exc) { ! if (Debug.DEBUG) ! Debug.println(Debug.PARSER_LEVEL,"SAX Error: " ! + ", line " + exc.getLineNumber() ! + "\n, uri " + exc.getSystemId()); ! exc.printStackTrace(); } *************** *** 210,219 **** public void fatalError(SAXParseException exc) { ! System.err.println("SAX Fatal Error: " ! + ", line " + exc.getLineNumber() ! + "\n, uri " + exc.getSystemId()); ! System.err.println(" " + exc.getMessage()); exc.printStackTrace(); - System.exit(-2); } --- 210,218 ---- public void fatalError(SAXParseException exc) { ! if (Debug.DEBUG) ! Debug.println(Debug.PARSER_LEVEL,"SAX Fatal Error: " ! + ", line " + exc.getLineNumber() ! + "\n, uri " + exc.getSystemId()); exc.printStackTrace(); } *************** *** 227,237 **** public void warning(SAXParseException exc) { ! System.err.println("SAX Warning: " ! + ", line " + exc.getLineNumber() ! + "\n, uri " + exc.getSystemId()); ! System.err.println(" " + exc.getMessage()); exc.printStackTrace(); } } --- 226,244 ---- public void warning(SAXParseException exc) { ! if (Debug.DEBUG) ! Debug.println(Debug.PARSER_LEVEL,"SAX Warning: " ! + ", line " + exc.getLineNumber() ! + "\n, uri " + exc.getSystemId()); exc.printStackTrace(); } } + + + + + + + + Index: PrimitiveStateMachine.java =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/PrimitiveStateMachine.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PrimitiveStateMachine.java 7 Feb 2002 09:38:12 -0000 1.2 --- PrimitiveStateMachine.java 8 Apr 2002 14:13:15 -0000 1.3 *************** *** 1,291 **** ! /*********************************************************************** ! * @(#)$RCSfile$ $Revision$ $Date$ ! * ! * Copyright (c) 2001 IICM, Graz University of Technology ! * Schiesstattgasse 4a, A-8010 Graz, Austria. ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU Lesser General Public License (LGPL) ! * as published by the Free Software Foundation; either version 2.1 of ! * the License, or (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this program; if not, write to the ! * Free Software Foundation, Inc., ! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! ***********************************************************************/ ! ! ! package edu.iicm.xpg.statemachine; ! ! import java.util.HashMap; ! import java.util.Set; ! ! //---------------------------------------------------------------------- ! /** ! * @author Klaus Schmaranz ! * @version $revision$ ! */ ! ! public class PrimitiveStateMachine implements StateMachine ! { ! protected HashMap states_; ! protected State start_state_; ! protected State current_state_; ! protected DataObject user_data_; ! protected int status_; ! ! protected final static int RUNNING = 0x00000001; ! protected final static int STOPPED = 0x00000002; ! protected final static int INITIALIZED = 0x00000004; ! ! //---------------------------------------------------------------------- ! /** ! */ ! ! public PrimitiveStateMachine() ! { ! states_ = new HashMap(); ! } ! ! ! //---------------------------------------------------------------------- ! /** ! * @param start_state_id the id of the start state of this machine ! * @return ! * @exception IllegalArgumentException thrown if the state is invalid ! */ ! ! public void setStartState(String start_state_id) ! throws IllegalArgumentException ! { ! if (start_state_id == null) ! throw(new IllegalArgumentException("start_state_id is null")); ! State new_start_state = (State)states_.get(start_state_id); ! if (new_start_state == null) ! throw(new IllegalArgumentException("start_state_id not registered")); ! start_state_ = new_start_state; ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param state the state to be registered ! * @param state_id the id under which the state is registered ! * @return ! * @exception IllegalArgumentException thrown if state is not valid ! */ ! ! public void registerState(State state,String state_id) ! throws IllegalArgumentException ! { ! if (states_.containsKey(state_id)) ! throw(new IllegalArgumentException("duplicate id")); ! states_.put(state_id,state); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param state_id the id of the state to be unregistered ! * @return ! * @exception IllegalArgumentException thrown if state is not valid or not registered ! */ ! ! public void unregisterState(String state_id) ! throws IllegalArgumentException ! { ! if (!states_.containsKey(state_id)) ! throw(new IllegalArgumentException("state not registered")); ! states_.remove(state_id); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @return all registered states ! */ ! ! public Set getRegisteredStates() ! { ! return(states_.keySet()); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param state_id the Id of a state ! * @return true if a state with the given id is registered, false otherwise ! * @exception IllegalArgumentException thrown if id is not valid ! */ ! ! public boolean isStateRegistered(String state_id) ! throws IllegalArgumentException ! { ! return(states_.containsKey(state_id)); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @return the current state of this machine ! */ ! ! public State getCurrentState() ! { ! return(current_state_); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param state_id the Id of a state ! * @return a set of all registered transisitons for the given state ! * @exception IllegalArgumentException thrown if Id is not valid ! */ ! ! public Set getRegisteredTransitions(String state_id) ! throws IllegalArgumentException ! { ! if (!states_.containsKey(state_id)) ! throw(new IllegalArgumentException("state not registered")); ! State state = (State)states_.get(state_id); ! return(state.getRegisteredTransitions()); ! } ! ! ! //---------------------------------------------------------------------- ! /** ! * @param transition the transition object to be registered ! * @param input the input that leads to this transition ! * @param from_state_id starting point of the transition ! * @param to_state_id end point of the transition ! * @return ! * @exception IllegalArgumentException thrown if one of the parameters is not valid ! */ ! ! public void registerTransition(Input input,Transition transition, ! String from_state_id,String to_state_id) ! throws IllegalArgumentException, DuplicateStateException ! { ! State from_state = (State)states_.get(from_state_id); ! State to_state = (State)states_.get(to_state_id); ! if ((from_state == null) || (to_state == null) || ! (input == null) || (transition == null)) ! throw(new IllegalArgumentException()); ! from_state.registerTransition(input,transition,to_state); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param transition the transition object to be registered ! * @param from_state_id starting point of the transition ! * @param to_state_id end point of the transition ! * @return ! * @exception IllegalArgumentException thrown if one of the parameters is not valid ! */ ! ! public void registerDefaultTransition(Transition transition, ! String from_state_id,String to_state_id) ! throws IllegalArgumentException ! { ! State from_state = (State)states_.get(from_state_id); ! State to_state = (State)states_.get(to_state_id); ! if ((from_state == null) || (to_state == null) || (transition == null)) ! throw(new IllegalArgumentException()); ! from_state.registerDefaultTransition(transition,to_state); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param input the input that leads to the transition ! * @param from_state_id ! * @return ! * @exception IllegalArgumentException ! */ ! ! public void unregisterTransition(Input input,String from_state_id) ! throws IllegalArgumentException ! { ! State from_state = (State)states_.get(from_state_id); ! if ((from_state == null) || (input == null)) ! throw(new IllegalArgumentException()); ! from_state.unregisterTransition(input); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param data the user-defined data object that is passed as a parameter ! * @return ! */ ! ! public void setUserDefinedDataObject(DataObject data) ! { ! user_data_ = data; ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param input the input that leads to a transision ! * @return ! * @exception Exception whatever exception can be thrown by the transition ! */ ! ! public void input(Input input) ! throws Exception ! { ! if ((status_ & (RUNNING | INITIALIZED)) == 0) ! throw(new IllegalStateException()); ! if ((status_ & RUNNING) != 0) ! { ! status_ &= ~INITIALIZED; ! status_ |= RUNNING; ! } ! Transition transition = current_state_.getTransition(input); ! if (transition == null) ! throw(new IllegalArgumentException("no transition for this input")); ! ! State default_new_state = current_state_.getTransitionDestination(input); ! System.err.println("********Input: " + ((XMLInput)input).getValue()); ! ! // System.out.println(" PSM.input: " + input + ", state: " + current_state_); ! ! String desired_state = transition.transitionTriggered(input,current_state_, ! default_new_state,this,user_data_); ! if (desired_state != null) // overriding the default state ! { ! if (!states_.containsKey(desired_state)) ! throw(new IllegalArgumentException("desired state not existing")); ! current_state_ = (State)states_.get(desired_state); ! return; ! } ! current_state_ = default_new_state; ! } ! ! //---------------------------------------------------------------------- ! /** ! * @return ! */ ! ! public void stopMachine() ! { ! current_state_ = null; ! status_ = STOPPED; ! } ! ! //---------------------------------------------------------------------- ! /** ! * @return ! */ ! ! public void initializeMachine() ! { ! current_state_ = start_state_; ! if (current_state_ != null) ! status_ = INITIALIZED; ! else ! status_ = 0; ! } ! ! } ! ! --- 1,294 ---- ! /*********************************************************************** ! * @(#)$RCSfile$ $Revision$ $Date$ ! * ! * Copyright (c) 2001 IICM, Graz University of Technology ! * Schiesstattgasse 4a, A-8010 Graz, Austria. ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU Lesser General Public License (LGPL) ! * as published by the Free Software Foundation; either version 2.1 of ! * the License, or (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this program; if not, write to the ! * Free Software Foundation, Inc., ! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! ***********************************************************************/ ! ! ! package edu.iicm.xpg.statemachine; ! ! import java.util.HashMap; ! import java.util.Set; ! ! import edu.iicm.xpg.util.Debug; ! ! //---------------------------------------------------------------------- ! /** ! * @author Klaus Schmaranz ! * @version $revision$ ! */ ! ! public class PrimitiveStateMachine implements StateMachine ! { ! protected HashMap states_; ! protected State start_state_; ! protected State current_state_; ! protected DataObject user_data_; ! protected int status_; ! ! protected final static int RUNNING = 0x00000001; ! protected final static int STOPPED = 0x00000002; ! protected final static int INITIALIZED = 0x00000004; ! ! //---------------------------------------------------------------------- ! /** ! */ ! ! public PrimitiveStateMachine() ! { ! states_ = new HashMap(); ! } ! ! ! //---------------------------------------------------------------------- ! /** ! * @param start_state_id the id of the start state of this machine ! * @return ! * @exception IllegalArgumentException thrown if the state is invalid ! */ ! ! public void setStartState(String start_state_id) ! throws IllegalArgumentException ! { ! if (start_state_id == null) ! throw(new IllegalArgumentException("start_state_id is null")); ! State new_start_state = (State)states_.get(start_state_id); ! if (new_start_state == null) ! throw(new IllegalArgumentException("start_state_id not registered")); ! start_state_ = new_start_state; ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param state the state to be registered ! * @param state_id the id under which the state is registered ! * @return ! * @exception IllegalArgumentException thrown if state is not valid ! */ ! ! public void registerState(State state,String state_id) ! throws IllegalArgumentException ! { ! if (states_.containsKey(state_id)) ! throw(new IllegalArgumentException("duplicate id")); ! states_.put(state_id,state); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param state_id the id of the state to be unregistered ! * @return ! * @exception IllegalArgumentException thrown if state is not valid or not registered ! */ ! ! public void unregisterState(String state_id) ! throws IllegalArgumentException ! { ! if (!states_.containsKey(state_id)) ! throw(new IllegalArgumentException("state not registered")); ! states_.remove(state_id); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @return all registered states ! */ ! ! public Set getRegisteredStates() ! { ! return(states_.keySet()); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param state_id the Id of a state ! * @return true if a state with the given id is registered, false otherwise ! * @exception IllegalArgumentException thrown if id is not valid ! */ ! ! public boolean isStateRegistered(String state_id) ! throws IllegalArgumentException ! { ! return(states_.containsKey(state_id)); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @return the current state of this machine ! */ ! ! public State getCurrentState() ! { ! return(current_state_); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param state_id the Id of a state ! * @return a set of all registered transisitons for the given state ! * @exception IllegalArgumentException thrown if Id is not valid ! */ ! ! public Set getRegisteredTransitions(String state_id) ! throws IllegalArgumentException ! { ! if (!states_.containsKey(state_id)) ! throw(new IllegalArgumentException("state not registered")); ! State state = (State)states_.get(state_id); ! return(state.getRegisteredTransitions()); ! } ! ! ! //---------------------------------------------------------------------- ! /** ! * @param transition the transition object to be registered ! * @param input the input that leads to this transition ! * @param from_state_id starting point of the transition ! * @param to_state_id end point of the transition ! * @return ! * @exception IllegalArgumentException thrown if one of the parameters is not valid ! */ ! ! public void registerTransition(Input input,Transition transition, ! String from_state_id,String to_state_id) ! throws IllegalArgumentException, DuplicateStateException ! { ! State from_state = (State)states_.get(from_state_id); ! State to_state = (State)states_.get(to_state_id); ! if ((from_state == null) || (to_state == null) || ! (input == null) || (transition == null)) ! throw(new IllegalArgumentException()); ! from_state.registerTransition(input,transition,to_state); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param transition the transition object to be registered ! * @param from_state_id starting point of the transition ! * @param to_state_id end point of the transition ! * @return ! * @exception IllegalArgumentException thrown if one of the parameters is not valid ! */ ! ! public void registerDefaultTransition(Transition transition, ! String from_state_id,String to_state_id) ! throws IllegalArgumentException ! { ! State from_state = (State)states_.get(from_state_id); ! State to_state = (State)states_.get(to_state_id); ! if ((from_state == null) || (to_state == null) || (transition == null)) ! throw(new IllegalArgumentException()); ! from_state.registerDefaultTransition(transition,to_state); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param input the input that leads to the transition ! * @param from_state_id ! * @return ! * @exception IllegalArgumentException ! */ ! ! public void unregisterTransition(Input input,String from_state_id) ! throws IllegalArgumentException ! { ! State from_state = (State)states_.get(from_state_id); ! if ((from_state == null) || (input == null)) ! throw(new IllegalArgumentException()); ! from_state.unregisterTransition(input); ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param data the user-defined data object that is passed as a parameter ! * @return ! */ ! ! public void setUserDefinedDataObject(DataObject data) ! { ! user_data_ = data; ! } ! ! //---------------------------------------------------------------------- ! /** ! * @param input the input that leads to a transision ! * @return ! * @exception Exception whatever exception can be thrown by the transition ! */ ! ! public void input(Input input) ! throws Exception ! { ! if ((status_ & (RUNNING | INITIALIZED)) == 0) ! throw(new IllegalStateException()); ! if ((status_ & RUNNING) != 0) ! { ! status_ &= ~INITIALIZED; ! status_ |= RUNNING; ! } ! Transition transition = current_state_.getTransition(input); ! if (transition == null) ! throw(new IllegalArgumentException("no transition for this input")); ! ! State default_new_state = current_state_.getTransitionDestination(input); ! if (Debug.DEBUG) ! Debug.println(Debug.VERBOSE_LEVEL,"********Input: " + ((XMLInput)input).getValue()); ! ! // System.out.println(" PSM.input: " + input + ", state: " + current_state_); ! ! String desired_state = transition.transitionTriggered(input,current_state_, ! default_new_state,this,user_data_); ! if (desired_state != null) // overriding the default state ! { ! if (!states_.containsKey(desired_state)) ! throw(new IllegalArgumentException("desired state not existing")); ! current_state_ = (State)states_.get(desired_state); ! return; ! } ! current_state_ = default_new_state; ! } ! ! //---------------------------------------------------------------------- ! /** ! * @return ! */ ! ! public void stopMachine() ! { ! current_state_ = null; ! status_ = STOPPED; ! } ! ! //---------------------------------------------------------------------- ! /** ! * @return ! */ ! ! public void initializeMachine() ! { ! current_state_ = start_state_; ! if (current_state_ != null) ! status_ = INITIALIZED; ! else ! status_ = 0; ! } ! ! } ! ! Index: Parser.java =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Parser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Parser.java 4 Apr 2002 05:42:24 -0000 1.6 --- Parser.java 8 Apr 2002 14:13:15 -0000 1.7 *************** *** 29,32 **** --- 29,34 ---- import org.xml.sax.helpers.XMLReaderFactory; + import edu.iicm.xpg.util.Debug; + //---------------------------------------------------------------------- /** *************** *** 66,70 **** catch (SAXException exc) { ! // FIXXME: maybe think of a better exception handling here! exc.printStackTrace(); } --- 68,72 ---- catch (SAXException exc) { ! // FIXXME: maybe think of a better exception handling here! exc.printStackTrace(); } *************** *** 83,93 **** if (!input_file.exists()) { ! // FIXXME: better exception handling is needed here! ! System.err.println("Parser: File " + filename + " not existing"); System.exit(-1); } try { ! System.err.println("Begin Parsing"); FileReader file_reader = new FileReader(input_file); reader_.parse(new InputSource(file_reader)); --- 85,97 ---- if (!input_file.exists()) { ! // FIXXME: better exception handling is needed here! ! if (Debug.DEBUG) ! Debug.println(Debug.PARSER_LEVEL," File " + filename + " not existing"); System.exit(-1); } try { ! if (Debug.DEBUG) ! Debug.println(Debug.VERBOSE_LEVEL,"Begin Parsing"); FileReader file_reader = new FileReader(input_file); reader_.parse(new InputSource(file_reader)); *************** *** 95,99 **** catch (Exception exc) { ! // FIXXME: System.exit ?? exc.printStackTrace(); System.exit(1); --- 99,103 ---- catch (Exception exc) { ! // FIXXME: System.exit ?? exc.printStackTrace(); System.exit(1); *************** *** 110,123 **** public void setHandlers(XMLHandler handler) ! throws IllegalArgumentException { ! if (handler == null) ! { ! throw (new IllegalArgumentException ("handler in setHandlers is null!")); ! } ! reader_.setContentHandler(handler); ! reader_.setErrorHandler(handler); ! reader_.setDTDHandler(handler); } --- 114,127 ---- public void setHandlers(XMLHandler handler) ! throws IllegalArgumentException { ! if (handler == null) ! { ! throw (new IllegalArgumentException ("handler in setHandlers is null!")); ! } ! reader_.setContentHandler(handler); ! reader_.setErrorHandler(handler); ! reader_.setDTDHandler(handler); } *************** *** 149,153 **** catch (SAXException e) { ! System.err.println("Cannot activate validation."); } try --- 153,159 ---- catch (SAXException e) { ! if (Debug.DEBUG) ! Debug.println(Debug.PARSER_LEVEL,"Cannot activate validation."); ! } try *************** *** 157,161 **** catch (SAXException e) { ! System.err.println("Cannot activate Dynamic validation."); } try --- 163,168 ---- catch (SAXException e) { ! if (Debug.DEBUG) ! Debug.println(Debug.PARSER_LEVEL,"Cannot activate Dynamic validation."); } try *************** *** 165,169 **** catch (SAXException e) { ! System.err.println("Cannot activate SCHEMA validation."); } } --- 172,177 ---- catch (SAXException e) { ! if (Debug.DEBUG) ! Debug.println(Debug.PARSER_LEVEL,"Cannot activate SCHEMA validation."); } } Index: DataObject.java =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/DataObject.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DataObject.java 4 Apr 2002 05:42:24 -0000 1.7 --- DataObject.java 8 Apr 2002 14:13:15 -0000 1.8 *************** *** 28,31 **** --- 28,33 ---- import java.util.EmptyStackException; + import edu.iicm.xpg.util.Debug; + //---------------------------------------------------------------------- *************** *** 54,59 **** * @return the top xml element */ ! // FIXXME: should this function throw an exception if the stack is empty ! // (but no EmptyStackException!) ? public XMLElement getXMLElement() { --- 56,61 ---- * @return the top xml element */ ! // FIXXME: should this function throw an exception if the stack is empty ! // (but no EmptyStackException!) ? public XMLElement getXMLElement() { *************** *** 76,80 **** protected Stack getXMLElementStack() { ! return xml_element_stack_; } --- 78,82 ---- protected Stack getXMLElementStack() { ! return xml_element_stack_; } *************** *** 87,105 **** */ public void putObject(String key, Object value) ! throws IllegalArgumentException { ! if (key == null || value == null) ! { ! throw (new IllegalArgumentException ("put object into data object with key or value equal null!")); ! } ! // FIXXME: there should be a possibility storing multiple data with ! // the same key; possibly a stack for each data object will be used ! if ( data_map_.containsKey(key) ) ! { ! System.err.println("\"" + key + "\" allready exists inDataObject"); ! return; ! } ! data_map_.put(key, value); } --- 89,109 ---- */ public void putObject(String key, Object value) ! throws IllegalArgumentException { ! if (key == null || value == null) ! { ! throw (new IllegalArgumentException ("put object into data object with key or value equal null!")); ! } ! // FIXXME: there should be a possibility storing multiple data with ! // the same key; possibly a stack for each data object will be used ! if ( data_map_.containsKey(key) ) ! { ! if (Debug.DEBUG) ! Debug.println(Debug.WARNING_LEVEL,"\"" + key + "\" allready exists inDataObject"); ! ! return; ! } ! data_map_.put(key, value); } *************** *** 112,123 **** */ public Object getObject(String key) ! throws IllegalArgumentException { ! if (key == null) ! { ! throw (new IllegalArgumentException ("get object with key equal null!")); ! } ! return data_map_.get(key); } --- 116,127 ---- */ public Object getObject(String key) ! throws IllegalArgumentException { ! if (key == null) ! { ! throw (new IllegalArgumentException ("get object with key equal null!")); ! } ! return data_map_.get(key); } *************** *** 130,141 **** */ public Object removeObject(String key) ! throws IllegalArgumentException { ! if (key == null) ! { ! throw (new IllegalArgumentException ("remove object with key equal null!")); ! } ! return data_map_.remove(key); } } --- 134,145 ---- */ public Object removeObject(String key) ! throws IllegalArgumentException { ! if (key == null) ! { ! throw (new IllegalArgumentException ("remove object with key equal null!")); ! } ! return data_map_.remove(key); } } |