|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<MEquation.Equation>
cox.jmatt.java.MathTools.MEquation.Equation
public static enum MEquation.Equation
This enum specifies the standard types of equations contained within the MEquations class. Each equation is documented in 'standard form' but contains additional formats for MathML, OpenOffice and LaTeX. This format can be accessed via the 'getFormat()' method using one of the specified keys.
The calculations are listed for each Equation. Elements starting with 'K' represent Knobs: 'K0' is Knob[0], 'K1' is Knob[1] etc.
The actual formats for each equation are standard Question.fillTemplate()
Strings. The first element in the replacement token array ('[0]')
holds the variable and the rest hold the placeholders in order: [1] is A, [2] is B etc. The relation stored in each format is equals ('=') and it is the
only occurrence of this character in the raw templates.
Enum Constant Summary | |
---|---|
TYPE_100
Equation type: X + A = B, 2 Knobs. |
|
TYPE_150
Equation type: X - A = B, 2 Knobs. |
|
TYPE_200
Equation type: Ax = B, 2 Knobs. |
|
TYPE_300
Equation type: X/A = B, 2 Knobs. |
|
TYPE_325
Equation type: X/A + B = C, 3 Knobs. |
|
TYPE_350
Equation type: X/A - B = C, 3 Knobs. |
|
TYPE_400
Equation type: Ax + B = C, 3 Knobs. |
|
TYPE_450
Equation type: Ax - B = C, 3 Knobs. |
|
TYPE_500
Equation type: A(x + B) = C, 3 Knobs. |
|
TYPE_515
Equation type: A(x + B) + C = D, 4 Knobs. |
|
TYPE_530
Equation type: A(x + B) - C = D, 4 Knobs. |
|
TYPE_550
Equation type: A(x - B) = C, 3 Knobs. |
|
TYPE_565
Equation type: A(x - B) + C = D, 4 Knobs. |
|
TYPE_580
Equation type: A(x - B) - C = D, 4 Knobs. |
|
TYPE_600
Equation type: (Ax + B)/C = D, 3 Knobs. |
|
TYPE_650
Equation type: (Ax - B)/C = D, 3 Knobs. |
|
TYPE_700
Equation type: (Ax + B)/C + D = E, 4 Knobs. |
|
TYPE_725
Equation type: (Ax + B)/C - D = E, 4 Knobs. |
|
TYPE_750
Equation type: (Ax - B)/C + D = E, 4 Knobs. |
|
TYPE_775
Equation type: (Ax - B)/C - D = E, 4 Knobs. |
|
TYPE_ERROR
TYPE_ constant used as an error marker, '-1' Knobs. |
Field Summary | |
---|---|
static int |
LATEX
Constant used for RAW LaTeX format. |
static int |
MATHML
Constant used for MathML format. |
static int |
OPEN_OFFICE
Constant used for OpenOffice format. |
static int |
STANDARD
Constant used for Standard format. |
Method Summary | |
---|---|
abstract boolean |
bird()
Blind Inequality Reverse Detection. |
java.lang.String |
getFormat(int pKey,
java.lang.String pRelation)
This method is used generically to fetch any intrinsic format. |
int |
numKnobs()
Query a particular TYPE_ as to the number of Knobs it requires. |
abstract java.lang.String |
preformat(int[] pVals)
Preformat the data from the equation type. |
java.lang.String |
preformat(java.lang.String pKnobs)
Preformat the data from the equation type. |
abstract java.lang.String |
solveFor(int... pPlaceHolders)
This method allows an Equation enum member to be used to create an equation or inequality that does NOT solve nicely. |
java.lang.String[] |
tokens(int[] pVals)
This method returns the preformat data as a String array. |
java.lang.String[] |
tokens(java.lang.String pKnobs)
Preformat to tokens but with Knobs for data. |
static MEquation.Equation |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static MEquation.Equation[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final MEquation.Equation TYPE_ERROR
public static final MEquation.Equation TYPE_100
public static final MEquation.Equation TYPE_150
public static final MEquation.Equation TYPE_200
public static final MEquation.Equation TYPE_300
public static final MEquation.Equation TYPE_325
public static final MEquation.Equation TYPE_350
public static final MEquation.Equation TYPE_400
public static final MEquation.Equation TYPE_450
public static final MEquation.Equation TYPE_500
public static final MEquation.Equation TYPE_515
public static final MEquation.Equation TYPE_530
public static final MEquation.Equation TYPE_550
public static final MEquation.Equation TYPE_565
public static final MEquation.Equation TYPE_580
public static final MEquation.Equation TYPE_600
public static final MEquation.Equation TYPE_650
public static final MEquation.Equation TYPE_700
public static final MEquation.Equation TYPE_725
public static final MEquation.Equation TYPE_750
public static final MEquation.Equation TYPE_775
Field Detail |
---|
public static final int STANDARD
public static final int OPEN_OFFICE
public static final int MATHML
public static final int LATEX
Method Detail |
---|
public static MEquation.Equation[] values()
for (MEquation.Equation c : MEquation.Equation.values()) System.out.println(c);
public static MEquation.Equation valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is nullpublic int numKnobs()
public java.lang.String getFormat(int pKey, java.lang.String pRelation)
pKey
- One of the format constants listed above.pRelation
- The relation (equality or inequality) type to return. Defaults to '='.public abstract java.lang.String preformat(int[] pVals)
pVals
- An array containing raw data for the computations.public java.lang.String preformat(java.lang.String pKnobs)
Preformat the data from the equation type. The return value is in the form 'Answer:A B C...:BIRD' up to the number of placeholders in the equation type. BIRD will be 'true' or 'false' and indicates whether or not an inequality should be reversed.
pKnobs
- A String containing the requisite number of Knobs.
public java.lang.String[] tokens(int[] pVals)
This method returns the preformat
data as a String array. Element [0] is the answer and the placeholders increase in order from
Element [1]. Inequality reverse detection IS set with this method and the last element in the array (after all placeholders!) is either
'true' or 'false', depending on the call to bird()
pVals
- An array containing raw data for the equation type.public java.lang.String[] tokens(java.lang.String pKnobs)
pKnobs
- A String containing the requisite number of Knobs.
public abstract boolean bird()
Blind Inequality Reverse Detection. This method indicates whether or not an inequality should be reversed based on the numbers used to build it. It is 'blind' because it makes no assumptions about whether or not it actually IS building an inequality, it always presumes so.
NOTE: This method is valid immediately after a call to preformat()
or tokens()
ONLY!! Any other time its value is
meaningless.
public abstract java.lang.String solveFor(int... pPlaceHolders)
This method allows an Equation enum
member to be used to create an equation or inequality that does NOT solve nicely. The arguments are the
placeholders, in order. The return value is String to allow fractions to be presented (typewriter format) and to allow inequality reversal to be indicated.
If the values indicate that an inequality should be reversed the String '(REV)' appears at the end of the return value.
pPlaceHolders
- The placeholders required for the Equation
desired.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |