if ("FREE TEXT".equals(TEXT.toUpperCase())) {
return new FreeStringScale();
}
if (TEXT.indexOf(Scale.SEPARATOR) != -1 ) {
RestrictedScale v = null;
// try {
// v = new IntRangeScale();
// v.setRestriction(TEXT);
// } catch (IllegalArgumentException e) {
// // do nothing, that's ok, thrown by IntRange -
// // it means we don't have numbers, but an ordinary scale.
// // proceed:
// v = new OrdinalScale();
// v.setRestriction(TEXT);
// }
v = new IntRangeScale();
if (! ((IntRangeScale)v).validateAndSetRestriction(TEXT)) {
v= new OrdinalScale();
v.setRestriction(TEXT);
}
return v;
}
} catch (Exception e) {
log.warn("invalid scale format, ignoring: "+TEXT,e);
}
//default behaviour: float scale and the TEXT as unit
PositiveFloatScale v = new PositiveFloatScale();
v.setUnit(TEXT);
return v;
}