1 package br.com.caelum.seleniumdsl.search;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import br.com.caelum.seleniumdsl.table.Row;
7
8
9 public class RowFinder implements RowVisitor {
10 private Row found = null;
11 private List<Matcher> matchers;
12
13 public RowFinder() {
14 this.matchers = new ArrayList<Matcher>();
15 }
16
17 public RowFinder limitEquals(int row, String content) {
18 matchers.add(new EqualsMatcher(row, content));
19 return this;
20 }
21
22 public void visit(Row row) {
23 for (Matcher m : matchers) {
24 if (!m.matches(row)) {
25 return;
26 }
27 }
28 found = row;
29 }
30
31 public boolean found() {
32 return found != null;
33 }
34
35 public Row getFound() {
36 return found;
37 }
38 }