cox.jmatt.java.MathTools.test
Interface MTestElement

All Known Implementing Classes:
MTFI, Question

public interface MTestElement

This interface describes anything that might be included on a math test. Questions are MTestElements, obviously, but most tests also contain such things as titles, class name/number, section number, etc. This interface makes provision for all of that, or for anything else that a test might need. Four formatting methods are specified plus XML: three for the MTestElement's internal format and one that accepts a String parameter. The 'internal format' methods make no assumptions about the internal formulas, merely that they exist.


Method Summary
 MTestElement copyOf()
          This method is used in adding elements to a MTest.
 java.lang.String format()
          Format MTestElement content.
 java.lang.String format(java.lang.String pFormat)
          Format MTestElement content according to the format specified.
 java.lang.String formatAnswer()
          Format the Answer content according to the internal Answer format.
 java.lang.String formatProblem()
          Format MTestElement Problems according to their internal Problem format.
 java.lang.String toXML()
          Output the MTestElement as XML of some description.
 

Method Detail

format

java.lang.String format()
Format MTestElement content. This method makes no requirement other than that it exists. It assumes that the nature of the format will be specified internally by the MTestElement being formatted.


format

java.lang.String format(java.lang.String pFormat)
Format MTestElement content according to the format specified. The format String is exactly per the Question.format(String) formatting string with identical replacement tokens. This method is used by MTest to separate the Problem and Answer parts when they are printed separately with custom formats.


formatProblem

java.lang.String formatProblem()
Format MTestElement Problems according to their internal Problem format.


formatAnswer

java.lang.String formatAnswer()
Format the Answer content according to the internal Answer format.


toXML

java.lang.String toXML()
Output the MTestElement as XML of some description. Again, this method assumes that the MTestElement is able to obey this constraint. Each MTestElement is responsible for assuring the XML used is well-formed and that any dangerous characters are replaced by their XML escape codes.


copyOf

MTestElement copyOf()
This method is used in adding elements to a MTest. This is done so that changes to the original object do not affect elements already added.