PrintGame
Class WriteLabToXML

java.lang.Object
  extended byPrintGame.WriteLabToXML

public class WriteLabToXML
extends java.lang.Object

class provides methods for generating a labyrinth XML file for the tag names and the labyrinth symbols the classes TagName and LabSymbols are used


Constructor Summary
WriteLabToXML(LabyrinthField lab_field, Robot robot)
           
 
Method Summary
protected  java.lang.String toEndTagString(java.lang.String tag_name)
          method transforms a string to an other one which can be used as a end tag
protected  java.lang.String toStartTagString(java.lang.String tag_name)
          method transforms a string to an other one which can be used as a start tag
protected  void writeDimension(java.io.OutputStreamWriter out)
          method writes the dimension-element and all elements it contains to the specified stream
protected  void writeHeight(java.io.OutputStreamWriter out)
          method writes the height-element to the specified stream
protected  void writeLabyrinth(java.io.OutputStreamWriter out)
          method writes the labyrinth-element with the ASCII representation of the labyrinth field to the specified stream
 void writeRobotLabyrinth(java.io.OutputStreamWriter out)
          method writes the robotlabyrinth-element and all elements it contains to the specified stream
protected  void writeStartDirection(java.io.OutputStreamWriter out)
          method writes the startdirection-element to the specified stream
protected  void writeSymbol(java.io.OutputStreamWriter out, java.lang.String tag_name, java.lang.String symbol)
          method writes a symbol-element to the specified stream
protected  void writeWidth(java.io.OutputStreamWriter out)
          method writes the widht-element to the specified stream
 void writeXMLFile(java.lang.String file_name)
          method creates a XML file with the given filename and writes the header and the whole labyrinth data in this file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteLabToXML

public WriteLabToXML(LabyrinthField lab_field,
                     Robot robot)
Method Detail

toStartTagString

protected java.lang.String toStartTagString(java.lang.String tag_name)
method transforms a string to an other one which can be used as a start tag

Parameters:
tag_name - name of the tag
Returns:
transformed string

toEndTagString

protected java.lang.String toEndTagString(java.lang.String tag_name)
method transforms a string to an other one which can be used as a end tag

Parameters:
tag_name - name of the tag
Returns:
transformed string

writeWidth

protected void writeWidth(java.io.OutputStreamWriter out)
                   throws java.io.IOException
method writes the widht-element to the specified stream

Parameters:
out - stream to use for writing
Throws:
java.io.IOException - if out.write throws an Exception

writeHeight

protected void writeHeight(java.io.OutputStreamWriter out)
                    throws java.io.IOException
method writes the height-element to the specified stream

Parameters:
out - stream to use for writing
Throws:
java.io.IOException - if out.write throws an Exception

writeDimension

protected void writeDimension(java.io.OutputStreamWriter out)
                       throws java.io.IOException
method writes the dimension-element and all elements it contains to the specified stream

Parameters:
out - stream to use for writing
Throws:
java.io.IOException - if out.write throws an Exception

writeSymbol

protected void writeSymbol(java.io.OutputStreamWriter out,
                           java.lang.String tag_name,
                           java.lang.String symbol)
                    throws java.io.IOException
method writes a symbol-element to the specified stream

Parameters:
out - stream to use for writing
tag_name - name of the symbol-element
symbol - symbol to write
Throws:
java.io.IOException - if out.write throws an Exception

writeStartDirection

protected void writeStartDirection(java.io.OutputStreamWriter out)
                            throws java.io.IOException
method writes the startdirection-element to the specified stream

Parameters:
out - stream to use for writing
Throws:
java.io.IOException - if out.write throws an Exception

writeLabyrinth

protected void writeLabyrinth(java.io.OutputStreamWriter out)
                       throws java.io.IOException
method writes the labyrinth-element with the ASCII representation of the labyrinth field to the specified stream

Parameters:
out - stream to use for writing
Throws:
java.io.IOException - if out.write throws an Exception

writeRobotLabyrinth

public void writeRobotLabyrinth(java.io.OutputStreamWriter out)
                         throws java.io.IOException
method writes the robotlabyrinth-element and all elements it contains to the specified stream

Parameters:
out - stream to use for writing
Throws:
java.io.IOException - if out.write throws an Exception

writeXMLFile

public void writeXMLFile(java.lang.String file_name)
method creates a XML file with the given filename and writes the header and the whole labyrinth data in this file

Parameters:
file_name - name of the XML file