Fixed an issue with the README, improved error messages
This commit is contained in:
parent
87d916b0b4
commit
a75f208b02
|
@ -252,8 +252,8 @@ for comments.
|
||||||
"doubleArray": double (
|
"doubleArray": double (
|
||||||
42.5D, -20D, 400D,
|
42.5D, -20D, 400D,
|
||||||
NaND, -InfinityD, InfinityD,
|
NaND, -InfinityD, InfinityD,
|
||||||
5.3e-200F, 4e+500F, 2.2e200F,
|
5.3e-200D, 4e+120D, 2.2e200D,
|
||||||
)
|
),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Arrays are enclosed by an opening
|
Arrays are enclosed by an opening
|
||||||
|
|
|
@ -240,7 +240,7 @@ public class BdfObject implements IBdfType
|
||||||
if(ptr.isNext("true"))
|
if(ptr.isNext("true"))
|
||||||
{
|
{
|
||||||
if(type != BdfTypes.ARRAY_BOOLEAN) {
|
if(type != BdfTypes.ARRAY_BOOLEAN) {
|
||||||
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
|
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-4));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean[] a = (boolean[]) array;
|
boolean[] a = (boolean[]) array;
|
||||||
|
@ -250,7 +250,7 @@ public class BdfObject implements IBdfType
|
||||||
else if(ptr.isNext("false"))
|
else if(ptr.isNext("false"))
|
||||||
{
|
{
|
||||||
if(type != BdfTypes.ARRAY_BOOLEAN) {
|
if(type != BdfTypes.ARRAY_BOOLEAN) {
|
||||||
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
|
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-5));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean[] a = (boolean[]) array;
|
boolean[] a = (boolean[]) array;
|
||||||
|
@ -260,7 +260,7 @@ public class BdfObject implements IBdfType
|
||||||
else if(ptr.isNext("infinityd"))
|
else if(ptr.isNext("infinityd"))
|
||||||
{
|
{
|
||||||
if(type != BdfTypes.ARRAY_DOUBLE) {
|
if(type != BdfTypes.ARRAY_DOUBLE) {
|
||||||
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
|
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-9));
|
||||||
}
|
}
|
||||||
|
|
||||||
double[] a = (double[]) array;
|
double[] a = (double[]) array;
|
||||||
|
@ -270,7 +270,7 @@ public class BdfObject implements IBdfType
|
||||||
else if(ptr.isNext("-infinityd"))
|
else if(ptr.isNext("-infinityd"))
|
||||||
{
|
{
|
||||||
if(type != BdfTypes.ARRAY_DOUBLE) {
|
if(type != BdfTypes.ARRAY_DOUBLE) {
|
||||||
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
|
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-10));
|
||||||
}
|
}
|
||||||
|
|
||||||
double[] a = (double[]) array;
|
double[] a = (double[]) array;
|
||||||
|
@ -280,7 +280,7 @@ public class BdfObject implements IBdfType
|
||||||
else if(ptr.isNext("nand"))
|
else if(ptr.isNext("nand"))
|
||||||
{
|
{
|
||||||
if(type != BdfTypes.ARRAY_DOUBLE) {
|
if(type != BdfTypes.ARRAY_DOUBLE) {
|
||||||
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
|
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-4));
|
||||||
}
|
}
|
||||||
|
|
||||||
double[] a = (double[]) array;
|
double[] a = (double[]) array;
|
||||||
|
@ -290,7 +290,7 @@ public class BdfObject implements IBdfType
|
||||||
else if(ptr.isNext("infinityf"))
|
else if(ptr.isNext("infinityf"))
|
||||||
{
|
{
|
||||||
if(type != BdfTypes.ARRAY_FLOAT) {
|
if(type != BdfTypes.ARRAY_FLOAT) {
|
||||||
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
|
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-9));
|
||||||
}
|
}
|
||||||
|
|
||||||
float[] a = (float[]) array;
|
float[] a = (float[]) array;
|
||||||
|
@ -300,7 +300,7 @@ public class BdfObject implements IBdfType
|
||||||
else if(ptr.isNext("-infinityf"))
|
else if(ptr.isNext("-infinityf"))
|
||||||
{
|
{
|
||||||
if(type != BdfTypes.ARRAY_FLOAT) {
|
if(type != BdfTypes.ARRAY_FLOAT) {
|
||||||
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
|
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-10));
|
||||||
}
|
}
|
||||||
|
|
||||||
float[] a = (float[]) array;
|
float[] a = (float[]) array;
|
||||||
|
@ -310,7 +310,7 @@ public class BdfObject implements IBdfType
|
||||||
else if(ptr.isNext("nanf"))
|
else if(ptr.isNext("nanf"))
|
||||||
{
|
{
|
||||||
if(type != BdfTypes.ARRAY_FLOAT) {
|
if(type != BdfTypes.ARRAY_FLOAT) {
|
||||||
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
|
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-4));
|
||||||
}
|
}
|
||||||
|
|
||||||
float[] a = (float[]) array;
|
float[] a = (float[]) array;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
import bdf.data.IBdfDatabase;
|
import bdf.data.IBdfDatabase;
|
||||||
import bdf.types.BdfReader;
|
import bdf.types.BdfReader;
|
||||||
|
import bdf.types.BdfReaderHuman;
|
||||||
|
|
||||||
public class Tests
|
public class Tests
|
||||||
{
|
{
|
||||||
|
@ -29,28 +30,7 @@ public class Tests
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException
|
public static void main(String[] args) throws IOException
|
||||||
{
|
{
|
||||||
@SuppressWarnings("resource")
|
new BdfReaderHuman("int(NaND)");
|
||||||
FileInputStream rand = new FileInputStream("/dev/urandom");
|
|
||||||
byte[] buffer = new byte[100];
|
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
long done = 0;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
if(System.currentTimeMillis() - start > 1000) {
|
|
||||||
System.out.println("" + i + ": " + done);
|
|
||||||
start += 1000;
|
|
||||||
done = 0;
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
done += 1;
|
|
||||||
|
|
||||||
rand.read(buffer);
|
|
||||||
new BdfReader(buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue