Java Code Examples for org.apache.commons.math.exception.util.LocalizedFormats#REAL_FORMAT

The following examples show how to use org.apache.commons.math.exception.util.LocalizedFormats#REAL_FORMAT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create an instance with a custom imaginary character, a custom number
 * format for the real part, and a custom number format for the imaginary
 * part.
 *
 * @param imaginaryCharacter The custom imaginary character.
 * @param realFormat the custom format for the real part.
 * @param imaginaryFormat the custom format for the imaginary part.
 * @throws NullArgumentException if {@code imaginaryCharacter} is
 * {@code null}.
 * @throws NoDataException if {@code imaginaryCharacter} is an
 * empty string.
 * @throws NullArgumentException if {@code imaginaryFormat} is {@code null}.
 * @throws NullArgumentException if {@code realFormat} is {@code null}.
 */
public ComplexFormat(String imaginaryCharacter,
                     NumberFormat realFormat,
                     NumberFormat imaginaryFormat) {
    if (imaginaryCharacter == null) {
        throw new NullArgumentException();
    }
    if (imaginaryCharacter.length() == 0) {
        throw new NoDataException();
    }
    if (imaginaryFormat == null) {
        throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT);
    }
    if (realFormat == null) {
        throw new NullArgumentException(LocalizedFormats.REAL_FORMAT);
    }

    this.imaginaryCharacter = imaginaryCharacter;
    this.imaginaryFormat = imaginaryFormat;
    this.realFormat = realFormat;
}
 
Example 2
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create an instance with a custom imaginary character, a custom number
 * format for the real part, and a custom number format for the imaginary
 * part.
 *
 * @param imaginaryCharacter The custom imaginary character.
 * @param realFormat the custom format for the real part.
 * @param imaginaryFormat the custom format for the imaginary part.
 * @throws NullArgumentException if {@code imaginaryCharacter} is
 * {@code null}.
 * @throws NoDataException if {@code imaginaryCharacter} is an
 * empty string.
 * @throws NullArgumentException if {@code imaginaryFormat} is {@code null}.
 * @throws NullArgumentException if {@code realFormat} is {@code null}.
 */
public ComplexFormat(String imaginaryCharacter,
                     NumberFormat realFormat,
                     NumberFormat imaginaryFormat) {
    if (imaginaryCharacter == null) {
        throw new NullArgumentException();
    }
    if (imaginaryCharacter.length() == 0) {
        throw new NoDataException();
    }
    if (imaginaryFormat == null) {
        throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT);
    }
    if (realFormat == null) {
        throw new NullArgumentException(LocalizedFormats.REAL_FORMAT);
    }

    this.imaginaryCharacter = imaginaryCharacter;
    this.imaginaryFormat = imaginaryFormat;
    this.realFormat = realFormat;
}
 
Example 3
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create an instance with a custom imaginary character, a custom number
 * format for the real part, and a custom number format for the imaginary
 * part.
 *
 * @param imaginaryCharacter The custom imaginary character.
 * @param realFormat the custom format for the real part.
 * @param imaginaryFormat the custom format for the imaginary part.
 * @throws NullArgumentException if {@code imaginaryCharacter} is
 * {@code null}.
 * @throws NoDataException if {@code imaginaryCharacter} is an
 * empty string.
 * @throws NullArgumentException if {@code imaginaryFormat} is {@code null}.
 * @throws NullArgumentException if {@code realFormat} is {@code null}.
 */
public ComplexFormat(String imaginaryCharacter,
                     NumberFormat realFormat,
                     NumberFormat imaginaryFormat) {
    if (imaginaryCharacter == null) {
        throw new NullArgumentException();
    }
    if (imaginaryCharacter.length() == 0) {
        throw new NoDataException();
    }
    if (imaginaryFormat == null) {
        throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT);
    }
    if (realFormat == null) {
        throw new NullArgumentException(LocalizedFormats.REAL_FORMAT);
    }

    this.imaginaryCharacter = imaginaryCharacter;
    this.imaginaryFormat = imaginaryFormat;
    this.realFormat = realFormat;
}
 
Example 4
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Modify the realFormat.
 * @param realFormat The new realFormat value.
 * @throws NullArgumentException if {@code realFormat} is {@code null}.
 */
public void setRealFormat(NumberFormat realFormat) {
    if (realFormat == null) {
        throw new NullArgumentException(LocalizedFormats.REAL_FORMAT);
    }
    this.realFormat = realFormat;
}