// see if simple number
try {
layer.setCount(Integer.parseInt(check));
if (layer.getCount() < 0) {
throw new EncogError("Count cannot be less than zero.");
}
} catch (final NumberFormatException f) {
EncogLogging.log(f);
}
// see if it is a default
if ("?".equals(check)) {
if (defaultValue < 0) {
throw new EncogError("Default (?) in an invalid location.");
} else {
layer.setCount(defaultValue);
layer.setUsedDefault(true);
return layer;
}
}
// single item, no function
final int startIndex = check.indexOf('(');
final int endIndex = check.lastIndexOf(')');
if (startIndex == -1) {
layer.setName(check);
return layer;
}
// function
if (endIndex == -1) {
throw new EncogError("Illegal parentheses.");
}
layer.setName(check.substring(0, startIndex).trim());
final String paramStr = check.substring(startIndex + 1, endIndex);