Libraryless. Click here for Pure Java version (2648L/17K).
1 | sclass CCI_Substring extends CharacterClassIterator { |
2 | S s; |
3 | int i, l; |
4 | CharacterClassIterator next; |
5 | |
6 | *() {} |
7 | *(S *s, int start, int end, CharacterClassIterator *next) { i = start; l = end; } |
8 | |
9 | // no check because of method contract |
10 | CharacterClassIterator acceptChar(char c) { |
11 | ret ++i >= l && next != null ? next : this; |
12 | } |
13 | |
14 | bool canEndHere() { |
15 | ret i >= l; |
16 | } |
17 | |
18 | bool canAcceptChar(char c) { |
19 | ret i < l && s.charAt(i) == c; |
20 | } |
21 | |
22 | Cl<Char> acceptedChars() { ret i >= l ? null : ll(s.charAt(i)); } |
23 | |
24 | CharRange acceptedCharRange() { |
25 | ret i >= l ? null : singletonCharRange(s.charAt(i)); |
26 | } |
27 | |
28 | CharacterClassIterator cloneCCI() { |
29 | ret new CCI_Substring(s, i, l, next); |
30 | } |
31 | } |
Began life as a copy of #1029557
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029558 |
Snippet name: | CCI_Substring - CharacterClassIterator accepting a substring, then forwarding to a follow-up iterator |
Eternal ID of this version: | #1029558/6 |
Text MD5: | c9d0d6af98ff0f3f5fa1262fda186eec |
Transpilation MD5: | 196c40ab16ec24175756200219c10d7a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-08-23 12:54:23 |
Source code size: | 745 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 188 / 273 |
Version history: | 5 change(s) |
Referenced in: | [show references] |