|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgenopt.io.SimOutputFileHandler
public class SimOutputFileHandler
Object that extends FileHandler and offers additional methods to get the value of the objective function out of the file.
This project was carried out at:
and supported byGenOpt Copyright (c) 1998-2011, 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.
| Field Summary | |
|---|---|
protected java.lang.String |
delimiter
objective function delimiter |
protected int |
delLen
length of function delimiter |
(package private) java.lang.String |
filNam
The file name |
(package private) int |
firstCharAt
One-based index for the position where the first character of the delimiter starts, or 0 if unspecified |
private static java.lang.String |
LS
System dependent line separator |
private static java.lang.String |
separator
separator after the objective function value (will be initialized below) |
| Constructor Summary | |
|---|---|
SimOutputFileHandler(java.lang.String fileName,
java.lang.String Separator)
Constructor. |
|
| Method Summary | |
|---|---|
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 OptimizerException with the error message
that the objective function value could not be found. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
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 value
java.io.IOException
java.io.FileNotFoundException
java.lang.SecurityException| Method Detail |
|---|
public 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 unspecified
OptimizerException - if objective function value has not been found
java.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 cutted
protected static final java.lang.String cutEndSpaceAndTab(java.lang.String s)
s - the String to be cutted
protected static int getIndexOfSeparator(java.lang.String s)
s - the String to be tested
-1 if non of them is found
private double getDoubleAfterLastSpace(java.lang.String s)
throws OptimizerException
s - the String containing the double
OptimizerException
private double getFirstDouble(java.lang.String s)
throws OptimizerException
s - the String containing the double
OptimizerException
private double getObjectiveFunctionValueEmpty()
throws OptimizerException,
java.io.IOException
OptimizerException
java.io.IOException
private double getObjectiveFunctionValueNonEmpty()
throws OptimizerException,
java.io.IOException
OptimizerException
java.io.IOException
protected void throwObjectiveFunctionValueNotFound()
throws OptimizerException
OptimizerException with the error message
that the objective function value could not be found.
OptimizerException
private double parseToDouble(java.lang.String s)
throws OptimizerException
s - the String to be parsed
OptimizerException - if the String is not a number or
if it is infinite
public static void main(java.lang.String[] args)
throws java.io.IOException,
OptimizerException
java.io.IOException
OptimizerException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||