01: package org.osbl.agent.gui.condition;
02:
03: import java.util.List;
04:
05: import org.osbl.agent.model.condition.MethodOperator;
06: import org.osbl.agent.model.condition.Operator;
07:
08: /**
09: * The class StringConditionController models the StringCondition.
10: *
11: * It presents the user with an input-field in which a String can be entered, to
12: * compare with the (String typed) property.
13: *
14: * @author Sebastian Nozzi.
15: */
16: public class StringConditionController extends FieldConditionController {
17:
18: /**
19: * Instantiates a new number condition controller.
20: */
21: public StringConditionController() {
22: super ();
23: }
24:
25: /*
26: * (non-Javadoc)
27: *
28: * @see org.osbl.agent.gui.condition.FieldConditionController#getOperators()
29: */
30: public List<Operator> getOperators() {
31:
32: // The operators of the parent class still apply to us...
33: List<Operator> result = super .getOperators();
34:
35: // ... and now add some string-specific operators, like for regular expressions.
36:
37: // A "matches" Operator, which calls the "matches" method of the String class.
38: result
39: .add(new MethodOperator(msg("operatorMatches"),
40: "matches"));
41:
42: // And a "doesn't mach" which is like a "matches" above, but negated
43: // (since there is no method like doesNotMatch in String).
44: MethodOperator negatedMatch = new MethodOperator(
45: msg("operatorMatchesNot"), "matches");
46: negatedMatch.setNegated(true);
47:
48: result.add(negatedMatch);
49:
50: return result;
51: }
52:
53: }
|