Class CodepointSetGenerator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int[] all  
      (package private) int[] bmp  
      (package private) int[] supplementary  
    • Constructor Summary

      Constructors 
      Constructor Description
      CodepointSetGenerator​(char[] chars)
      All characters must be from BMP (no parts of surrogate pairs allowed).
      CodepointSetGenerator​(java.lang.String s)
      Parse the given String and split into BMP and supplementary codepoints.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int[] concat​(int[]... arrays)  
      private boolean isOdd​(int v)
      Is a given number odd?
      private boolean isSurrogate​(char chr)  
      java.lang.String ofCodePointsLength​(java.util.Random r, int minCodePoints, int maxCodePoints)  
      java.lang.String ofCodeUnitsLength​(java.util.Random r, int minCodeUnits, int maxCodeUnits)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • bmp

        final int[] bmp
      • supplementary

        final int[] supplementary
      • all

        final int[] all
    • Constructor Detail

      • CodepointSetGenerator

        public CodepointSetGenerator​(char[] chars)
        All characters must be from BMP (no parts of surrogate pairs allowed).
      • CodepointSetGenerator

        public CodepointSetGenerator​(java.lang.String s)
        Parse the given String and split into BMP and supplementary codepoints.
    • Method Detail

      • ofCodeUnitsLength

        public java.lang.String ofCodeUnitsLength​(java.util.Random r,
                                                  int minCodeUnits,
                                                  int maxCodeUnits)
        Specified by:
        ofCodeUnitsLength in class StringGenerator
        minCodeUnits - Minimum number of code units (inclusive).
        maxCodeUnits - Maximum number of code units (inclusive).
        Returns:
        Returns a string of variable length between minCodeUnits (inclusive) and maxCodeUnits (inclusive) length. Code units are essentially an equivalent of char type, see String class for explanation.
      • ofCodePointsLength

        public java.lang.String ofCodePointsLength​(java.util.Random r,
                                                   int minCodePoints,
                                                   int maxCodePoints)
        Specified by:
        ofCodePointsLength in class StringGenerator
        minCodePoints - Minimum number of code points (inclusive).
        maxCodePoints - Maximum number of code points (inclusive).
        Returns:
        Returns a string of variable length between minCodePoints (inclusive) and maxCodePoints (inclusive) length. Code points are full unicodeGenerator codepoints or an equivalent of int type, see String class for explanation. The returned String.length() may exceed maxCodeUnits because certain code points may be encoded as surrogate pairs.
      • isOdd

        private boolean isOdd​(int v)
        Is a given number odd?
      • concat

        private int[] concat​(int[]... arrays)
      • isSurrogate

        private boolean isSurrogate​(char chr)