public class SimOutputFileHandler
extends java.lang.Object
This project was carried out at:
and supported byGenOpt Copyright (c) 1998-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
| Modifier and Type | Field and Description | 
|---|---|
| protected java.lang.String | delimiterobjective function delimiter | 
| protected int | delLenlength of function delimiter | 
| (package private) java.lang.String | filNamThe file name | 
| (package private) int | firstCharAtOne-based index for the position where the first character of the delimiter starts,
            or 0 if unspecified | 
| private static java.lang.String | LSSystem dependent line separator | 
| private static java.lang.String | separatorseparator after the objective function value (will be initialized below) | 
| Constructor and Description | 
|---|
| SimOutputFileHandler(java.lang.String fileName,
                    java.lang.String Separator)Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected static java.lang.String | cutBeginSpaceAndTab(java.lang.String s)cuts all space and tab characters at the beginning of the String | 
| protected static java.lang.String | cutEndSpaceAndTab(java.lang.String s)cuts all space and tab characters at the end of the String | 
| private double | getDoubleAfterLastSpace(java.lang.String s)gets the double that occurs after the last blank character | 
| private double | getFirstDouble(java.lang.String s)gets the first double that occurs in the String (which is
 separated from the next entries by either a space character,
 a tab, a comma, or a semicolon, or a double dot) | 
| protected static int | getIndexOfSeparator(java.lang.String s)gets the first index of the space character, tab character,
 semi-colon, colon, or comma | 
| double | getObjectiveFunctionValue(java.lang.String ObjectiveFunctiondelimiter,
                         int firstCharacterAt)gets the last number of the file content | 
| private double | getObjectiveFunctionValueEmpty()gets the last number of the file content. | 
| private double | getObjectiveFunctionValueNonEmpty()gets the last number of the file content. | 
| static void | main(java.lang.String[] args)The main method. | 
| private double | parseToDouble(java.lang.String s)parses a String to a double value | 
| protected void | throwObjectiveFunctionValueNotFound()Throws an  OptimizerExceptionwith the error message
 that the objective function value could not be found. | 
private static final java.lang.String LS
private static java.lang.String separator
protected java.lang.String delimiter
protected int delLen
java.lang.String filNam
int firstCharAt
public SimOutputFileHandler(java.lang.String fileName,
                            java.lang.String Separator)
                     throws java.io.IOException,
                            java.io.FileNotFoundException,
                            java.lang.SecurityException
fileName - the file nameSeparator - separator after the objective function valuejava.io.IOExceptionjava.io.FileNotFoundExceptionjava.lang.SecurityExceptionpublic double getObjectiveFunctionValue(java.lang.String ObjectiveFunctiondelimiter,
                                        int firstCharacterAt)
                                 throws OptimizerException
ObjectiveFunctiondelimiter - String that indicates delimiter
 (additional to the blank space) of the objective function valuefirstCharacterAt - one-based index for the position
                   where the first character of the delimiter starts,
                   or 0 if unspecifiedOptimizerException - if objective function value has not been foundjava.io.IOException - if an IOException occurred while reading the fileprotected static final java.lang.String cutBeginSpaceAndTab(java.lang.String s)
s - the String to be cuttedprotected static final java.lang.String cutEndSpaceAndTab(java.lang.String s)
s - the String to be cuttedprotected static int getIndexOfSeparator(java.lang.String s)
s - the String to be tested-1 if non of them is foundprivate double getDoubleAfterLastSpace(java.lang.String s)
                                throws OptimizerException
s - the String containing the doubleOptimizerExceptionprivate double getFirstDouble(java.lang.String s)
                       throws OptimizerException
s - the String containing the doubleOptimizerExceptionprivate double getObjectiveFunctionValueEmpty()
                                       throws OptimizerException,
                                              java.io.IOException
OptimizerExceptionjava.io.IOExceptionprivate double getObjectiveFunctionValueNonEmpty()
                                          throws OptimizerException,
                                                 java.io.IOException
OptimizerExceptionjava.io.IOExceptionprotected void throwObjectiveFunctionValueNotFound()
                                            throws OptimizerException
OptimizerException with the error message
 that the objective function value could not be found.OptimizerExceptionprivate double parseToDouble(java.lang.String s)
                      throws OptimizerException
s - the String to be parsedOptimizerException - if the String is not a number or
     if it is infinitepublic static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        OptimizerException
java.io.IOExceptionOptimizerException