net.sf.magicproject.xml
Class XmlTest

java.lang.Object
  extended by net.sf.magicproject.xml.XmlTest
All Implemented Interfaces:
XmlToMDB

public final class XmlTest
extends java.lang.Object
implements XmlToMDB

Generic implementation of the XmlToMDB interface for managing XML elements relative to tests. Mainly used to get the suitable XmlToMDB implementation corresponding to a given action name (corresponding to the XML element name) through the getTest() method.

Since:
0.80
Author:
Fabrice Daugan

Method Summary
 int buildMdb(XmlParser.Node node, java.io.OutputStream out)
           
static void buildMdbBinary(XmlParser.Node node, java.io.OutputStream out, IdTest idTests)
          Write the contained binary test of the specified node to the given output stream.
static void buildMdbCard(XmlParser.Node node, java.io.OutputStream out, IdTest idTests)
          Write the contained test relative to a card of the specified node to the given outputstream.
static void buildMdbObject(XmlParser.Node node, java.io.OutputStream out, IdTest idTests)
          Write the contained test relative to a card of the specified node to the given output stream.
static void buildMdbPlayer(XmlParser.Node node, java.io.OutputStream out, IdTest idTestPlayer)
          Write the contained test relative to a card associated to a player of the specified node to the given output stream.
static void buildMdbPlayerplayer(XmlParser.Node node, java.io.OutputStream out, IdTest idTestPlayer)
          Write the contained test relative to a card associated to a player of the specified node to the given output stream.
static void buildMdbTargetable(XmlParser.Node node, java.io.OutputStream out, IdTest idTests)
          Writes the contained test relative to a targetable of the given node to the given output stream.
static XmlToMDB getTest(java.lang.String testName)
          Returns a suitable XmlToMDB implementation for the given action name (corresponding to the XML element name).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buildMdbBinary

public static void buildMdbBinary(XmlParser.Node node,
                                  java.io.OutputStream out,
                                  IdTest idTests)
                           throws java.io.IOException
Write the contained binary test of the specified node to the given output stream.

Parameters:
node - the XML test container structure
out - outputstream where the card structure will be saved
idTests - test id
Throws:
java.io.IOException - if an I/O error occurs if an illegal argument is given if a security error occurs if an illegal access error occurs if an invocation target error occurs

buildMdb

public int buildMdb(XmlParser.Node node,
                    java.io.OutputStream out)
Specified by:
buildMdb in interface XmlToMDB
Parameters:
node - the XML structure of element to write.
out - outputstream where the card structure will be saved
Returns:
the amount of written action in the output.

buildMdbPlayer

public static void buildMdbPlayer(XmlParser.Node node,
                                  java.io.OutputStream out,
                                  IdTest idTestPlayer)
                           throws java.io.IOException
Write the contained test relative to a card associated to a player of the specified node to the given output stream. The player information can be coded as an attribute or as a nested XML element.

Parameters:
node - the XML test container structure
out - outputstream where the test container structure will be saved
idTestPlayer - test id relative to a player
Throws:
java.io.IOException - if an I/O error occurs

buildMdbPlayerplayer

public static void buildMdbPlayerplayer(XmlParser.Node node,
                                        java.io.OutputStream out,
                                        IdTest idTestPlayer)
                                 throws java.io.IOException
Write the contained test relative to a card associated to a player of the specified node to the given output stream. The player information can be coded as an attribute.

Parameters:
node - the XML test container structure
out - outputstream where the test container structure will be saved
idTestPlayer - test id relative to a player
Throws:
java.io.IOException - if an I/O error occurs if an illegal argument is given if a security error occurs

buildMdbObject

public static void buildMdbObject(XmlParser.Node node,
                                  java.io.OutputStream out,
                                  IdTest idTests)
                           throws java.io.IOException
Write the contained test relative to a card of the specified node to the given output stream.

Parameters:
node - the XML test container structure
out - outputstream where the card structure will be saved
idTests - test id
Throws:
java.io.IOException - if an I/O error occurs if an illegal argument is given if a security error occurs

buildMdbCard

public static void buildMdbCard(XmlParser.Node node,
                                java.io.OutputStream out,
                                IdTest idTests)
                         throws java.io.IOException
Write the contained test relative to a card of the specified node to the given outputstream.

Parameters:
node - the XML test container structure
out - outputstream where the card structure will be saved
idTests - test id relative to a card
Throws:
java.io.IOException - if an I/O error occurs if an illegal argument is given if a security error occurs

getTest

public static XmlToMDB getTest(java.lang.String testName)
Returns a suitable XmlToMDB implementation for the given action name (corresponding to the XML element name). The corresponding class is fetched in the net.sf.magicproject.xml.test package.

Parameters:
testName - the name of the test corresponding to the found XML element name.
Returns:
a suitable XmlToMDB implementation for the given action name

buildMdbTargetable

public static void buildMdbTargetable(XmlParser.Node node,
                                      java.io.OutputStream out,
                                      IdTest idTests)
                               throws java.io.IOException
Writes the contained test relative to a targetable of the given node to the given output stream.

Parameters:
node - the XML test container structure
out - outputstream where the test structure will be saved
idTests - the type of target, can be either IdTests.IS_PLAYER, IdTests.IS_SPELL or IdTests.IS_ABILITY
Throws:
java.io.IOException


Copyright © 2003-2007 Magic-Project. All Rights Reserved.