net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat Maven / Gradle / Ivy
Show all versions of pinyin4j-multi Show documentation
/**
* This file is part of pinyin4j (http://sourceforge.net/projects/pinyin4j/) and distributed under
* GNU GENERAL PUBLIC LICENSE (GPL).
*
* pinyin4j is free software; you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* pinyin4j is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with pinyin4j.
*/
package net.sourceforge.pinyin4j.format;
/**
* This classes define how the Hanyu Pinyin should be outputted.
*
*
* The output feature includes:
*
* - Output format of character 'ü';
*
- Output format of Chinese tones;
*
- Cases of letters in outputted string
*
*
*
* Default values of these features are listed below:
*
*
* HanyuPinyinVCharType := WITH_U_AND_COLON
* HanyuPinyinCaseType := LOWERCASE
* HanyuPinyinToneType := WITH_TONE_NUMBER
*
*
* Some combinations of output format options are meaningless. For example,
* WITH_TONE_MARK and WITH_U_AND_COLON.
*
*
* The combination of different output format options are listed below. For
* example, '吕'
*
*
*
* LOWERCASE
*
*
* Combination
* WITH_U_AND_COLON
* WITH_V
* WITH_U_UNICODE
*
*
* WITH_TONE_NUMBER
* lu:3
* lv3
* lü3
*
*
* WITHOUT_TONE
* lu:
* lv
* lü
*
*
* WITH_TONE_MARK
* throw exception
* throw exception
* lǚ
*
*
*
*
*
* UPPERCASE
*
*
* Combination
* WITH_U_AND_COLON
* WITH_V
* WITH_U_UNICODE
*
*
* WITH_TONE_NUMBER
* LU:3
* LV3
* LÜ3
*
*
* WITHOUT_TONE
* LU:
* LV
* LÜ
*
*
* WITH_TONE_MARK
* throw exception
* throw exception
* LǙ
*
*
*
* @see HanyuPinyinVCharType
* @see HanyuPinyinCaseType
* @see HanyuPinyinToneType
*
* @author Li Min ([email protected])
*
*/
final public class HanyuPinyinOutputFormat {
public HanyuPinyinOutputFormat() {
restoreDefault();
}
/**
* Restore default variable values for this class
*
* Default values are listed below:
*
*
* HanyuPinyinVCharType := WITH_U_AND_COLON
* HanyuPinyinCaseType := LOWERCASE
* HanyuPinyinToneType := WITH_TONE_NUMBER
*/
public void restoreDefault() {
vCharType = HanyuPinyinVCharType.WITH_U_AND_COLON;
caseType = HanyuPinyinCaseType.LOWERCASE;
toneType = HanyuPinyinToneType.WITH_TONE_NUMBER;
}
/**
* Returns the output cases of Hanyu Pinyin characters
*
* @see HanyuPinyinCaseType
*/
public HanyuPinyinCaseType getCaseType() {
return caseType;
}
/**
* Define the output cases of Hanyu Pinyin characters
*
* @param caseType
* the output cases of Hanyu Pinyin characters
*
* @see HanyuPinyinCaseType
*/
public void setCaseType(HanyuPinyinCaseType caseType) {
this.caseType = caseType;
}
/**
* Returns the output format of Chinese tones
*
* @see HanyuPinyinToneType
*/
public HanyuPinyinToneType getToneType() {
return toneType;
}
/**
* Define the output format of Chinese tones
*
* @param toneType
* the output format of Chinese tones
*
* @see HanyuPinyinToneType
*/
public void setToneType(HanyuPinyinToneType toneType) {
this.toneType = toneType;
}
/**
* Returns output format of character 'ü'
*
* @see HanyuPinyinVCharType
*/
public HanyuPinyinVCharType getVCharType() {
return vCharType;
}
/**
* Define the output format of character 'ü'
*
* @param charType
* the output format of character 'ü'
*
* @see HanyuPinyinVCharType
*/
public void setVCharType(HanyuPinyinVCharType charType) {
vCharType = charType;
}
private HanyuPinyinVCharType vCharType;
private HanyuPinyinCaseType caseType;
private HanyuPinyinToneType toneType;
}