FileDocCategorySizeDatePackage
MatchResultImpl.javaAPI DocAndroid 1.5 API2062Wed May 06 22:41:04 BST 2009java.util.regex

MatchResultImpl

public class MatchResultImpl extends Object implements MatchResult
Holds the results of a successful match of a regular expression against a given string. Only used internally, thus sparsely documented (though the defining public interface has full documentation).
see
java.util.regex.MatchResult

Fields Summary
private String
text
Holds the original input text.
private int[]
offsets
Holds the offsets of the groups in the input text. The first two elements specifiy start and end of the zero group, the next two specify group 1, and so on.
Constructors Summary
MatchResultImpl(String text, int[] offsets)

        this.text = text;
        this.offsets = offsets.clone();
    
Methods Summary
public intend()

        return end(0);
    
public intend(int group)

        return offsets[2 * group + 1];
    
public java.lang.Stringgroup()

        return text.substring(start(), end());
    
public java.lang.Stringgroup(int group)

        int from = offsets[group * 2];
        int to = offsets[(group * 2) + 1];
        if (from == -1 || to == -1) {
            return null;
        } else {
            return text.substring(from, to);
        }
    
public intgroupCount()

        return (offsets.length / 2) - 1;
    
public intstart()

        return start(0);
    
public intstart(int group)

        return offsets[2 * group];