equal
deleted
inserted
replaced
3785 |
3785 |
3786 /** |
3786 /** |
3787 * Abstract node class to match one character satisfying some |
3787 * Abstract node class to match one character satisfying some |
3788 * boolean property. |
3788 * boolean property. |
3789 */ |
3789 */ |
3790 private static abstract class CharProperty extends Node { |
3790 private abstract static class CharProperty extends Node { |
3791 abstract boolean isSatisfiedBy(int ch); |
3791 abstract boolean isSatisfiedBy(int ch); |
3792 CharProperty complement() { |
3792 CharProperty complement() { |
3793 return new CharProperty() { |
3793 return new CharProperty() { |
3794 boolean isSatisfiedBy(int ch) { |
3794 boolean isSatisfiedBy(int ch) { |
3795 return ! CharProperty.this.isSatisfiedBy(ch);}}; |
3795 return ! CharProperty.this.isSatisfiedBy(ch);}}; |
3813 |
3813 |
3814 /** |
3814 /** |
3815 * Optimized version of CharProperty that works only for |
3815 * Optimized version of CharProperty that works only for |
3816 * properties never satisfied by Supplementary characters. |
3816 * properties never satisfied by Supplementary characters. |
3817 */ |
3817 */ |
3818 private static abstract class BmpCharProperty extends CharProperty { |
3818 private abstract static class BmpCharProperty extends CharProperty { |
3819 boolean match(Matcher matcher, int i, CharSequence seq) { |
3819 boolean match(Matcher matcher, int i, CharSequence seq) { |
3820 if (i < matcher.to) { |
3820 if (i < matcher.to) { |
3821 return isSatisfiedBy(seq.charAt(i)) |
3821 return isSatisfiedBy(seq.charAt(i)) |
3822 && next.match(matcher, i+1, seq); |
3822 && next.match(matcher, i+1, seq); |
3823 } else { |
3823 } else { |
5576 static CharProperty charPropertyFor(String name) { |
5576 static CharProperty charPropertyFor(String name) { |
5577 CharPropertyFactory m = map.get(name); |
5577 CharPropertyFactory m = map.get(name); |
5578 return m == null ? null : m.make(); |
5578 return m == null ? null : m.make(); |
5579 } |
5579 } |
5580 |
5580 |
5581 private static abstract class CharPropertyFactory { |
5581 private abstract static class CharPropertyFactory { |
5582 abstract CharProperty make(); |
5582 abstract CharProperty make(); |
5583 } |
5583 } |
5584 |
5584 |
5585 private static void defCategory(String name, |
5585 private static void defCategory(String name, |
5586 final int typeMask) { |
5586 final int typeMask) { |
5598 final int ctype) { |
5598 final int ctype) { |
5599 map.put(name, new CharPropertyFactory() { |
5599 map.put(name, new CharPropertyFactory() { |
5600 CharProperty make() { return new Ctype(ctype);}}); |
5600 CharProperty make() { return new Ctype(ctype);}}); |
5601 } |
5601 } |
5602 |
5602 |
5603 private static abstract class CloneableProperty |
5603 private abstract static class CloneableProperty |
5604 extends CharProperty implements Cloneable |
5604 extends CharProperty implements Cloneable |
5605 { |
5605 { |
5606 public CloneableProperty clone() { |
5606 public CloneableProperty clone() { |
5607 try { |
5607 try { |
5608 return (CloneableProperty) super.clone(); |
5608 return (CloneableProperty) super.clone(); |