|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.shell.text.math.LinearCombFormatV1<V>
V
- the variable type.public final class LinearCombFormatV1<V>
This class is a concrete implementation of LinearCombFormat. The linear combination format defined by this class looks like:
(coefficient1) variable1 + (constant)
Coefficients and constants must be enclosed by parentheses. In terms, the
coefficients must appear before the variable, and the two must be separated
by at least one whitespace character. Terms must be separated by +
signs. Coefficients, constants, variables, and +
signs must all be
separated from each other by at least one whitespace character, which means
variable strings cannot contain any whitespace characters. The constant in a
linear combination string can occurr in any sensible position.
Constructor Summary | |
---|---|
LinearCombFormatV1(SimpleFormat<V> variableFormat)
Constructs a new linear combination format using the provided format. |
|
LinearCombFormatV1(SimpleFormat<V> variableFormat,
double zeroCutoff)
Constructs a new linear combination format using the provided arguments. |
Method Summary | |
---|---|
java.lang.String |
format(LinearComb<V> expression)
Returns a formatted string representation of the provided linear combination. |
static LinearCombFormatV1<java.lang.String> |
getBasic()
Returns a LinearCombFormatV1 that does not
format or parse the variables supplied to it. |
CoeffFormatV1 |
getCoeffFormat()
Returns the format used for coefficients. |
LinCombTermFormatV1<V> |
getTermFormat()
Returns the format used for terms. |
SimpleFormat<V> |
getVariableFormat()
Returns the format used for variables. |
LinearComb<V> |
parse(java.lang.String expression)
Parses the provided string and returns its corresponding linear combination. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface sbrt.shell.text.Formatter |
---|
format |
Constructor Detail |
---|
public LinearCombFormatV1(SimpleFormat<V> variableFormat, double zeroCutoff)
variableFormat
- the format to use for variables.zeroCutoff
- the zero cutoff for constants and coefficients.LinearComb.getZeroCutoff()
public LinearCombFormatV1(SimpleFormat<V> variableFormat)
variableFormat
- the format to use for variables.LinearComb.getZeroCutoff()
Method Detail |
---|
public static LinearCombFormatV1<java.lang.String> getBasic()
LinearCombFormatV1
that does not
format or parse the variables supplied to it. In other
words, it returns a LinearCombFormatV1
with
the most basic possible functionality. Empty strings are not
allowed however.
LinearCombFormatV1
that does not
format or parse the variables supplied to it.public SimpleFormat<V> getVariableFormat()
public LinCombTermFormatV1<V> getTermFormat()
public CoeffFormatV1 getCoeffFormat()
public java.lang.String format(LinearComb<V> expression)
format
in interface LinearCombFormat<V>
format
in interface MathExprFormat<LinearComb<V>,V>
expression
- the linear combination to be formatted.
public LinearComb<V> parse(java.lang.String expression)
parse
in interface LinearCombFormat<V>
parse
in interface MathExprFormat<LinearComb<V>,V>
parse
in interface Parser<LinearComb<V>>
expression
- the string to be parsed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |