it.ssc.parser.ParserValueBoolean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsr331-ssc Show documentation
Show all versions of jsr331-ssc Show documentation
This is a JSR331 interface for SSC (Software for the Calculation of the Simplex) is a java library for solving linear programming problems v. 3.0.1.
SSC was designed and developed by Stefano Scarioli.
The newest version!
package it.ssc.parser;
import it.ssc.parser.exception.InvalidBooleanFormatException;
public class ParserValueBoolean {
public static boolean parser(String value) throws InvalidBooleanFormatException {
if(value.equalsIgnoreCase("true")) return true;
else if(value.equalsIgnoreCase("t")) return true;
else if(value.equalsIgnoreCase("false")) return false;
else if(value.equalsIgnoreCase("f")) return false;
else {
throw new InvalidBooleanFormatException("ERRORE ! Il valore "+value +" letto non e' un booleano (valori acettati 'F', 'FALSE', 'T' , 'TRUE')");
}
}
}