View Javadoc
1   package us.codecraft.webmagic.selector;
2   
3   /**
4    * Object contains regex results.<br>
5    * For multi group result extension.<br>
6    *
7    * @author code4crafter@gmail.com <br>
8    * @since 0.1.0
9    */
10  class RegexResult {
11  
12      private String[] groups;
13  
14      public static final RegexResult EMPTY_RESULT = new RegexResult();
15  
16      public RegexResult() {
17  
18      }
19  
20      public RegexResult(String[] groups) {
21          this.groups = groups;
22      }
23  
24      public String get(int groupId) {
25          if (groups == null) {
26              return null;
27          }
28          return groups[groupId];
29      }
30  
31  }