Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#URL_CONTAINS_NO_DATA

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#URL_CONTAINS_NO_DATA . 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: ValueServer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets next sequential value from the <code>valuesFileURL</code>.
 * <p>
 * Throws an IOException if the read fails.</p>
 * <p>
 * This method will open the <code>valuesFileURL</code> if there is no
 * replay file open.</p>
 * <p>
 * The <code>valuesFileURL</code> will be closed and reopened to wrap around
 * from EOF to BOF if EOF is encountered. EOFException (which is a kind of
 * IOException) may still be thrown if the <code>valuesFileURL</code> is
 * empty.</p>
 *
 * @return next value from the replay file
 * @throws IOException if there is a problem reading from the file
 * @throws MathIllegalStateException if URL contains no data
 * @throws NumberFormatException if an invalid numeric string is
 *   encountered in the file
 */
private double getNextReplay() throws IOException, MathIllegalStateException {
    String str = null;
    if (filePointer == null) {
        resetReplayFile();
    }
    if ((str = filePointer.readLine()) == null) {
        // we have probably reached end of file, wrap around from EOF to BOF
        closeReplayFile();
        resetReplayFile();
        if ((str = filePointer.readLine()) == null) {
            throw new MathIllegalStateException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                valuesFileURL);
        }
    }
    return Double.parseDouble(str);
}
 
Example 2
Source File: ValueServer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets next sequential value from the <code>valuesFileURL</code>.
 * <p>
 * Throws an IOException if the read fails.</p>
 * <p>
 * This method will open the <code>valuesFileURL</code> if there is no
 * replay file open.</p>
 * <p>
 * The <code>valuesFileURL</code> will be closed and reopened to wrap around
 * from EOF to BOF if EOF is encountered. EOFException (which is a kind of
 * IOException) may still be thrown if the <code>valuesFileURL</code> is
 * empty.</p>
 *
 * @return next value from the replay file
 * @throws IOException if there is a problem reading from the file
 * @throws MathIllegalStateException if URL contains no data
 * @throws NumberFormatException if an invalid numeric string is
 *   encountered in the file
 */
private double getNextReplay() throws IOException, MathIllegalStateException {
    String str = null;
    if (filePointer == null) {
        resetReplayFile();
    }
    if ((str = filePointer.readLine()) == null) {
        // we have probably reached end of file, wrap around from EOF to BOF
        closeReplayFile();
        resetReplayFile();
        if ((str = filePointer.readLine()) == null) {
            throw new MathIllegalStateException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                valuesFileURL);
        }
    }
    return Double.valueOf(str).doubleValue();
}
 
Example 3
Source File: ValueServer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets next sequential value from the <code>valuesFileURL</code>.
 * <p>
 * Throws an IOException if the read fails.</p>
 * <p>
 * This method will open the <code>valuesFileURL</code> if there is no
 * replay file open.</p>
 * <p>
 * The <code>valuesFileURL</code> will be closed and reopened to wrap around
 * from EOF to BOF if EOF is encountered. EOFException (which is a kind of
 * IOException) may still be thrown if the <code>valuesFileURL</code> is
 * empty.</p>
 *
 * @return next value from the replay file
 * @throws IOException if there is a problem reading from the file
 * @throws NumberFormatException if an invalid numeric string is
 *   encountered in the file
 */
private double getNextReplay() throws IOException {
    String str = null;
    if (filePointer == null) {
        resetReplayFile();
    }
    if ((str = filePointer.readLine()) == null) {
        // we have probably reached end of file, wrap around from EOF to BOF
        closeReplayFile();
        resetReplayFile();
        if ((str = filePointer.readLine()) == null) {
            throw new MathIllegalStateException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                valuesFileURL);
        }
    }
    return Double.valueOf(str).doubleValue();
}
 
Example 4
Source File: ValueServer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets next sequential value from the <code>valuesFileURL</code>.
 * <p>
 * Throws an IOException if the read fails.</p>
 * <p>
 * This method will open the <code>valuesFileURL</code> if there is no
 * replay file open.</p>
 * <p>
 * The <code>valuesFileURL</code> will be closed and reopened to wrap around
 * from EOF to BOF if EOF is encountered. EOFException (which is a kind of
 * IOException) may still be thrown if the <code>valuesFileURL</code> is
 * empty.</p>
 *
 * @return next value from the replay file
 * @throws IOException if there is a problem reading from the file
 * @throws MathIllegalStateException if URL contains no data
 * @throws NumberFormatException if an invalid numeric string is
 *   encountered in the file
 */
private double getNextReplay() throws IOException, MathIllegalStateException {
    String str = null;
    if (filePointer == null) {
        resetReplayFile();
    }
    if ((str = filePointer.readLine()) == null) {
        // we have probably reached end of file, wrap around from EOF to BOF
        closeReplayFile();
        resetReplayFile();
        if ((str = filePointer.readLine()) == null) {
            throw new MathIllegalStateException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                valuesFileURL);
        }
    }
    return Double.parseDouble(str);
}
 
Example 5
Source File: ValueServer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets next sequential value from the <code>valuesFileURL</code>.
 * <p>
 * Throws an IOException if the read fails.</p>
 * <p>
 * This method will open the <code>valuesFileURL</code> if there is no
 * replay file open.</p>
 * <p>
 * The <code>valuesFileURL</code> will be closed and reopened to wrap around
 * from EOF to BOF if EOF is encountered. EOFException (which is a kind of
 * IOException) may still be thrown if the <code>valuesFileURL</code> is
 * empty.</p>
 *
 * @return next value from the replay file
 * @throws IOException if there is a problem reading from the file
 * @throws NumberFormatException if an invalid numeric string is
 *   encountered in the file
 */
private double getNextReplay() throws IOException {
    String str = null;
    if (filePointer == null) {
        resetReplayFile();
    }
    if ((str = filePointer.readLine()) == null) {
        // we have probably reached end of file, wrap around from EOF to BOF
        closeReplayFile();
        resetReplayFile();
        if ((str = filePointer.readLine()) == null) {
            throw new MathIllegalStateException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                valuesFileURL);
        }
    }
    return Double.valueOf(str).doubleValue();
}
 
Example 6
Source File: ValueServer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets next sequential value from the <code>valuesFileURL</code>.
 * <p>
 * Throws an IOException if the read fails.</p>
 * <p>
 * This method will open the <code>valuesFileURL</code> if there is no
 * replay file open.</p>
 * <p>
 * The <code>valuesFileURL</code> will be closed and reopened to wrap around
 * from EOF to BOF if EOF is encountered. EOFException (which is a kind of
 * IOException) may still be thrown if the <code>valuesFileURL</code> is
 * empty.</p>
 *
 * @return next value from the replay file
 * @throws IOException if there is a problem reading from the file
 * @throws MathIllegalStateException if URL contains no data
 * @throws NumberFormatException if an invalid numeric string is
 *   encountered in the file
 */
private double getNextReplay() throws IOException, MathIllegalStateException {
    String str = null;
    if (filePointer == null) {
        resetReplayFile();
    }
    if ((str = filePointer.readLine()) == null) {
        // we have probably reached end of file, wrap around from EOF to BOF
        closeReplayFile();
        resetReplayFile();
        if ((str = filePointer.readLine()) == null) {
            throw new MathIllegalStateException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                valuesFileURL);
        }
    }
    return Double.valueOf(str).doubleValue();
}
 
Example 7
Source File: ValueServer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets next sequential value from the <code>valuesFileURL</code>.
 * <p>
 * Throws an IOException if the read fails.</p>
 * <p>
 * This method will open the <code>valuesFileURL</code> if there is no
 * replay file open.</p>
 * <p>
 * The <code>valuesFileURL</code> will be closed and reopened to wrap around
 * from EOF to BOF if EOF is encountered. EOFException (which is a kind of
 * IOException) may still be thrown if the <code>valuesFileURL</code> is
 * empty.</p>
 *
 * @return next value from the replay file
 * @throws IOException if there is a problem reading from the file
 * @throws MathIllegalStateException if URL contains no data
 * @throws NumberFormatException if an invalid numeric string is
 *   encountered in the file
 */
private double getNextReplay() throws IOException, MathIllegalStateException {
    String str = null;
    if (filePointer == null) {
        resetReplayFile();
    }
    if ((str = filePointer.readLine()) == null) {
        // we have probably reached end of file, wrap around from EOF to BOF
        closeReplayFile();
        resetReplayFile();
        if ((str = filePointer.readLine()) == null) {
            throw new MathIllegalStateException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                valuesFileURL);
        }
    }
    return Double.valueOf(str).doubleValue();
}
 
Example 8
Source File: ValueServer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets next sequential value from the <code>valuesFileURL</code>.
 * <p>
 * Throws an IOException if the read fails.</p>
 * <p>
 * This method will open the <code>valuesFileURL</code> if there is no
 * replay file open.</p>
 * <p>
 * The <code>valuesFileURL</code> will be closed and reopened to wrap around
 * from EOF to BOF if EOF is encountered. EOFException (which is a kind of
 * IOException) may still be thrown if the <code>valuesFileURL</code> is
 * empty.</p>
 *
 * @return next value from the replay file
 * @throws IOException if there is a problem reading from the file
 * @throws MathIllegalStateException if URL contains no data
 * @throws NumberFormatException if an invalid numeric string is
 *   encountered in the file
 */
private double getNextReplay() throws IOException, MathIllegalStateException {
    String str = null;
    if (filePointer == null) {
        resetReplayFile();
    }
    if ((str = filePointer.readLine()) == null) {
        // we have probably reached end of file, wrap around from EOF to BOF
        closeReplayFile();
        resetReplayFile();
        if ((str = filePointer.readLine()) == null) {
            throw new MathIllegalStateException(LocalizedFormats.URL_CONTAINS_NO_DATA,
                                                valuesFileURL);
        }
    }
    return Double.parseDouble(str);
}