Class NamedCharacter


  • public class NamedCharacter
    extends java.lang.Object
    Represents an named character with character name (from the Adobe glyph list) and a Unicode sequence that this character represents.
    • Constructor Summary

      Constructors 
      Constructor Description
      NamedCharacter​(java.lang.String charName)
      Simple constructor.
      NamedCharacter​(java.lang.String charName, java.lang.String unicodeSequence)
      Main constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      java.lang.String getName()
      Returns the character name (as defined by the Adobe glyph list).
      char getSingleUnicodeValue()
      Returns the single Unicode value associated with this named character.
      java.lang.String getUnicodeSequence()
      Returns the Unicode sequence associated with this character.
      int hashCode()
      boolean hasSingleUnicodeValue()
      Indicates whether a single Unicode value is associated with this character.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NamedCharacter

        public NamedCharacter​(java.lang.String charName,
                              java.lang.String unicodeSequence)
        Main constructor.
        Parameters:
        charName - the character name
        unicodeSequence - the Unicode sequence associated with this character
      • NamedCharacter

        public NamedCharacter​(java.lang.String charName)
        Simple constructor.
        Parameters:
        charName - the character name
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getName

        public java.lang.String getName()
        Returns the character name (as defined by the Adobe glyph list).
        Returns:
        the character name
      • getUnicodeSequence

        public java.lang.String getUnicodeSequence()
        Returns the Unicode sequence associated with this character.
        Returns:
        the Unicode sequence (or null if no Unicode sequence is associated)
      • hasSingleUnicodeValue

        public boolean hasSingleUnicodeValue()
        Indicates whether a single Unicode value is associated with this character.
        Returns:
        true if exactly one Unicode value is associated with this character, false otherwise
      • getSingleUnicodeValue

        public char getSingleUnicodeValue()
                                   throws java.lang.IllegalStateException
        Returns the single Unicode value associated with this named character. Check hasSingleUnicodeValue() before you call this method because an IllegalStateException is thrown is a Unicode sequence with more than one character is associated with this character.
        Returns:
        the single Unicode value (or FFFF ("NOT A CHARACTER") if no Unicode value is available)
        Throws:
        java.lang.IllegalStateException - if a Unicode sequence with more than one value is associated with the named character
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object