PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/src/test/java/org/sigmah/endtoend/xpath/EqualityExprBuilder.java

http://sigma-h.googlecode.com/
Java | 24 lines | 15 code | 5 blank | 4 comment | 0 complexity | 0e3843127022fccc6758e2da4f0df96a MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.endtoend.xpath;
 7
 8public class EqualityExprBuilder<T> implements Predicate {
 9    protected StringBuilder expr = new StringBuilder();
10
11    public Predicate equalTo(T rightHandSide) {
12        return compose("=", rightHandSide);
13    }
14
15    public Predicate notEqualTo(T rightHandSide) {
16        return compose("!=", rightHandSide);
17    }
18
19    protected Predicate compose(String operator, Object value) {
20        expr.append(operator);
21        expr.append(value.toString());
22        return new PredicateLiteral(expr.toString());
23    }
24}