}
public void setValue(Object value) {
this.value = value;
//System.out.println("setValue for "+value);
if(!(value instanceof Constraint)) {
throw new GateRuntimeException("Not a constraint: "+value);
}
Constraint constraint = (Constraint)value;
if(constraint.isNegated()) {
throw new GateRuntimeException("Constraint must not be negated: "+constraint);
}
if(constraint.getAttributeSeq().size() != 1) {
throw new GateRuntimeException("Constraint must have one predicate: "+constraint);
}
String annType = constraint.getAnnotType();
//System.out.println("Annotation type is "+annType);
ConstraintPredicate pred = constraint.getAttributeSeq().get(0);
String op = pred.getOperator();
//System.out.println("Operator is "+op);
if(op.equals("!~")) {
operator = OPERATOR_RESET;
} else if(op.equals("!=~")) {
operator = OPERATOR_CLEAR;
} else if(op.equals("==")) {
operator = OPERATOR_EQUALS;
} else {
//System.err.println("Operator is "+op+" but must be one of !=~ (reset), ==, or !=");
throw new GateRuntimeException("Constraint operator must be !~ (reset), !=~ (clear), or == (equal to ref)");
}
//System.out.println("setValue op is "+op);
Object predObj = pred.getValue();
//if(!(predObj instanceof String)) {
// throw new GateRuntimeException("Value of predicate must be a string: "+predObj+" not a "+predObj.getClass());