super("interpolation", InterpolationType.class);
}
@Override
public Object parse(String value) throws Exception {
InterpolationType result = Wcs20Factory.eINSTANCE.createInterpolationType();
// remove space
value = value.trim();
// single value?
if (value.matches("http://www.opengis.net/def/interpolation/OGC/1/[^,:]*")) {
// single value then
InterpolationMethodType method = Wcs20Factory.eINSTANCE.createInterpolationMethodType();
method.setInterpolationMethod(value);
result.setInterpolationMethod(method);
return result;
}
// minimal validation of the multi-axis case
if (value.matches(".*,\\s*,.*")) {
// two consequent commas
throwInvalidSyntaxException();
} else if (value.startsWith(",") || value.endsWith(",")) {
throwInvalidSyntaxException();
}
InterpolationAxesType axes = Wcs20Factory.eINSTANCE.createInterpolationAxesType();
result.setInterpolationAxes(axes);
String[] components = value.split("\\s*,\\s*");
for (String component : components) {
// minimal validation of the content
if (!component.matches("http://www.opengis.net/def/axis/OGC/1/.*:http://www.opengis.net/def/interpolation/OGC/1/.*")) {
// not a regular axis:interpolation structure