1 package org.apache.oro.text.awk; 2 3 59 60 import org.apache.oro.text.regex.*; 61 62 75 76 final class AwkMatchResult implements MatchResult { 77 85 private int __matchBeginOffset; 86 87 88 93 private int __length; 94 95 96 99 private String __match; 100 101 102 106 AwkMatchResult(String match, int matchBeginOffset){ 107 __match = match; 108 __length = match.length(); 109 __matchBeginOffset = matchBeginOffset; 110 } 111 112 113 116 public int length(){ return __length; } 117 118 119 126 public int groups(){ return 1; } 127 128 129 137 public String group(int group){ return (group == 0 ? __match : null); } 138 139 140 146 public int begin(int group){ return (group == 0 ? 0 : -1); } 147 148 155 public int end(int group){ return (group == 0 ? __length : -1); } 156 157 158 167 public int beginOffset(int group){ 168 return (group == 0 ? __matchBeginOffset : -1); 169 } 170 171 181 public int endOffset(int group){ 182 return (group == 0 ? __matchBeginOffset + __length : -1); 183 } 184 185 186 191 public String toString() { return group(0); } 192 193 } 194 195 196 197 198 199 200 | Popular Tags |