* @param value Type: DataValue
* @param type Type: DataValue
* @param templateText Type: TextData (Input) (default in Forte: NIL)
*/
public void addConstraint(int attr, DataValue value, DataValue type, TextData templateText) {
DataValue kind = null;
if (attr > this.getNumAttrs()) {
throw new Error(Error.BQ_ILLEGAL_ATTR, "AddConstraint", this, new IntegerData(attr), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
}
else if (type == null || !(value instanceof TextData)) {
// no need to parse or do SetValue() on "value".
this.addConstraint(attr, ConstraintOperation.OP_EQ, value);
}
else if (type instanceof TextData) {
TextData v = (TextData)value;
v.setOffset(0);
if (v.moveToChar("%_")) {
this.addConstraint(attr, ConstraintOperation.OP_LIKE, value);
}
else if (v.getActualSize() == 4 && v.moveToString("NULL", false, true)) {
this.addConstraint(attr, ConstraintOperation.OP_NULL, (DataValue)null);
}
else {
this.addConstraint(attr, ConstraintOperation.OP_EQ, value);
}
}
else if (!(type instanceof NumericData) && !(type instanceof DateTimeData)) {
kind = CloneHelper.clone(type, false);
kind.setValue(value);
this.addConstraint(attr, ConstraintOperation.OP_EQ, kind);
}
else {