Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1029554 // CharacterClassIterator

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2616L/17K).

abstract sclass CharacterClassIterator {
  // move method (go to next character)
  // callee can assume that c is compatible with canAcceptChar
  // return value can be this or follow-up iterator, but not null.
  // Caller must, after this call, use the return value instead of the old iterator.

  abstract CharacterClassIterator acceptChar(char c);
  
  // query methods about next character
  
  abstract bool canEndHere();
  bool canAcceptChar(char c) { ret contains(acceptedChars(), c); }
  
  // can be null
  abstract Collection<Char> acceptedChars();
  
  // This character range must contain all the characters that
  // are accepted by canAcceptChar at the current position.
  // character range should be interpreted in a way compatible with an agreed-on char comparator.
  // Method can return null if no chars are accepted at this position.
  
  abstract CharRange acceptedCharRange();
  
  // clone this iterator - may return same object if iterator is immutable
  abstract CharacterClassIterator cloneCCI();
}

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: #1029554
Snippet name: CharacterClassIterator
Eternal ID of this version: #1029554/15
Text MD5: 9f625633d2108af3397e0843ecb55856
Transpilation MD5: 33de7170b98c20e257f93ac75dbd9769
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:53:06
Source code size: 1049 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 269 / 569
Version history: 14 change(s)
Referenced in: #1029557 - stringToCharacterClassIterator
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)