Class CIDRange


  • class CIDRange
    extends java.lang.Object
    Range of continuous CIDs between two Unicode characters.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int codeLength  
      private int from  
      private int to  
      private int unicode  
    • Constructor Summary

      Constructors 
      Constructor Description
      CIDRange​(int from, int to, int unicode, int codeLength)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean extend​(int newFrom, int newTo, int newCid, int length)
      Check if the given values represent a consecutive range of the given range.
      int getCodeLength()
      Returns the byte length of the codes of the CID range.
      int map​(byte[] bytes)
      Maps the given Unicode character to the corresponding CID in this range.
      int map​(int code, int length)
      Maps the given Unicode character to the corresponding CID in this range.
      int unmap​(int code)
      Maps the given CID to the corresponding Unicode character in this range.
      • Methods inherited from class java.lang.Object

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

      • from

        private final int from
      • to

        private int to
      • unicode

        private final int unicode
      • codeLength

        private final int codeLength
    • Constructor Detail

      • CIDRange

        CIDRange​(int from,
                 int to,
                 int unicode,
                 int codeLength)
        Constructor.
        Parameters:
        from - start value of COD range
        to - end value of CID range
        unicode - unicode start value
        codeLength - byte length of CID values
    • Method Detail

      • getCodeLength

        public int getCodeLength()
        Returns the byte length of the codes of the CID range.
        Returns:
        the code length
      • map

        public int map​(byte[] bytes)
        Maps the given Unicode character to the corresponding CID in this range.
        Parameters:
        bytes - Unicode character
        Returns:
        corresponding CID, or -1 if the character is out of range
      • map

        public int map​(int code,
                       int length)
        Maps the given Unicode character to the corresponding CID in this range.
        Parameters:
        code - Unicode character
        length - origin byte length of the code
        Returns:
        corresponding CID, or -1 if the character is out of range
      • unmap

        public int unmap​(int code)
        Maps the given CID to the corresponding Unicode character in this range.
        Parameters:
        code - CID
        Returns:
        corresponding Unicode character, or -1 if the CID is out of range
      • extend

        public boolean extend​(int newFrom,
                              int newTo,
                              int newCid,
                              int length)
        Check if the given values represent a consecutive range of the given range. If so, extend the given range instead of creating a new one.
        Parameters:
        newFrom - start value of the new range
        newTo - end value of the new range
        newCid - start CID value of the range
        length - byte length of CIDs
        Returns:
        true if the given range was extended