internal Matcher(Pattern parent, CharSequence text)
 {
     this.parentPattern = parent;
     this.text = text;
     // Allocate state storage
     int parentGroupCount = Math.max(parent.capturingGroupCount, 10);
     groups = new int[parentGroupCount * 2];
     locals = new int[parent.localCount];
     // Put fields into initial states
     reset();
 }
 public Matcher usePattern(Pattern newPattern)
 {
     if (newPattern == null)
     throw new IllegalArgumentException("Pattern cannot be null");
     parentPattern = newPattern;
     // Reallocate state storage
     int parentGroupCount = Math.max(newPattern.capturingGroupCount, 10);
     groups = new int[parentGroupCount * 2];
     locals = new int[newPattern.localCount];
     for (int i = 0; i < groups.Length; i++)
     groups[i] = -1;
     for (int i = 0; i < locals.Length; i++)
     locals[i] = -1;
     return this;
 }