Class ToneNumber

All Implemented Interfaces:
IExtendable, Visitable<IPAElement>

public class ToneNumber extends IPAElement
Represents a tone number in an IPA transcription. Tone numbers are represented as superscript numbers from 0 to 9 at the end of a syllable. A tone melody is a sequence of tone numbers.
  • Field Details

  • Constructor Details

    • ToneNumber

      public ToneNumber(int number)
    • ToneNumber

      public ToneNumber(char[] toneChars)
    • ToneNumber

      public ToneNumber(char[] toneChars, FeatureSet overrideFeatureSet, SyllableInfo syllableInfo)
  • Method Details

    • fromNumber

      public static char[] fromNumber(int number)
      Get tone number character from integer value. Valid values are 0 to 9.
      Parameters:
      number - the tone number
      Returns:
      the corresponding superscript character
    • fromString

      public static ToneNumber fromString(String toneStr)
      Return a ToneNumber from a string of digits. The string may be composed of superscript or normal digits. Anything that is not a digit is ignored. If no digits are found, or '-1', an error tone number is returned.
      Parameters:
      toneStr - the tone number string
      Returns:
      the corresponding ToneNumber
    • toneChars

      public char[] toneChars()
      Get the tone number characters.
      Returns:
      the tone number characters
    • length

      public int length()
      Get the length of the tone number character array.
      Returns:
      the length of the tone number character array
    • isMelody

      public boolean isMelody()
      Check if this tone number is a melody (i.e. has more than one tone number).
      Returns:
      true if this is a melody, false otherwise
    • isAmbiguous

      public boolean isAmbiguous()
      Check if this tone number represents an ambiguous tone error. An error tone number is represented by two combining superscript x characters: ˣˣ
      Returns:
      true if this is an ambiguous tone number, false otherwise
    • _getFeatureSet

      protected FeatureSet _getFeatureSet()
      Description copied from class: IPAElement
      Private method to return the feature set for the IPAElement.
      Specified by:
      _getFeatureSet in class IPAElement
      Returns:
      the feature set for the implementing type.
    • getText

      public String getText()
      Description copied from class: IPAElement
      Get the text for this phone
      Specified by:
      getText in class IPAElement
      Returns:
      the phone string
    • asInt

      public int asInt()
      Get tone number as integer value. If the tone number is a sequence of digits, the integer value is the concatenation of the digits. If the tone number is an error, -1 is returned.
      Returns:
      the tone number as an integer