You can subscribe to this list here.
| 2002 |
Jan
(11) |
Feb
(32) |
Mar
(18) |
Apr
(17) |
May
(52) |
Jun
(1) |
Jul
|
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: G?nther B. <br...@us...> - 2002-04-04 05:42:28
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv31375/transitions
Modified Files:
StoreDataTransition.java
Log Message:
a little exception handling added
Index: StoreDataTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StoreDataTransition.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** StoreDataTransition.java 21 Mar 2002 08:10:17 -0000 1.7
--- StoreDataTransition.java 4 Apr 2002 05:42:24 -0000 1.8
***************
*** 78,83 ****
data.putObject("nextstate", element_value);
break;
! case ELEMENT:
! data.putObject("element", element_value);
data.putObject("type", element.getAttributes().getValue("type"));
break;
--- 78,86 ----
data.putObject("nextstate", element_value);
break;
! case ELEMENT:
! if (element_value != null)
! {
! data.putObject("element", element_value);
! }
data.putObject("type", element.getAttributes().getValue("type"));
break;
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv31375/statemachine
Modified Files:
DataObject.java InitInitializeStateMachine.java
InitParser.java Initializer.java Parser.java XMLElement.java
XMLHandler.java
Log Message:
a little exception handling added
Index: DataObject.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/DataObject.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** DataObject.java 21 Mar 2002 08:10:16 -0000 1.6
--- DataObject.java 4 Apr 2002 05:42:24 -0000 1.7
***************
*** 40,43 ****
--- 40,46 ----
protected HashMap data_map_;
+ //----------------------------------------------------------------------
+ /**
+ */
public DataObject()
{
***************
*** 48,53 ****
--- 51,59 ----
//----------------------------------------------------------------------
/**
+ * get the 'actual' xml element
* @return the top xml element
*/
+ // FIXXME: should this function throw an exception if the stack is empty
+ // (but no EmptyStackException!) ?
public XMLElement getXMLElement()
{
***************
*** 65,68 ****
--- 71,75 ----
//----------------------------------------------------------------------
/**
+ * get the whole xml element stack
* @return the xml element stack
*/
***************
*** 74,110 ****
//----------------------------------------------------------------------
/**
* @param key a description of the stored data
* @param value the dataobject that should be stored
*/
public void putObject(String key, Object value)
{
// 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);
}
//----------------------------------------------------------------------
/**
* @param key the identificator of the stored data
* @return the dataobject
*/
public Object getObject(String key)
{
! return data_map_.get(key);
}
//----------------------------------------------------------------------
/**
* @param key the identificator of the stored data
* @return the dataobject
*/
public Object removeObject(String key)
{
! return data_map_.remove(key);
}
}
--- 81,141 ----
//----------------------------------------------------------------------
/**
+ * put a kind of data as object to the hashmap and store it by usage of key
* @param key a description of the stored data
* @param value the dataobject that should be stored
+ * @exception IllegalArgumentException thrown if one of the arguments is NULL
*/
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);
}
//----------------------------------------------------------------------
/**
+ * get data from the hashmap stored by key
* @param key the identificator of the stored data
* @return the dataobject
+ * @exception IllegalArgumentException thrown if key is null
*/
public Object getObject(String key)
+ throws IllegalArgumentException
{
! if (key == null)
! {
! throw (new IllegalArgumentException
! ("get object with key equal null!"));
! }
! return data_map_.get(key);
}
//----------------------------------------------------------------------
/**
+ * get data from the hashmap stored by key and remove it
* @param key the identificator of the stored data
* @return the dataobject
+ * @exception IllegalArgumentException thrown if key is null
*/
public Object removeObject(String key)
+ throws IllegalArgumentException
{
! if (key == null)
! {
! throw (new IllegalArgumentException
! ("remove object with key equal null!"));
! }
! return data_map_.remove(key);
}
}
Index: InitInitializeStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitInitializeStateMachine.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** InitInitializeStateMachine.java 8 Mar 2002 19:04:38 -0000 1.4
--- InitInitializeStateMachine.java 4 Apr 2002 05:42:24 -0000 1.5
***************
*** 31,34 ****
--- 31,35 ----
import edu.iicm.xpg.transitions.SetSearchPathTransition;
+
//----------------------------------------------------------------------
/**
***************
*** 43,47 ****
*
* @author Stefan Thalauer
! * @author Günther Brand
* @version $Revision$
*/
--- 44,48 ----
*
* @author Stefan Thalauer
! * @author Guenther Brand
* @version $Revision$
*/
***************
*** 52,106 ****
// elements
! public final static String XML_STM_CONFIG = "statemachine";
! public final static String XML_PATH_DEF = "path";
! public final static String XML_STATE_LIST = "states";
! public final static String XML_START_STATE_DEF = "startstate";
! public final static String XML_STATE_DEF = "state";
! public final static String XML_TRANSITION_LIST = "transitions";
! public final static String XML_TRANSITION_DEF = "transition";
! public final static String XML_BEGINSTATE = "beginstate";
! public final static String XML_NEXTSTATE = "nextstate";
! public final static String XML_ELEMENT = "element";
! public final static String XML_CLASSNAME = "classname";
// machine states
! public final static String STATE_TOP_LEVEL_FILE = "file top";
! public final static String STATE_TOP_LEVEL_DOC_TYPE = "doctype top";
! public final static String STATE_PATH_DEF = "path def";
! public final static String STATE_STATE_LIST = "state list";
! public final static String STATE_START_STATE_DEF = "start state def";
! public final static String STATE_STATE_DEF = "state def";
! public final static String STATE_TRANSITION_LIST = "transition list";
! public final static String STATE_TRANSITION_DEF = "transition def";
! public final static String STATE_BEGINSTATE = "beginstate";
! public final static String STATE_NEXTSTATE = "nextstate";
! public final static String STATE_ELEMENT = "element";
! public final static String STATE_CLASSNAME = "classname";
! public final static String STATE_FINISHED = "finished";
public InitInitializeStateMachine()
{
! state_machine_=null;
}
//----------------------------------------------------------------------
/**
* @return the initialized Statemachine
*/
public PrimitiveStateMachine getStateMachine()
{
! return state_machine_;
}
//----------------------------------------------------------------------
/**
! * The following state machine is built here: Init a Statemachine
! *
* @param state_machine the statemachine
* @return
*/
public void initialize(PrimitiveStateMachine state_machine)
{
state_machine_ = state_machine;
--- 53,124 ----
// elements
! protected final static String XML_STM_CONFIG = "statemachine";
! protected final static String XML_PATH_DEF = "path";
! protected final static String XML_STATE_LIST = "states";
! protected final static String XML_START_STATE_DEF = "startstate";
! protected final static String XML_STATE_DEF = "state";
! protected final static String XML_TRANSITION_LIST = "transitions";
! protected final static String XML_TRANSITION_DEF = "transition";
! protected final static String XML_BEGINSTATE = "beginstate";
! protected final static String XML_NEXTSTATE = "nextstate";
! protected final static String XML_ELEMENT = "element";
! protected final static String XML_CLASSNAME = "classname";
// machine states
! protected final static String STATE_TOP_LEVEL_FILE = "file top";
! protected final static String STATE_TOP_LEVEL_DOC_TYPE = "doctype top";
! protected final static String STATE_PATH_DEF = "path def";
! protected final static String STATE_STATE_LIST = "state list";
! protected final static String STATE_START_STATE_DEF = "start state def";
! protected final static String STATE_STATE_DEF = "state def";
! protected final static String STATE_TRANSITION_LIST = "transition list";
! protected final static String STATE_TRANSITION_DEF = "transition def";
! protected final static String STATE_BEGINSTATE = "beginstate";
! protected final static String STATE_NEXTSTATE = "nextstate";
! protected final static String STATE_ELEMENT = "element";
! protected final static String STATE_CLASSNAME = "classname";
! protected final static String STATE_FINISHED = "finished";
+ //----------------------------------------------------------------------
+ /**
+ */
public InitInitializeStateMachine()
{
! state_machine_ = null;
}
//----------------------------------------------------------------------
/**
+ * get the (initialized) statemachine
* @return the initialized Statemachine
+ * @exception IllegalStateException thrown if the statemachine is null
*/
public PrimitiveStateMachine getStateMachine()
+ throws IllegalStateException
{
! if (state_machine_ == null)
! {
! throw (new IllegalStateException("statemachine is null!"));
! }
! return state_machine_;
}
//----------------------------------------------------------------------
/**
! * initialize the 'hardcoded' statemachine
* @param state_machine the statemachine
* @return
+ * @exception IllegalArgumentException thrown if state_machine is null
*/
public void initialize(PrimitiveStateMachine state_machine)
+ throws IllegalArgumentException
{
+ if (state_machine == null)
+ {
+ throw (new IllegalArgumentException
+ ("statemachine to initialize is null!"));
+ }
+
state_machine_ = state_machine;
***************
*** 301,304 ****
--- 319,323 ----
catch (Exception exc)
{
+ // FIXXME: think of a better exceptionhandling here!
exc.printStackTrace();
}
Index: InitParser.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitParser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** InitParser.java 28 Feb 2002 06:40:19 -0000 1.3
--- InitParser.java 4 Apr 2002 05:42:24 -0000 1.4
***************
*** 28,31 ****
--- 28,32 ----
import org.dinopolis.util.DFactory;
+
//----------------------------------------------------------------------
/**
***************
*** 46,55 ****
/**
* @param config_file
*/
! public InitParser(String config_file)
{
super();
DFactory transition_factory = new DFactory(DEFAULT_SEARCH_PATH);
data_.putObject(TRANSITION_FATORY, transition_factory);
--- 47,63 ----
/**
* @param config_file
+ * @exception IllegalArgumentException thrown if config_file is null
*/
! public InitParser(String config_file)
! throws IllegalArgumentException
{
super();
+ if (config_file == null)
+ {
+ throw (new IllegalArgumentException
+ ("configfile of InitParser is null!"));
+ }
DFactory transition_factory = new DFactory(DEFAULT_SEARCH_PATH);
data_.putObject(TRANSITION_FATORY, transition_factory);
***************
*** 60,70 ****
//----------------------------------------------------------------------
/**
! * The following state machine is built here: *
* @return
! * @exception Exception whatever can happen during initialization
*/
public void initialize(PrimitiveStateMachine new_state_machine)
{
setFeatures();
setHandlers();
--- 68,86 ----
//----------------------------------------------------------------------
/**
! * initialize the statemachine with the initializer
! * @param new_state_machine the statemachine that should be initialized
* @return
! * @exception IllegalArgumentException thrown if new_state_machine is null
*/
public void initialize(PrimitiveStateMachine new_state_machine)
+ throws IllegalArgumentException
{
+ if (new_state_machine == null)
+ {
+ throw (new IllegalArgumentException
+ ("new_state_machine in initialize is null!"));
+ }
+
setFeatures();
setHandlers();
***************
*** 78,81 ****
--- 94,98 ----
//----------------------------------------------------------------------
/**
+ * get the initialized statemachine
* @return the initialized Statemachine
*/
Index: Initializer.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Initializer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Initializer.java 28 Feb 2002 06:40:19 -0000 1.4
--- Initializer.java 4 Apr 2002 05:42:24 -0000 1.5
***************
*** 33,47 ****
{
-
//----------------------------------------------------------------------
/**
* @param statemachine the statemachine
* @return
*/
! public void initialize(PrimitiveStateMachine statemachine);
//----------------------------------------------------------------------
/**
* @return the initialized Statemachine
*/
--- 33,50 ----
{
//----------------------------------------------------------------------
/**
+ * initialize a statemachine
* @param statemachine the statemachine
* @return
+ * @exception IllegalArgumentException thrown if statemachine is null
*/
! public void initialize(PrimitiveStateMachine statemachine)
! throws IllegalArgumentException;
//----------------------------------------------------------------------
/**
+ * get the (initialized) statemachine
* @return the initialized Statemachine
*/
Index: Parser.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Parser.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Parser.java 8 Mar 2002 19:04:38 -0000 1.5
--- Parser.java 4 Apr 2002 05:42:24 -0000 1.6
***************
*** 66,69 ****
--- 66,70 ----
catch (SAXException exc)
{
+ // FIXXME: maybe think of a better exception handling here!
exc.printStackTrace();
}
***************
*** 72,89 ****
//----------------------------------------------------------------------
/**
- * @deprecated
- */
-
- public Parser(PrimitiveStateMachine state_machine)
- {
- this();
- state_machine_ = state_machine;
- }
-
- //----------------------------------------------------------------------
- /**
* Parse a file , calls the XMLHandler
* @param file the xml file to parse
! * @return public
*/
--- 73,79 ----
//----------------------------------------------------------------------
/**
* Parse a file , calls the XMLHandler
* @param file the xml file to parse
! * @return
*/
***************
*** 93,96 ****
--- 83,87 ----
if (!input_file.exists())
{
+ // FIXXME: better exception handling is needed here!
System.err.println("Parser: File " + filename + " not existing");
System.exit(-1);
***************
*** 104,108 ****
catch (Exception exc)
{
! System.err.println(exc);
exc.printStackTrace();
System.exit(1);
--- 95,99 ----
catch (Exception exc)
{
! // FIXXME: System.exit ??
exc.printStackTrace();
System.exit(1);
***************
*** 112,128 ****
//----------------------------------------------------------------------
/**
* @return
*/
public void setHandlers(XMLHandler handler)
{
! reader_.setContentHandler(handler);
! reader_.setErrorHandler(handler);
! reader_.setDTDHandler(handler);
}
-
//----------------------------------------------------------------------
/**
* @return
*/
--- 103,128 ----
//----------------------------------------------------------------------
/**
+ * set the diverse handlers for the xml reader
+ * @param handler the handler that should be set
* @return
+ * @exception IllegalArgumentException thrown if handler is null
*/
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);
}
//----------------------------------------------------------------------
/**
+ * set the intern handler for the xml reader
* @return
*/
***************
*** 135,142 ****
}
-
//----------------------------------------------------------------------
/**
! * @param
* @return
*/
--- 135,141 ----
}
//----------------------------------------------------------------------
/**
! * set the features for the xml reader
* @return
*/
Index: XMLElement.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLElement.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** XMLElement.java 21 Mar 2002 08:10:16 -0000 1.2
--- XMLElement.java 4 Apr 2002 05:42:24 -0000 1.3
***************
*** 25,28 ****
--- 25,29 ----
import org.xml.sax.helpers.AttributesImpl;
+
//----------------------------------------------------------------------
/**
***************
*** 39,70 ****
//----------------------------------------------------------------------
/**
- * @param name the name that should be set
*/
protected void setName(String name)
{
! if ( name != null)
! name_ = name;
! else ;
! // FIXXME: send warning!
}
//----------------------------------------------------------------------
/**
* @return the name
*/
-
public String getName()
{
! return name_;
}
//----------------------------------------------------------------------
/**
* @param value the value that should be set
*/
-
protected void setValue(String value)
{
value_ = value;
}
--- 40,98 ----
//----------------------------------------------------------------------
/**
*/
+ public XMLElement()
+ {
+ name_ = null;
+ value_ = null;
+ attributes_ = null;
+ }
+ //----------------------------------------------------------------------
+ /**
+ * set the name of the xml element
+ * @param name the name that should be set
+ * @exception IllegalArgumentException thrown if name is null
+ */
protected void setName(String name)
+ throws IllegalArgumentException
{
! if (name == null)
! {
! throw (new IllegalArgumentException
! ("set name of xml element equal to null!"));
! }
! name_ = name;
}
//----------------------------------------------------------------------
/**
+ * get the name of the xml element
* @return the name
+ * @exception IllegalStateException thrown if name is null
*/
public String getName()
+ throws IllegalStateException
{
! if (name_ == null)
! {
! throw (new IllegalStateException("name of xml element is null!"));
! }
! return name_;
}
//----------------------------------------------------------------------
/**
+ * set the value (content) of the xml element
* @param value the value that should be set
+ * @exception IllegalArgumentException thrown if value is null
*/
protected void setValue(String value)
+ throws IllegalArgumentException
{
+ if (value == null)
+ {
+ throw (new IllegalArgumentException
+ ("set value of xml element equal to null!"));
+ }
value_ = value;
}
***************
*** 72,78 ****
//----------------------------------------------------------------------
/**
* @return the value
*/
-
public String getValue()
{
--- 100,106 ----
//----------------------------------------------------------------------
/**
+ * get the value of the xml element
* @return the value
*/
public String getValue()
{
***************
*** 82,90 ****
//----------------------------------------------------------------------
/**
* @param attributes the attributes that should be set
*/
-
protected void setAttributes(Attributes attributes)
{
attributes_ = new AttributesImpl(attributes);
}
--- 110,125 ----
//----------------------------------------------------------------------
/**
+ * set the attributes of the xml element
* @param attributes the attributes that should be set
+ * @exception IllegalArgumentException thrown if attributes are null
*/
protected void setAttributes(Attributes attributes)
+ throws IllegalArgumentException
{
+ if (attributes == null)
+ {
+ throw (new IllegalArgumentException
+ ("set attributes of xml element equal to null!"));
+ }
attributes_ = new AttributesImpl(attributes);
}
***************
*** 92,98 ****
//----------------------------------------------------------------------
/**
* @return the attributes
*/
-
public Attributes getAttributes()
{
--- 127,133 ----
//----------------------------------------------------------------------
/**
+ * get the attributes of the xml element
* @return the attributes
*/
public Attributes getAttributes()
{
Index: XMLHandler.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** XMLHandler.java 21 Mar 2002 08:10:16 -0000 1.6
--- XMLHandler.java 4 Apr 2002 05:42:24 -0000 1.7
***************
*** 34,41 ****
* This class extends the DefaultHandler of the SAX2.0 API.
* It sends the XMLInputs to the statemachine.
- * This class replaces the callback functionality of
- * the depricated classes:
- * - InitStatemachine
- * - Generator (Package: .xpg.generator)
*
* @author Stefan Thalauer
--- 34,37 ----
***************
*** 53,61 ****
--- 49,65 ----
* @param state_machine the statemachine which handles the parsed states
* @param data the DataObject for storing diverse data
+ * @exception IllegalArgumentException thrown if state_machine or data is null
*/
public XMLHandler(PrimitiveStateMachine state_machine,DataObject data)
+ throws IllegalArgumentException
{
super();
+
+ if (state_machine == null || data == null)
+ {
+ throw (new IllegalArgumentException
+ ("initialize XMLHandler with statemachine or data equal null!"));
+ }
state_machine_=state_machine;
data_=data;
***************
*** 104,114 ****
try
{
! data_.getXMLElement().setValue(new String(chars, start, length));
! state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
catch(Exception exc)
{
! exc.printStackTrace();
! System.exit(1);
}
}
--- 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);
}
}
***************
*** 130,134 ****
XMLElement xml_element = new XMLElement();
xml_element.setName(name);
! xml_element.setAttributes(attributes);
data_.getXMLElementStack().push(xml_element);
--- 138,145 ----
XMLElement xml_element = new XMLElement();
xml_element.setName(name);
! if (attributes != null)
! {
! xml_element.setAttributes(attributes);
! }
data_.getXMLElementStack().push(xml_element);
|
|
From: G?nther B. <br...@us...> - 2002-04-04 05:42:27
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator
In directory usw-pr-cvs1:/tmp/cvs-serv31375/generator
Modified Files:
DocumentGenerator.java Generator.java
Log Message:
a little exception handling added
Index: DocumentGenerator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/DocumentGenerator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** DocumentGenerator.java 8 Mar 2002 19:04:37 -0000 1.6
--- DocumentGenerator.java 4 Apr 2002 05:42:24 -0000 1.7
***************
*** 31,35 ****
* @author Klaus Schmaranz
* @author Heimo Haub
! * @author Günther Brand
* @version $revision$
*/
--- 31,35 ----
* @author Klaus Schmaranz
* @author Heimo Haub
! * @author Guenther Brand
* @version $revision$
*/
***************
*** 57,90 ****
generator.setHandlers();
generator.parseFile( args[1] );
- // String result = ( String ) generator.getResult();
- // FIXXME: writing result-buffer to outputfile
- // should be a user defineable transition
- /* try
- {
- String result_filename;
- if ( args.length > 2 )
- result_filename = args[2];
- else
- {
- int dot_index = args[1].lastIndexOf('.');
- if (dot_index != -1)
- result_filename = args[1].substring(0, dot_index) + ".html";
- else result_filename = args[1] + ".html";
- }
- File result_file = new File ( result_filename );
- if ( result_file.exists() )
- result_file.delete();
- result_file.createNewFile();
- FileWriter file_writer = new FileWriter ( result_file );
- file_writer.write ( result, 0, result.length() );
- file_writer.flush();
- file_writer.close();
- }
- catch ( IOException exc )
- {
- System.err.println ( exc );
- }
- */
System.exit(0);
}
--- 57,61 ----
Index: Generator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/Generator.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Generator.java 8 Mar 2002 19:04:38 -0000 1.8
--- Generator.java 4 Apr 2002 05:42:24 -0000 1.9
***************
*** 33,37 ****
* @author Klaus Schmaranz
* @author Heimo Haub
! * @author Günther Brand
* @author Stefan Thalauer
* @version $revision$
--- 33,37 ----
* @author Klaus Schmaranz
* @author Heimo Haub
! * @author Guenther Brand
* @author Stefan Thalauer
* @version $revision$
***************
*** 44,47 ****
--- 44,48 ----
//----------------------------------------------------------------------
/**
+ * set up a new generator with the configfile
* @param configfile the filename of the configfile
*/
***************
*** 55,68 ****
initializer_ = new InitParser(config_file);
initializer_.initialize(state_machine_);
- }
-
- //----------------------------------------------------------------------
- /**
- * @return the object that has been generated
- */
-
- public Object getResult()
- {
- return(data_.getObject(Const.RESULT_BUFFER).toString());
}
--- 56,59 ----
|
|
From: G?nther B. <br...@us...> - 2002-04-03 00:36:44
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine In directory usw-pr-cvs1:/tmp/cvs-serv28352/statemachine Removed Files: ElementObject.java Log Message: --- ElementObject.java DELETED --- |
|
From: G?nther B. <br...@us...> - 2002-03-21 08:10:20
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple
In directory usw-pr-cvs1:/tmp/cvs-serv24864/transitions/simple
Modified Files:
WriteParaTransition.java
Log Message:
handling of xml stack modified
Index: WriteParaTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple/WriteParaTransition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WriteParaTransition.java 18 Mar 2002 06:45:55 -0000 1.1
--- WriteParaTransition.java 21 Mar 2002 08:10:17 -0000 1.2
***************
*** 60,64 ****
{
StringBuffer result = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
! String para = data.topXMLElement().getValue().trim();
if (para != null)
--- 60,64 ----
{
StringBuffer result = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
! String para = data.getXMLElement().getValue().trim();
if (para != null)
|
|
From: G?nther B. <br...@us...> - 2002-03-21 08:10:20
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/latex
In directory usw-pr-cvs1:/tmp/cvs-serv24864/transitions/latex
Modified Files:
WriteSectHeaderTransition.java
Log Message:
handling of xml stack modified
Index: WriteSectHeaderTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/latex/WriteSectHeaderTransition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WriteSectHeaderTransition.java 18 Mar 2002 06:45:54 -0000 1.1
--- WriteSectHeaderTransition.java 21 Mar 2002 08:10:17 -0000 1.2
***************
*** 61,65 ****
StringBuffer result = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String section_name =
! data.topXMLElement().getAttributes().getValue("name");
Integer sect_depth_obj = (Integer)data.removeObject("sect_depth");
int sect_depth;
--- 61,65 ----
StringBuffer result = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String section_name =
! data.getXMLElement().getAttributes().getValue("name");
Integer sect_depth_obj = (Integer)data.removeObject("sect_depth");
int sect_depth;
|
|
From: G?nther B. <br...@us...> - 2002-03-21 08:10:19
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv24864/transitions
Modified Files:
StoreDataTransition.java
Log Message:
handling of xml stack modified
Index: StoreDataTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StoreDataTransition.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** StoreDataTransition.java 18 Mar 2002 06:45:54 -0000 1.6
--- StoreDataTransition.java 21 Mar 2002 08:10:17 -0000 1.7
***************
*** 67,71 ****
throws Exception
{
! XMLElement element = data.topXMLElement();
String element_value = element.getValue();
--- 67,71 ----
throws Exception
{
! XMLElement element = data.getXMLElement();
String element_value = element.getValue();
|
|
From: G?nther B. <br...@us...> - 2002-03-21 08:10:19
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv24864/statemachine
Modified Files:
DataObject.java XMLElement.java XMLHandler.java
Log Message:
handling of xml stack modified
Index: DataObject.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/DataObject.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DataObject.java 18 Mar 2002 06:45:54 -0000 1.5
--- DataObject.java 21 Mar 2002 08:10:16 -0000 1.6
***************
*** 31,35 ****
//----------------------------------------------------------------------
/**
! * @author Günther Brand
* @version $revision$
*/
--- 31,35 ----
//----------------------------------------------------------------------
/**
! * @author Guenther Brand
* @version $revision$
*/
***************
*** 37,46 ****
public class DataObject
{
! protected Stack element_stack_;
protected HashMap data_map_;
public DataObject()
{
! element_stack_ = new Stack();
data_map_ = new HashMap();
}
--- 37,46 ----
public class DataObject
{
! protected Stack xml_element_stack_;
protected HashMap data_map_;
public DataObject()
{
! xml_element_stack_ = new Stack();
data_map_ = new HashMap();
}
***************
*** 48,71 ****
//----------------------------------------------------------------------
/**
! * @param element_object the elementobject that should be pushed on the stack
! */
! protected void pushXMLElement(XMLElement element_object)
! {
! element_stack_.push(element_object);
! }
!
! //----------------------------------------------------------------------
! /**
! * @return the top element object
*/
! public XMLElement topXMLElement()
{
try
{
! return (XMLElement)element_stack_.peek();
}
catch (EmptyStackException exc)
{
- System.err.println(exc);
exc.printStackTrace();
}
--- 48,61 ----
//----------------------------------------------------------------------
/**
! * @return the top xml element
*/
! public XMLElement getXMLElement()
{
try
{
! return (XMLElement)xml_element_stack_.peek();
}
catch (EmptyStackException exc)
{
exc.printStackTrace();
}
***************
*** 75,92 ****
//----------------------------------------------------------------------
/**
! * @return the top element object and removes it
*/
! protected XMLElement popXMLElement()
{
! try
! {
! return (XMLElement)element_stack_.pop();
! }
! catch (EmptyStackException exc)
! {
! System.err.println(exc);
! exc.printStackTrace();
! }
! return null;
}
--- 65,73 ----
//----------------------------------------------------------------------
/**
! * @return the xml element stack
*/
! protected Stack getXMLElementStack()
{
! return xml_element_stack_;
}
***************
*** 98,101 ****
--- 79,84 ----
public void putObject(String key, Object value)
{
+ // 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) )
{
Index: XMLElement.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLElement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XMLElement.java 18 Mar 2002 06:45:54 -0000 1.1
--- XMLElement.java 21 Mar 2002 08:10:16 -0000 1.2
***************
*** 24,35 ****
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
- import java.util.HashMap;
- import java.util.Stack;
-
- import java.util.EmptyStackException;
//----------------------------------------------------------------------
/**
! * @author Günther Brand
* @version $revision$
*/
--- 24,31 ----
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
//----------------------------------------------------------------------
/**
! * @author Guenther Brand
* @version $revision$
*/
Index: XMLHandler.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** XMLHandler.java 18 Mar 2002 06:45:54 -0000 1.5
--- XMLHandler.java 21 Mar 2002 08:10:16 -0000 1.6
***************
*** 104,108 ****
try
{
! data_.topXMLElement().setValue(new String(chars, start, length));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
--- 104,108 ----
try
{
! data_.getXMLElement().setValue(new String(chars, start, length));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
***************
*** 128,135 ****
try
{
! XMLElement element_object = new XMLElement();
! element_object.setName(name);
! element_object.setAttributes(attributes);
! data_.pushXMLElement(element_object);
state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
--- 128,135 ----
try
{
! XMLElement xml_element = new XMLElement();
! xml_element.setName(name);
! xml_element.setAttributes(attributes);
! data_.getXMLElementStack().push(xml_element);
state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
***************
*** 155,159 ****
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! data_.popXMLElement();
}
catch(Exception exc)
--- 155,159 ----
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! data_.getXMLElementStack().pop();
}
catch(Exception exc)
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/latex
In directory usw-pr-cvs1:/tmp/cvs-serv3862/transitions/latex
Added Files:
WriteGeneralFooterTransition.java
WriteGeneralHeaderTransition.java WriteHeaderTransition.java
WriteSectHeaderTransition.java
Log Message:
another example 2LATEX added
--- NEW FILE: WriteGeneralFooterTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteGeneralFooterTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:54 $
*
* 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.transitions.latex;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteGeneralFooterTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
html_form.append("\n\\end{document}");
System.out.println(html_form.toString());
return(null);
}
}
--- NEW FILE: WriteGeneralHeaderTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteGeneralHeaderTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:54 $
*
* 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.transitions.latex;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @version $Revision: 1.1 $
*/
public class WriteGeneralHeaderTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = new StringBuffer();
html_form.append("\\documentclass[a4paper,titlepage]{article}\n\\usepackage{times}\n\n" +
"\\begin{document}\n");
data.putObject(Const.RESULT_BUFFER, html_form);
return(null);
}
}
--- NEW FILE: WriteHeaderTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteHeaderTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:54 $
*
* 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.transitions.latex;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteHeaderTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String doc_title = (String)data.getObject("doc_title");
String doc_author = (String)data.getObject("doc_author");
if (doc_title == null)
System.err.println("Error (printing to form): document has no title");
html_form.append("\n\\title{" + doc_title + "}\n");
if (doc_author != null)
html_form.append("\\author{" + doc_author + "}\n");
html_form.append("\\maketitle\n");
return(null);
}
}
--- NEW FILE: WriteSectHeaderTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteSectHeaderTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:54 $
*
* 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.transitions.latex;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
import java.util.Vector;
import java.util.Enumeration;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteSectHeaderTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer result = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String section_name =
data.topXMLElement().getAttributes().getValue("name");
Integer sect_depth_obj = (Integer)data.removeObject("sect_depth");
int sect_depth;
if ( sect_depth_obj == null )
sect_depth = 0;
else sect_depth= sect_depth_obj.intValue();
result.append("\n\\");
for ( int depth = 0; depth < sect_depth; depth++ )
result.append("sub");
result.append("section{" + section_name + "}\n");
data.putObject("sect_depth", new Integer(++sect_depth) );
return(null);
}
}
|
|
From: G?nther B. <br...@us...> - 2002-03-18 06:45:58
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple
In directory usw-pr-cvs1:/tmp/cvs-serv3862/transitions/simple
Added Files:
SectEndTransition.java WriteParaTransition.java
Log Message:
another example 2LATEX added
--- NEW FILE: SectEndTransition.java ---
/***********************************************************************
* @(#)$RCSfile: SectEndTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:55 $
*
* 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.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
import java.util.Vector;
import java.util.Enumeration;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class SectEndTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
data.putObject( "sect_depth",
new Integer(((Integer)data.removeObject("sect_depth")).intValue() - 1) );
return(null);
}
}
--- NEW FILE: WriteParaTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteParaTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:55 $
*
* 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.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
import java.util.Vector;
import java.util.Enumeration;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteParaTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer result = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String para = data.topXMLElement().getValue().trim();
if (para != null)
result.append("\n" + para + "\n");
else
System.err.println("Error (printing to result): sect has no para");
return(null);
}
}
|
|
From: G?nther B. <br...@us...> - 2002-03-18 06:45:58
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv3862/statemachine
Modified Files:
DataObject.java XMLHandler.java
Added Files:
XMLElement.java
Log Message:
another example 2LATEX added
--- NEW FILE: XMLElement.java ---
/***********************************************************************
*
* 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 org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
import java.util.HashMap;
import java.util.Stack;
import java.util.EmptyStackException;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $revision$
*/
public class XMLElement
{
protected String name_;
protected String value_;
protected Attributes attributes_;
//----------------------------------------------------------------------
/**
* @param name the name that should be set
*/
protected void setName(String name)
{
if ( name != null)
name_ = name;
else ;
// FIXXME: send warning!
}
//----------------------------------------------------------------------
/**
* @return the name
*/
public String getName()
{
return name_;
}
//----------------------------------------------------------------------
/**
* @param value the value that should be set
*/
protected void setValue(String value)
{
value_ = value;
}
//----------------------------------------------------------------------
/**
* @return the value
*/
public String getValue()
{
return value_;
}
//----------------------------------------------------------------------
/**
* @param attributes the attributes that should be set
*/
protected void setAttributes(Attributes attributes)
{
attributes_ = new AttributesImpl(attributes);
}
//----------------------------------------------------------------------
/**
* @return the attributes
*/
public Attributes getAttributes()
{
return attributes_;
}
}
Index: DataObject.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/DataObject.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DataObject.java 28 Feb 2002 06:40:19 -0000 1.4
--- DataObject.java 18 Mar 2002 06:45:54 -0000 1.5
***************
*** 37,48 ****
public class DataObject
{
! private Stack element_stack_;
!
! private HashMap data_map_;
public DataObject()
{
element_stack_ = new Stack();
! data_map_= new HashMap();
}
--- 37,47 ----
public class DataObject
{
! protected Stack element_stack_;
! protected HashMap data_map_;
public DataObject()
{
element_stack_ = new Stack();
! data_map_ = new HashMap();
}
***************
*** 51,55 ****
* @param element_object the elementobject that should be pushed on the stack
*/
! protected void pushElementObject(ElementObject element_object)
{
element_stack_.push(element_object);
--- 50,54 ----
* @param element_object the elementobject that should be pushed on the stack
*/
! protected void pushXMLElement(XMLElement element_object)
{
element_stack_.push(element_object);
***************
*** 60,68 ****
* @return the top element object
*/
! public ElementObject topElementObject()
{
try
{
! return (ElementObject)element_stack_.peek();
}
catch (EmptyStackException exc)
--- 59,67 ----
* @return the top element object
*/
! public XMLElement topXMLElement()
{
try
{
! return (XMLElement)element_stack_.peek();
}
catch (EmptyStackException exc)
***************
*** 78,86 ****
* @return the top element object and removes it
*/
! protected ElementObject popElementObject()
{
try
{
! return (ElementObject)element_stack_.pop();
}
catch (EmptyStackException exc)
--- 77,85 ----
* @return the top element object and removes it
*/
! protected XMLElement popXMLElement()
{
try
{
! return (XMLElement)element_stack_.pop();
}
catch (EmptyStackException exc)
Index: XMLHandler.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** XMLHandler.java 8 Mar 2002 19:04:38 -0000 1.4
--- XMLHandler.java 18 Mar 2002 06:45:54 -0000 1.5
***************
*** 104,108 ****
try
{
! data_.topElementObject().setElementValue(new String(chars, start, length));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
--- 104,108 ----
try
{
! data_.topXMLElement().setValue(new String(chars, start, length));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
***************
*** 128,135 ****
try
{
! ElementObject element_object = new ElementObject();
! element_object.setElementName(name);
element_object.setAttributes(attributes);
! data_.pushElementObject(element_object);
state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
--- 128,135 ----
try
{
! XMLElement element_object = new XMLElement();
! element_object.setName(name);
element_object.setAttributes(attributes);
! data_.pushXMLElement(element_object);
state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
***************
*** 155,159 ****
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! data_.popElementObject();
}
catch(Exception exc)
--- 155,159 ----
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! data_.popXMLElement();
}
catch(Exception exc)
|
|
From: G?nther B. <br...@us...> - 2002-03-18 06:45:57
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv3862/transitions
Modified Files:
StoreDataTransition.java
Log Message:
another example 2LATEX added
Index: StoreDataTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StoreDataTransition.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** StoreDataTransition.java 8 Mar 2002 19:04:38 -0000 1.5
--- StoreDataTransition.java 18 Mar 2002 06:45:54 -0000 1.6
***************
*** 29,33 ****
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.DataObject;
! import edu.iicm.xpg.statemachine.ElementObject;
//----------------------------------------------------------------------
--- 29,33 ----
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.DataObject;
! import edu.iicm.xpg.statemachine.XMLElement;
//----------------------------------------------------------------------
***************
*** 67,72 ****
throws Exception
{
! ElementObject element_object = data.topElementObject();
! String element_value = element_object.getElementValue();
switch (data_type_)
--- 67,72 ----
throws Exception
{
! XMLElement element = data.topXMLElement();
! String element_value = element.getValue();
switch (data_type_)
***************
*** 80,84 ****
case ELEMENT:
data.putObject("element", element_value);
! data.putObject("type", element_object.getAttributes().getValue("type"));
break;
case CLASSNAME:
--- 80,84 ----
case ELEMENT:
data.putObject("element", element_value);
! data.putObject("type", element.getAttributes().getValue("type"));
break;
case CLASSNAME:
|
|
From: G?nther B. <br...@us...> - 2002-03-18 06:45:57
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg In directory usw-pr-cvs1:/tmp/cvs-serv3862 Added Files: Test1.xsd statemachine1.xml test1.xml test1a.xml Log Message: another example 2LATEX added --- NEW FILE: Test1.xsd --- <?xml version="1.0" standalone="no"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="document"> <xsd:complexType> <xsd:sequence> <xsd:choice> <xsd:element name="title" type="xsd:string" /> <xsd:element name="docinfo" type="DocInfo" /> </xsd:choice> <xsd:element name="sect" type="Sect" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="DocInfo"> <xsd:sequence> <xsd:element name="title" type="xsd:string" /> <xsd:element name="author" type="xsd:string" minOccurs="0" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Sect"> <xsd:sequence> <xsd:element name="para" type="xsd:string" minOccurs="0" /> <xsd:element name="sect" type="Sect" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:schema> --- NEW FILE: statemachine1.xml --- <?xml version="1.0" standalone="no"?> <statemachine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="StateMachineConfig.xsd"> <path>edu.iicm.xpg.transitions.latex</path> <path>edu.iicm.xpg.transitions.simple</path> <states> <startstate>file top</startstate> <state>doc top</state> <state>doc info def</state> <state>doc title def</state> <state>info title def</state> <state>doc author def</state> <state>sect def</state> <state>sub sect def</state> <state>para</state> <state>sub para</state> <state>finished</state> </states> <transitions> <transition> <beginstate>file top</beginstate> <nextstate>doc top</nextstate> <element type="start">document</element> <classname>WriteGeneralHeaderTransition</classname> </transition> <transition> <beginstate>file top</beginstate> <nextstate>finished</nextstate> <element type="enddoc" /> <classname>StopMachineTransition</classname> </transition> <transition> <beginstate>file top</beginstate> <nextstate>file top</nextstate> <classname>IgnoreCharsTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>file top</nextstate> <element type="end">document</element> <classname>WriteGeneralFooterTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>doc title def</nextstate> <element type="start">title</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>doc info def</nextstate> <element type="start">docinfo</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>sect def</nextstate> <element type="start">sect</element> <classname>WriteSectHeaderTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>doc top</nextstate> <classname>IgnoreCharsTransition</classname> </transition> <transition> <beginstate>doc info def</beginstate> <nextstate>doc top</nextstate> <element type="end">docinfo</element> <classname>WriteHeaderTransition</classname> </transition> <transition> <beginstate>doc info def</beginstate> <nextstate>info title def</nextstate> <element type="start">title</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc info def</beginstate> <nextstate>doc author def</nextstate> <element type="start">author</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc info def</beginstate> <nextstate>doc info def</nextstate> <classname>IgnoreCharsTransition</classname> </transition> <transition> <beginstate>doc title def</beginstate> <nextstate>doc top</nextstate> <element type="end">title</element> <classname>WriteHeaderTransition</classname> </transition> <transition> <beginstate>doc title def</beginstate> <nextstate>doc title def</nextstate> <classname>StoreDocTitleTransition</classname> </transition> <transition> <beginstate>info title def</beginstate> <nextstate>doc info def</nextstate> <element type="end">title</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>info title def</beginstate> <nextstate>info title def</nextstate> <classname>StoreDocTitleTransition</classname> </transition> <transition> <beginstate>doc author def</beginstate> <nextstate>doc info def</nextstate> <element type="end">author</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc author def</beginstate> <nextstate>doc author def</nextstate> <classname>StoreDocAuthorTransition</classname> </transition> <transition> <beginstate>sect def</beginstate> <nextstate>doc top</nextstate> <element type="end">sect</element> <classname>SectEndTransition</classname> </transition> <transition> <beginstate>sect def</beginstate> <nextstate>para</nextstate> <element type="start">para</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>sect def</beginstate> <nextstate>sub sect def</nextstate> <element type="start">sect</element> <classname>WriteSectHeaderTransition</classname> </transition> <transition> <beginstate>sect def</beginstate> <nextstate>sect def</nextstate> <classname>IgnoreCharsTransition</classname> </transition> <transition> <beginstate>sub sect def</beginstate> <nextstate>sect def</nextstate> <element type="end">sect</element> <classname>SectEndTransition</classname> </transition> <transition> <beginstate>sub sect def</beginstate> <nextstate>sub para</nextstate> <element type="start">para</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>sub sect def</beginstate> <nextstate>sub sect def</nextstate> <classname>IgnoreCharsTransition</classname> </transition> <transition> <beginstate>para</beginstate> <nextstate>sect def</nextstate> <element type="end">para</element> <classname>WriteParaTransition</classname> </transition> <transition> <beginstate>para</beginstate> <nextstate>para</nextstate> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>sub para</beginstate> <nextstate>sub sect def</nextstate> <element type="end">para</element> <classname>WriteParaTransition</classname> </transition> <transition> <beginstate>sub para</beginstate> <nextstate>sub para</nextstate> <classname>PrimitiveTransition</classname> </transition> </transitions> </statemachine > --- NEW FILE: test1.xml --- <?xml version="1.0" standalone="no"?> <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Test1.xsd"> <docinfo> <title>TEST 1</title> <author>Guenther Brand</author> </docinfo> <sect name="erstes Kapitel"> <para> Der erste Abschnitt. </para> </sect> <sect name="zweites Kapitel"> <para> Der zweite Abschnitt. </para> </sect> </document> --- NEW FILE: test1a.xml --- <?xml version="1.0" standalone="no"?> <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Test1.xsd"> <docinfo> <title>TEST 1</title> <author>Guenther Brand</author> </docinfo> <sect name="erstes Kapitel"> <para> Der erste Abschnitt. </para> <sect name="zweites Kapitel"> <para> Der zweite Abschnitt. </para> </sect> </sect> </document> |
|
From: G?nther B. <br...@us...> - 2002-03-18 06:41:00
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/latex In directory usw-pr-cvs1:/tmp/cvs-serv2688/transitions/latex Log Message: Directory /cvsroot/xpg-xml/edu/iicm/xpg/transitions/latex added to the repository |
|
From: G?nther B. <br...@us...> - 2002-03-08 19:04:41
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator
In directory usw-pr-cvs1:/tmp/cvs-serv1393/generator
Modified Files:
DocumentGenerator.java Generator.java
Log Message:
schema for test0 added; bug removed; generating output modified
Index: DocumentGenerator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/DocumentGenerator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DocumentGenerator.java 28 Feb 2002 06:42:13 -0000 1.5
--- DocumentGenerator.java 8 Mar 2002 19:04:37 -0000 1.6
***************
*** 49,53 ****
{
System.err.println("usage: DocumentGenerator <config_file> "
! + "<xml_filename> <result_file>");
System.exit(-1);
}
--- 49,53 ----
{
System.err.println("usage: DocumentGenerator <config_file> "
! + "<xml_filename>");
System.exit(-1);
}
***************
*** 57,65 ****
generator.setHandlers();
generator.parseFile( args[1] );
! String result = ( String ) generator.getResult();
// FIXXME: writing result-buffer to outputfile
// should be a user defineable transition
! try
{
String result_filename;
--- 57,65 ----
generator.setHandlers();
generator.parseFile( args[1] );
! // String result = ( String ) generator.getResult();
// FIXXME: writing result-buffer to outputfile
// should be a user defineable transition
! /* try
{
String result_filename;
***************
*** 86,90 ****
System.err.println ( exc );
}
!
System.exit(0);
}
--- 86,90 ----
System.err.println ( exc );
}
! */
System.exit(0);
}
Index: Generator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/Generator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Generator.java 28 Feb 2002 06:42:13 -0000 1.7
--- Generator.java 8 Mar 2002 19:04:38 -0000 1.8
***************
*** 52,56 ****
// set up the statemachine
! System.out.println("Setting up State Machine");
initializer_ = new InitParser(config_file);
initializer_.initialize(state_machine_);
--- 52,56 ----
// set up the statemachine
! System.err.println("Setting up State Machine");
initializer_ = new InitParser(config_file);
initializer_.initialize(state_machine_);
|
|
From: G?nther B. <br...@us...> - 2002-03-08 19:04:41
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv1393/statemachine
Modified Files:
InitInitializeStateMachine.java Parser.java XMLHandler.java
Log Message:
schema for test0 added; bug removed; generating output modified
Index: InitInitializeStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitInitializeStateMachine.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** InitInitializeStateMachine.java 28 Feb 2002 06:40:19 -0000 1.3
--- InitInitializeStateMachine.java 8 Mar 2002 19:04:38 -0000 1.4
***************
*** 260,268 ****
// STATE_BEGINSTATE
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_BEGINSTATE),
! new PrimitiveTransition(),
STATE_BEGINSTATE,
STATE_TRANSITION_DEF);
! state_machine_.registerDefaultTransition(new StoreDataTransition(StoreDataTransition.BEGINSTATE),
STATE_BEGINSTATE,
STATE_BEGINSTATE);
--- 260,268 ----
// STATE_BEGINSTATE
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_BEGINSTATE),
! new StoreDataTransition(StoreDataTransition.BEGINSTATE),
STATE_BEGINSTATE,
STATE_TRANSITION_DEF);
! state_machine_.registerDefaultTransition(new PrimitiveTransition(),
STATE_BEGINSTATE,
STATE_BEGINSTATE);
***************
*** 270,278 ****
// STATE_NEXTSTATE
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_NEXTSTATE),
! new PrimitiveTransition(),
STATE_NEXTSTATE,
STATE_TRANSITION_DEF);
! state_machine_.registerDefaultTransition(new StoreDataTransition(StoreDataTransition.NEXTSTATE),
STATE_NEXTSTATE,
STATE_NEXTSTATE);
--- 270,278 ----
// STATE_NEXTSTATE
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_NEXTSTATE),
! new StoreDataTransition(StoreDataTransition.NEXTSTATE),
STATE_NEXTSTATE,
STATE_TRANSITION_DEF);
! state_machine_.registerDefaultTransition(new PrimitiveTransition(),
STATE_NEXTSTATE,
STATE_NEXTSTATE);
***************
*** 280,288 ****
// STATE_ELEMENT
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_ELEMENT),
! new PrimitiveTransition(),
STATE_ELEMENT,
STATE_TRANSITION_DEF);
! state_machine_.registerDefaultTransition(new StoreDataTransition(StoreDataTransition.ELEMENT),
STATE_ELEMENT,
STATE_ELEMENT);
--- 280,288 ----
// STATE_ELEMENT
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_ELEMENT),
! new StoreDataTransition(StoreDataTransition.ELEMENT),
STATE_ELEMENT,
STATE_TRANSITION_DEF);
! state_machine_.registerDefaultTransition(new PrimitiveTransition(),
STATE_ELEMENT,
STATE_ELEMENT);
***************
*** 290,298 ****
// STATE_CLASSNAME
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_CLASSNAME),
! new PrimitiveTransition(),
STATE_CLASSNAME,
STATE_TRANSITION_DEF);
! state_machine_.registerDefaultTransition(new StoreDataTransition(StoreDataTransition.CLASSNAME),
STATE_CLASSNAME,
STATE_CLASSNAME);
--- 290,298 ----
// STATE_CLASSNAME
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_CLASSNAME),
! new StoreDataTransition(StoreDataTransition.CLASSNAME),
STATE_CLASSNAME,
STATE_TRANSITION_DEF);
! state_machine_.registerDefaultTransition(new PrimitiveTransition(),
STATE_CLASSNAME,
STATE_CLASSNAME);
Index: Parser.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Parser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Parser.java 28 Feb 2002 06:40:19 -0000 1.4
--- Parser.java 8 Mar 2002 19:04:38 -0000 1.5
***************
*** 98,102 ****
try
{
! System.out.println("Begin Parsing");
FileReader file_reader = new FileReader(input_file);
reader_.parse(new InputSource(file_reader));
--- 98,102 ----
try
{
! System.err.println("Begin Parsing");
FileReader file_reader = new FileReader(input_file);
reader_.parse(new InputSource(file_reader));
Index: XMLHandler.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** XMLHandler.java 28 Feb 2002 06:40:19 -0000 1.3
--- XMLHandler.java 8 Mar 2002 19:04:38 -0000 1.4
***************
*** 104,108 ****
try
{
! data_.topElementObject().setElementValue(new String(chars));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
--- 104,108 ----
try
{
! data_.topElementObject().setElementValue(new String(chars, start, length));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
|
|
From: G?nther B. <br...@us...> - 2002-03-08 19:04:41
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv1393/transitions
Modified Files:
RegisterTransitionTransition.java StoreDataTransition.java
Log Message:
schema for test0 added; bug removed; generating output modified
Index: RegisterTransitionTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/RegisterTransitionTransition.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RegisterTransitionTransition.java 28 Feb 2002 06:38:36 -0000 1.5
--- RegisterTransitionTransition.java 8 Mar 2002 19:04:38 -0000 1.6
***************
*** 66,69 ****
--- 66,70 ----
String classname = (String)data.removeObject("classname");
String element = (String)data.removeObject("element");
+ String type = (String)data.removeObject("type");
PrimitiveStateMachine doc_state_machine_ =
***************
*** 77,81 ****
// if there exists no elementtag then its a default-transition
! if ( element == null )
{
doc_state_machine_.registerDefaultTransition(transition,
--- 78,82 ----
// if there exists no elementtag then its a default-transition
! if ( type == null )
{
doc_state_machine_.registerDefaultTransition(transition,
***************
*** 86,96 ****
{
XMLInput xml_input;
-
- // storage of whole attributes-object doesn't work yet
- // Attributes attributes =
- // (Attributes)((DataObject)data).takeObject("elementattributes");
- // String type = attributes.getValue("type");
-
- String type = (String)data.removeObject("type");
// System.out.println("fetching Attributes: " + attributes);
--- 87,90 ----
Index: StoreDataTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StoreDataTransition.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StoreDataTransition.java 28 Feb 2002 06:38:36 -0000 1.4
--- StoreDataTransition.java 8 Mar 2002 19:04:38 -0000 1.5
***************
*** 28,33 ****
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
- import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
--- 28,33 ----
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.DataObject;
+ import edu.iicm.xpg.statemachine.ElementObject;
//----------------------------------------------------------------------
***************
*** 67,90 ****
throws Exception
{
! if (from_state != to_state)
! {
! System.out.println("StoreDataTransition: differentStates!");
! return(null);
! }
switch (data_type_)
{
case BEGINSTATE:
! data.putObject("beginstate", ((XMLInput)input).getValue());
break;
case NEXTSTATE:
! data.putObject("nextstate", ((XMLInput)input).getValue());
break;
case ELEMENT:
! data.putObject("element", ((XMLInput)input).getValue());
! data.putObject("type", data.topElementObject().getAttributes().getValue("type"));
break;
case CLASSNAME:
! data.putObject("classname", ((XMLInput)input).getValue());
break;
default: System.err.println("StoreDataTransition: illegal datatype!");
--- 67,87 ----
throws Exception
{
! ElementObject element_object = data.topElementObject();
! String element_value = element_object.getElementValue();
switch (data_type_)
{
case BEGINSTATE:
! data.putObject("beginstate", element_value);
break;
case NEXTSTATE:
! data.putObject("nextstate", element_value);
break;
case ELEMENT:
! data.putObject("element", element_value);
! data.putObject("type", element_object.getAttributes().getValue("type"));
break;
case CLASSNAME:
! data.putObject("classname", element_value);
break;
default: System.err.println("StoreDataTransition: illegal datatype!");
|
|
From: G?nther B. <br...@us...> - 2002-03-08 19:04:41
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple
In directory usw-pr-cvs1:/tmp/cvs-serv1393/transitions/simple
Modified Files:
WriteGeneralFooterTransition.java
Log Message:
schema for test0 added; bug removed; generating output modified
Index: WriteGeneralFooterTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple/WriteGeneralFooterTransition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** WriteGeneralFooterTransition.java 28 Feb 2002 06:37:30 -0000 1.2
--- WriteGeneralFooterTransition.java 8 Mar 2002 19:04:38 -0000 1.3
***************
*** 57,63 ****
{
StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
! html_form.append("\n<p><hr></p><input type=\"submit\" value=\"abschicken\">\n</form>" +
! "\n</body>\n</html>");
! // html_form.append("\n</body>\n</html>");
return(null);
}
--- 57,64 ----
{
StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
! // html_form.append("\n<p><hr></p><input type=\"submit\" " +
! // "value=\"abschicken\">\n</form>\n</body>\n</html>");
! html_form.append("\n</body>\n</html>");
! System.out.println(html_form.toString());
return(null);
}
|
|
From: G?nther B. <br...@us...> - 2002-03-08 19:04:41
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg In directory usw-pr-cvs1:/tmp/cvs-serv1393 Modified Files: statemachine_schema.xml test0.xml Added Files: Test0.xsd Log Message: schema for test0 added; bug removed; generating output modified --- NEW FILE: Test0.xsd --- <?xml version="1.0" standalone="no"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="document"> <xsd:complexType> <xsd:sequence> <xsd:choice> <xsd:element name="title" type="xsd:string" /> <xsd:element name="docinfo" type="DocInfo" /> </xsd:choice> <xsd:element name="content" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="DocInfo"> <xsd:sequence> <xsd:element name="title" type="xsd:string" /> <xsd:element name="author" type="xsd:string" minOccurs="0" /> </xsd:sequence> </xsd:complexType> </xsd:schema> Index: statemachine_schema.xml =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine_schema.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** statemachine_schema.xml 4 Mar 2002 09:49:31 -0000 1.1 --- statemachine_schema.xml 8 Mar 2002 19:04:37 -0000 1.2 *************** *** 2,7 **** <statemachine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="StateMachineConfig.xsd"> ! <path>edu.iicm.xpg.transitions.simple</path> ! <path>hallo.du</path> <states> <startstate>file top</startstate> --- 2,8 ---- <statemachine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="StateMachineConfig.xsd"> ! ! <path>edu.iicm.xpg.transitions.simple</path> ! <states> <startstate>file top</startstate> *************** *** 25,29 **** <beginstate>file top</beginstate> <nextstate>finished</nextstate> ! <element type="enddoc"> </element> <classname>StopMachineTransition</classname> </transition> --- 26,30 ---- <beginstate>file top</beginstate> <nextstate>finished</nextstate> ! <element type="enddoc" /> <classname>StopMachineTransition</classname> </transition> Index: test0.xml =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/test0.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test0.xml 24 Feb 2002 21:06:09 -0000 1.4 --- test0.xml 8 Mar 2002 19:04:37 -0000 1.5 *************** *** 1,6 **** <?xml version="1.0" standalone="no"?> - <!-- DOCTYPE document SYSTEM "test0.dtd" --> ! <document> <docinfo> --- 1,6 ---- <?xml version="1.0" standalone="no"?> ! <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ! xsi:noNamespaceSchemaLocation="Test0.xsd"> <docinfo> |
|
From: Stefan T. <th...@us...> - 2002-03-07 16:14:51
|
Update of /cvsroot/xpg-xml/org/dinopolis/util
In directory usw-pr-cvs1:/tmp/cvs-serv28270
Added Files:
DSearchPath.java
Log Message:
SearchPath for the DFactory
--- NEW FILE: DSearchPath.java ---
/***********************************************************************
* @(#)$RCSfile: DSearchPath.java,v $ $Revision: 1.1 $ $Date: 2002/03/07 16:14:48 $
*
* Copyright (c) 2002 stefan thalauer
*
* 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
***********************************************************************/
//----------------------------------------------------------------------
/**
* @author Stefan Thalauer
* @version $Revision: 1.1 $
*/
package org.dinopolis.util;
import java.lang.String;
//----------------------------------------------------------------------
/**
*/
public class DSearchPath
{
protected String[] path_;
//----------------------------------------------------------------------
/**
* The constructor
*/
public DSearchPath(String[] path)
{
setSearchPath(path);
}
//----------------------------------------------------------------------
/**
* This method sets the SearchPath
*
* @param path represents the SearchPath
* @return void
* @exception IllegalArgumentException thrown if path is null
* or has length 0
*/
public void setSearchPath(String[] path)
throws IllegalArgumentException
{
if (path == null)
throw(new IllegalArgumentException("SearchPath must not be <null>"));
if (path.length == 0)
throw(new IllegalArgumentException("the length of SearchPath must not be 0"));
path_ = path;
}
//----------------------------------------------------------------------
/**
* This method checks if a path is in the current SearchPath
*
* @param path
* @return returns true if the new path allready exists in the search
* path
* @exception IllegalStateException thrown if no path has been
* set before
*/
public boolean existPath(String path)
throws IllegalStateException
{
if (path_==null)
{
throw new IllegalStateException();
}
for(int count=0; count < path_.length ; count++)
{
if ( path_[count].equals(path) )
return true;
}
return false;
}
//----------------------------------------------------------------------
/**
* This method returns the position the path
*
* @param path
* @return returns the index if the new path allready exists in the search
* path, -1 if not
* @exception IllegalStateException thrown if no path has been
* set before
*/
public int getPathIndex(String path)
throws IllegalStateException
{
if (path_==null)
{
throw new IllegalStateException();
}
for(int count=0; count < path_.length ; count++)
{
if ( path_[count].equals(path) )
return count;
}
return -1;
}
//----------------------------------------------------------------------
/**
* This method appends a path to the current SearchPath.
*
* @param path
*/
public void appendPath(String path)
{
insertPath(path,path_.length);
}
//----------------------------------------------------------------------
/**
* This method inserts a path at the beginning of the current SearchPath.
*
* @param path
*/
public void insertPath(String path)
{
insertPath(path,0);
}
//----------------------------------------------------------------------
/**
* This method inserts the path at the position in the current SearchPath.
*
* @param path
* @param position
* @exception IllegalStateException thrown if no path has been
* set before
* @exception IllegalArgumentException
*/
public void insertPath(String path,int position)
throws IllegalStateException,IllegalArgumentException
{
if (path_==null)
throw new IllegalStateException();
if (path == null)
throw(new IllegalArgumentException("The Path must not be <null>"));
if ( position < 0 | position > path_.length)
throw(new IllegalArgumentException("The Position is out of the Path boundary"));
if (existPath(path))
System.err.println("Path: \"" + path +"\" allready registered in the Search Path ");
else
{
String[] new_path = new String [path_.length + 1];
for (int count = 0; count< position;count++)
{
new_path[count]=path_[count];
}
new_path[position]=path;
for (int count = position; count< path_.length;count++)
{
new_path[count+1]=path_[count];
}
path_ = new_path;
}
}
//----------------------------------------------------------------------
/**
* This method removes the path to the SearchPath.
*
* @param path
* @exception IllegalStateException thrown if no path has been
* set before
* @exception IllegalArgumentException
*/
public void removePath(String path)
throws IllegalStateException,IllegalStateException
{
if (path == null)
throw(new IllegalArgumentException("The Path must not be <null>"));
int position = getPathIndex(path);
if (position < 0)
System.err.println("Path: \"" + path +"\" is not registered in the Search Path ");
else
{
removePath(position);
}
}
//----------------------------------------------------------------------
/**
* This method removes the first path of the SearchPath.
*
* @exception IllegalStateException thrown if no path has been
* set before
* @exception IllegalArgumentException
*/
public void removeFirstPath()
{
removePath(0);
}
//----------------------------------------------------------------------
/**
* This method removes the last path of the SearchPath.
*
* @exception IllegalStateException thrown if no path has been
* set before
* @exception IllegalArgumentException
*/
public void removeLastPath()
{
removePath(path_.length-1);
}
//----------------------------------------------------------------------
/**
* This method removes the path on a specified position of the SearchPath.
*
* @param position
* @exception IllegalStateException thrown if no path has been
* set before
* @exception IllegalArgumentException
*/
public void removePath(int position)
throws IllegalStateException
{
if (path_==null)
throw new IllegalStateException();
if ( path_.length == 0)
System.err.println("There are no Path in the Search Path");
else
{
if ( position < 0 | position > path_.length)
throw(new IllegalArgumentException("The Position is out of the Path boundary"));
String[] new_path = new String [path_.length -1];
for (int count = 0; count< position;count++)
{
new_path[count]=path_[count];
}
for (int count = position; count< new_path.length;count++)
{
new_path[count]=path_[count+1];
}
path_ = new_path;
}
}
//----------------------------------------------------------------------
/**
* This method reverse the strings in the string array.
*
* @exception IllegalStateException thrown if no path has been
* set before
*/
public void reverseSearchPath()
throws IllegalStateException
{
if (path_==null)
{
throw new IllegalStateException();
}
String[] new_path = new String [path_.length];
for(int count = 0;count < path_.length;count++)
{
new_path[count]=path_[path_.length - 1 - count];
}
path_=new_path;
}
//----------------------------------------------------------------------
/**
*/
public String toString()
{
StringBuffer buffer = new StringBuffer("DSearchPath:>> ");
int length = path_.length;
for (int count = 0; count< length;count++)
{
buffer.append("[");
buffer.append(count);
buffer.append("] =\"");
buffer.append(path_[count]);
buffer.append("\",");
}
return new String(buffer);
}
// FIXXME (Stefan Thalauer, Mar 5 2002 19:12) -> this methodes are not well designed now
//----------------------------------------------------------------------
/**
* This method checks if a path is in the current Search path
*
* @param path
* @return returns true if the new path allready exists in the search
* path
* @exception IllegalStateException thrown if no path has been
* set before
*/
// public boolean existPath(String[] path)
// throws IllegalStateException,IllegalArgumentException
// {
// if (path_==null)
// {
// throw new IllegalStateException();
// }
// if (path==null)
// {
// throw new IllegalArgumentException();
// }
// for(int count=0; count < path.length ; count++)
// {
// if (!existPath(path[count]))
// return false;
// }
// return true;
// }
//----------------------------------------------------------------------
/**
* This method appends a string to the current path.
*
* @exception IllegalStateException thrown if no path has been
* set before
*/
// public void appendPath(String[] path)
// throws IllegalArgumentException
// {
// if (path == null)
// throw(new IllegalArgumentException("The Path must not be <null>"));
// if (existPath(path))
// System.err.println("Path: \"" + path +"\" allready registered in String Array ");
// else
// {
// String[] new_path = new String [path_.length + path.length];
// for (int count = 0; count< path_.length;count++)
// {
// new_path[count]=path_[count];
// }
// for (int count = 0; count< path.length;count++)
// {
// new_path[count+path_.length]=path[count];
// }
// path_ = new_path;
// }
// }
// END FIXXME (Stefan Thalauer, Mar 5 2002 19:13)
}
|
|
From: Stefan T. <th...@us...> - 2002-03-04 09:49:35
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg In directory usw-pr-cvs1:/tmp/cvs-serv29919 Added Files: statemachine_schema.xml Log Message: statemachine config file with the schema include --- NEW FILE: statemachine_schema.xml --- <?xml version="1.0" standalone="no"?> <statemachine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="StateMachineConfig.xsd"> <path>edu.iicm.xpg.transitions.simple</path> <path>hallo.du</path> <states> <startstate>file top</startstate> <state>doc top</state> <state>doc info def</state> <state>doc title def</state> <state>info title def</state> <state>doc author def</state> <state>doc content</state> <state>finished</state> </states> <transitions> <transition> <beginstate>file top</beginstate> <nextstate>doc top</nextstate> <element type="start">document</element> <classname>WriteGeneralHeaderTransition</classname> </transition> <transition> <beginstate>file top</beginstate> <nextstate>finished</nextstate> <element type="enddoc"> </element> <classname>StopMachineTransition</classname> </transition> <transition> <beginstate>file top</beginstate> <nextstate>file top</nextstate> <classname>IgnoreCharsTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>file top</nextstate> <element type="end">document</element> <classname>WriteGeneralFooterTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>doc title def</nextstate> <element type="start">title</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>doc info def</nextstate> <element type="start">docinfo</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>doc content</nextstate> <element type="start">content</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc top</beginstate> <nextstate>doc top</nextstate> <classname>IgnoreCharsTransition</classname> </transition> <transition> <beginstate>doc info def</beginstate> <nextstate>doc top</nextstate> <element type="end">docinfo</element> <classname>WriteHeaderTransition</classname> </transition> <transition> <beginstate>doc info def</beginstate> <nextstate>info title def</nextstate> <element type="start">title</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc info def</beginstate> <nextstate>doc author def</nextstate> <element type="start">author</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc info def</beginstate> <nextstate>doc info def</nextstate> <classname>IgnoreCharsTransition</classname> </transition> <transition> <beginstate>doc title def</beginstate> <nextstate>doc top</nextstate> <element type="end">title</element> <classname>WriteHeaderTransition</classname> </transition> <transition> <beginstate>doc title def</beginstate> <nextstate>doc title def</nextstate> <classname>StoreDocTitleTransition</classname> </transition> <transition> <beginstate>info title def</beginstate> <nextstate>doc info def</nextstate> <element type="end">title</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>info title def</beginstate> <nextstate>info title def</nextstate> <classname>StoreDocTitleTransition</classname> </transition> <transition> <beginstate>doc author def</beginstate> <nextstate>doc info def</nextstate> <element type="end">author</element> <classname>PrimitiveTransition</classname> </transition> <transition> <beginstate>doc author def</beginstate> <nextstate>doc author def</nextstate> <classname>StoreDocAuthorTransition</classname> </transition> <transition> <beginstate>doc content</beginstate> <nextstate>doc top</nextstate> <element type="end">content</element> <classname>WriteDocContentTransition</classname> </transition> <transition> <beginstate>doc content</beginstate> <nextstate>doc content</nextstate> <classname>StoreDocContentTransition</classname> </transition> </transitions> </statemachine > |
|
From: Stefan T. <th...@us...> - 2002-03-04 09:47:36
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg In directory usw-pr-cvs1:/tmp/cvs-serv28883 Added Files: StateMachineConfig.xsd Log Message: new Schema for the Statemachine config file --- NEW FILE: StateMachineConfig.xsd --- <?xml version="1.0" standalone="no"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:annotation> <xsd:documentation xml:lang="en"> StateMachineConfig.xsd Version 0.1.0 Schema describing the representation of the ConfigStatemachine This schema was validated with the tool http://www.w3.org/2001/03/webdata/xsv (04.3.2002) </xsd:documentation> </xsd:annotation> <!-- attention: all names must be adapted to the following nameing convention type names : AllWordsCapitalizedWithoutUnderscores element names : alllowercasewithoutunderscores --> <xsd:element name="statemachine"> <xsd:complexType> <xsd:sequence> <xsd:element name="path" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/> <xsd:element name="states" type="States" minOccurs="1" maxOccurs="1"/> <xsd:element name="transitions" type="Transitions" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="States"> <xsd:sequence> <xsd:element name="startstate" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="state" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Transitions"> <xsd:sequence> <xsd:element name="transition" type="Transition" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Transition"> <xsd:sequence> <xsd:element name="beginstate" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="nextstate" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="element" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="type" type="ElementAttributes" use="required"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> <xsd:element name="classname" type="xsd:string" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> <xsd:simpleType name="ElementAttributes"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="start"/> <xsd:enumeration value="end"/> <xsd:enumeration value="enddoc"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> |
|
From: G?nther B. <br...@us...> - 2002-02-28 06:42:16
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator In directory usw-pr-cvs1:/tmp/cvs-serv32439 Added Files: DocumentGenerator.java Generator.java Log Message: new DocumentGenerator and Generator re-added |
|
From: G?nther B. <br...@us...> - 2002-02-28 06:40:22
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv32148
Modified Files:
Const.java DataObject.java InitInitializeStateMachine.java
InitParser.java Initializer.java Parser.java XMLHandler.java
Added Files:
ElementObject.java
Log Message:
ElementObject added; DataObject modified
--- NEW FILE: ElementObject.java ---
/***********************************************************************
*
* 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 org.xml.sax.Attributes;
import java.util.HashMap;
import java.util.Stack;
import java.util.EmptyStackException;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $revision$
*/
public class ElementObject
{
protected String element_name_;
protected String element_value_;
protected Attributes attributes_;
//----------------------------------------------------------------------
/**
* @param element the elementname that should be set
*/
protected void setElementName(String elementname)
{
element_name_ = elementname;
}
//----------------------------------------------------------------------
/**
* @return the element name
*/
public String getElementName()
{
return element_name_;
}
//----------------------------------------------------------------------
/**
* @param element the elementvalue that should be set
*/
protected void setElementValue(String elementvalue)
{
element_value_ = elementvalue;
}
//----------------------------------------------------------------------
/**
* @return the element value
*/
public String getElementValue()
{
return element_value_;
}
//----------------------------------------------------------------------
/**
* @param attributes the attributes that should be set
*/
protected void setAttributes(Attributes attributes)
{
attributes_ = attributes;
}
//----------------------------------------------------------------------
/**
* @return the attributes
*/
public Attributes getAttributes()
{
return attributes_;
}
}
Index: Const.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Const.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Const.java 29 Jan 2002 10:43:13 -0000 1.1.1.1
--- Const.java 28 Feb 2002 06:40:19 -0000 1.2
***************
*** 1,42 ****
! /***********************************************************************
! * @(#)$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;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Günther Brand
! * @version $revision$
! */
!
! public class Const
! {
! // XML Input Types
! public final static String XML_END_DOCUMENT = "enddoc";
! public final static String XML_CHARS = "chars";
! public final static String XML_START_TAG = "start";
! public final static String XML_END_TAG = "end";
! }
!
!
--- 1,44 ----
! /***********************************************************************
! * @(#)$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;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Günther Brand
! * @version $revision$
! */
!
! public class Const
! {
! // XML Input Types
! public final static String XML_END_DOCUMENT = "enddoc";
! public final static String XML_CHARS = "chars";
! public final static String XML_START_TAG = "start";
! public final static String XML_END_TAG = "end";
!
! public final static String RESULT_BUFFER = "result-buffer";
! }
!
!
Index: DataObject.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/DataObject.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DataObject.java 22 Feb 2002 12:48:54 -0000 1.3
--- DataObject.java 28 Feb 2002 06:40:19 -0000 1.4
***************
*** 23,27 ****
package edu.iicm.xpg.statemachine;
- import org.xml.sax.Attributes;
import java.util.HashMap;
import java.util.Stack;
--- 23,26 ----
***************
*** 38,45 ****
public class DataObject
{
! private String element_value_;
! private Stack attribute_stack_;
!
! private StringBuffer result_;
private HashMap data_map_;
--- 37,41 ----
public class DataObject
{
! private Stack element_stack_;
private HashMap data_map_;
***************
*** 47,93 ****
public DataObject()
{
! element_value_= null;
! attribute_stack_ = new Stack();
! result_ = new StringBuffer();
data_map_= new HashMap();
}
-
- //----------------------------------------------------------------------
- /**
- * @param element the element that should be pushed on the stack
- */
- protected void setElementValue(String elementvalue)
- {
- element_value_ = elementvalue;
- }
-
//----------------------------------------------------------------------
/**
! * @return the top element and removes it
! */
! public String getElementValue()
! {
! return element_value_;
! }
!
! //----------------------------------------------------------------------
! /**
! * @param attributes the attributes that should be pushed on the stack
*/
! protected void pushAttributes(Attributes attributes)
{
! attribute_stack_.push(attributes);
}
//----------------------------------------------------------------------
/**
! * @return the top attributes
*/
! public Attributes topAttributes()
{
try
{
! return (Attributes)attribute_stack_.peek();
}
catch (EmptyStackException exc)
--- 43,68 ----
public DataObject()
{
! element_stack_ = new Stack();
data_map_= new HashMap();
}
//----------------------------------------------------------------------
/**
! * @param element_object the elementobject that should be pushed on the stack
*/
! protected void pushElementObject(ElementObject element_object)
{
! element_stack_.push(element_object);
}
//----------------------------------------------------------------------
/**
! * @return the top element object
*/
! public ElementObject topElementObject()
{
try
{
! return (ElementObject)element_stack_.peek();
}
catch (EmptyStackException exc)
***************
*** 101,111 ****
//----------------------------------------------------------------------
/**
! * @return the top attributes and removes it
*/
! protected Attributes popAttributes()
{
try
{
! return (Attributes)attribute_stack_.pop();
}
catch (EmptyStackException exc)
--- 76,86 ----
//----------------------------------------------------------------------
/**
! * @return the top element object and removes it
*/
! protected ElementObject popElementObject()
{
try
{
! return (ElementObject)element_stack_.pop();
}
catch (EmptyStackException exc)
***************
*** 147,160 ****
* @return the dataobject
*/
! public Object takeObject(String key)
{
return data_map_.remove(key);
}
-
- public StringBuffer getResult()
- {
- return result_;
- }
-
}
--- 122,129 ----
* @return the dataobject
*/
! public Object removeObject(String key)
{
return data_map_.remove(key);
}
}
Index: InitInitializeStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitInitializeStateMachine.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** InitInitializeStateMachine.java 22 Feb 2002 13:14:34 -0000 1.2
--- InitInitializeStateMachine.java 28 Feb 2002 06:40:19 -0000 1.3
***************
*** 31,40 ****
import edu.iicm.xpg.transitions.SetSearchPathTransition;
-
-
//----------------------------------------------------------------------
/**
* This class implements the Initializer Interface.
! * It register the States and Transitions for the
* Statemachine which is used to initialize the
* Document Statemachine.
--- 31,38 ----
import edu.iicm.xpg.transitions.SetSearchPathTransition;
//----------------------------------------------------------------------
/**
* This class implements the Initializer Interface.
! * It registers the States and Transitions for the
* Statemachine which is used to initialize the
* Document Statemachine.
***************
*** 45,48 ****
--- 43,47 ----
*
* @author Stefan Thalauer
+ * @author Günther Brand
* @version $Revision$
*/
***************
*** 105,109 ****
{
state_machine_ = state_machine;
- // state_machine_.setUserDefinedDataObject(data_);
state_machine_.registerState(new PrimitiveState(),STATE_TOP_LEVEL_FILE);
--- 104,107 ----
Index: InitParser.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitParser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** InitParser.java 22 Feb 2002 13:14:34 -0000 1.2
--- InitParser.java 28 Feb 2002 06:40:19 -0000 1.3
***************
*** 51,61 ****
{
super();
DFactory transition_factory = new DFactory(DEFAULT_SEARCH_PATH);
data_.putObject(TRANSITION_FATORY, transition_factory);
config_file_= config_file;
initializer_ = new InitInitializeStateMachine();
- state_machine_ = new PrimitiveStateMachine();
-
- handler_ = new XMLHandler(state_machine_,data_);
}
--- 51,59 ----
{
super();
+
DFactory transition_factory = new DFactory(DEFAULT_SEARCH_PATH);
data_.putObject(TRANSITION_FATORY, transition_factory);
config_file_= config_file;
initializer_ = new InitInitializeStateMachine();
}
***************
*** 73,79 ****
initializer_.initialize(state_machine_);
- state_machine_=initializer_.getStateMachine();
data_.putObject(STATE_MACHINE,new_state_machine);
- state_machine_.setUserDefinedDataObject(data_);
parseFile(config_file_);
--- 71,75 ----
Index: Initializer.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Initializer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Initializer.java 22 Feb 2002 13:14:34 -0000 1.3
--- Initializer.java 28 Feb 2002 06:40:19 -0000 1.4
***************
*** 46,50 ****
* @return the initialized Statemachine
*/
! public PrimitiveStateMachine getStateMachine();
}
--- 46,51 ----
* @return the initialized Statemachine
*/
!
! public PrimitiveStateMachine getStateMachine();
}
Index: Parser.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Parser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Parser.java 22 Feb 2002 13:14:34 -0000 1.3
--- Parser.java 28 Feb 2002 06:40:19 -0000 1.4
***************
*** 20,36 ****
***********************************************************************/
-
package edu.iicm.xpg.statemachine;
-
import java.io.FileReader;
import java.io.File;
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
- import org.xml.sax.helpers.XMLReaderFactory;
import org.xml.sax.SAXException;
!
! import org.dinopolis.util.DFactory;
!
//----------------------------------------------------------------------
--- 20,31 ----
***********************************************************************/
package edu.iicm.xpg.statemachine;
import java.io.FileReader;
import java.io.File;
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
! import org.xml.sax.helpers.XMLReaderFactory;
//----------------------------------------------------------------------
***************
*** 49,54 ****
protected final static String XML_READER = "org.apache.xerces.parsers.SAXParser";
protected final static String PARSER_FEATURE_SCHEMA = "http://xml.org/sax/features/validation";
! protected final static String PARSER_FEATURE_VALIDATING = "http://apache.org/xml/features/validation/schema";
! protected final static String PARSER_FEATURE_VALIDATING_DYNAMIC ="http://apache.org/xml/features/validation/dynamic";
protected final static String STATE_MACHINE="doc_state_machine";
--- 44,49 ----
protected final static String XML_READER = "org.apache.xerces.parsers.SAXParser";
protected final static String PARSER_FEATURE_SCHEMA = "http://xml.org/sax/features/validation";
! protected final static String PARSER_FEATURE_VALIDATING = "http://apache.org/xml/features/validation/schema";
! protected final static String PARSER_FEATURE_VALIDATING_DYNAMIC ="http://apache.org/xml/features/validation/dynamic";
protected final static String STATE_MACHINE="doc_state_machine";
***************
*** 62,65 ****
--- 57,63 ----
{
data_ = new DataObject();
+ state_machine_ = new PrimitiveStateMachine();
+ state_machine_.setUserDefinedDataObject(data_);
+ handler_ = new XMLHandler(state_machine_,data_);
try
{
***************
*** 74,89 ****
//----------------------------------------------------------------------
/**
! * @param state_machine
*/
! public Parser(PrimitiveStateMachine state_machine)
! {
! this();
! state_machine_=state_machine;
! state_machine_.setUserDefinedDataObject(data_);
! handler_ = new XMLHandler(state_machine_,data_);
}
-
//----------------------------------------------------------------------
/**
--- 72,84 ----
//----------------------------------------------------------------------
/**
! * @deprecated
*/
! public Parser(PrimitiveStateMachine state_machine)
! {
! this();
! state_machine_ = state_machine;
}
//----------------------------------------------------------------------
/**
***************
*** 103,106 ****
--- 98,102 ----
try
{
+ System.out.println("Begin Parsing");
FileReader file_reader = new FileReader(input_file);
reader_.parse(new InputSource(file_reader));
***************
*** 113,139 ****
}
}
-
-
- //----------------------------------------------------------------------
- /**
- * @return the object that has been generated
- */
-
- public synchronized Object getResult()
- {
- return(data_.getResult().toString());
- }
-
- //----------------------------------------------------------------------
- /**
- * This was just a test function
- * @return the object that has been generated
- */
-
- // public synchronized PrimitiveStateMachine getStateMachine()
- // {
- // return (PrimitiveStateMachine) data_.getObject(STATE_MACHINE);
- // }
-
//----------------------------------------------------------------------
--- 109,112 ----
Index: XMLHandler.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** XMLHandler.java 22 Feb 2002 12:48:54 -0000 1.2
--- XMLHandler.java 28 Feb 2002 06:40:19 -0000 1.3
***************
*** 51,56 ****
//----------------------------------------------------------------------
/**
! * @param configfile the filename of the configfile
! * @param filename the filename of the inputfile
*/
--- 51,56 ----
//----------------------------------------------------------------------
/**
! * @param state_machine the statemachine which handles the parsed states
! * @param data the DataObject for storing diverse data
*/
***************
*** 104,108 ****
try
{
! data_.setElementValue(new String(chars));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
--- 104,108 ----
try
{
! data_.topElementObject().setElementValue(new String(chars));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
***************
*** 128,132 ****
try
{
! data_.pushAttributes(attributes);
state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
}
--- 128,136 ----
try
{
! ElementObject element_object = new ElementObject();
! element_object.setElementName(name);
! element_object.setAttributes(attributes);
! data_.pushElementObject(element_object);
!
state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
}
***************
*** 151,156 ****
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! data_.setElementValue(null);
! data_.popAttributes();
}
catch(Exception exc)
--- 155,159 ----
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! data_.popElementObject();
}
catch(Exception exc)
|
|
From: G?nther B. <br...@us...> - 2002-02-28 06:38:41
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv31932
Modified Files:
RegisterTransitionTransition.java StoreDataTransition.java
Log Message:
DataObject modified
Index: RegisterTransitionTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/RegisterTransitionTransition.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RegisterTransitionTransition.java 7 Feb 2002 09:51:58 -0000 1.4
--- RegisterTransitionTransition.java 28 Feb 2002 06:38:36 -0000 1.5
***************
*** 62,69 ****
throws Exception
{
! String beginstate = (String)data.takeObject("beginstate");
! String nextstate = (String)data.takeObject("nextstate");
! String classname = (String)data.takeObject("classname");
! String element = (String)data.takeObject("element");
PrimitiveStateMachine doc_state_machine_ =
--- 62,69 ----
throws Exception
{
! String beginstate = (String)data.removeObject("beginstate");
! String nextstate = (String)data.removeObject("nextstate");
! String classname = (String)data.removeObject("classname");
! String element = (String)data.removeObject("element");
PrimitiveStateMachine doc_state_machine_ =
***************
*** 92,96 ****
// String type = attributes.getValue("type");
! String type = (String)((DataObject)data).takeObject("type");
// System.out.println("fetching Attributes: " + attributes);
--- 92,96 ----
// String type = attributes.getValue("type");
! String type = (String)data.removeObject("type");
// System.out.println("fetching Attributes: " + attributes);
Index: StoreDataTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StoreDataTransition.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** StoreDataTransition.java 7 Feb 2002 09:51:58 -0000 1.3
--- StoreDataTransition.java 28 Feb 2002 06:38:36 -0000 1.4
***************
*** 83,87 ****
case ELEMENT:
data.putObject("element", ((XMLInput)input).getValue());
! data.putObject("type", data.topAttributes().getValue("type"));
break;
case CLASSNAME:
--- 83,87 ----
case ELEMENT:
data.putObject("element", ((XMLInput)input).getValue());
! data.putObject("type", data.topElementObject().getAttributes().getValue("type"));
break;
case CLASSNAME:
|