Commit 397cac7b by Jessica Hawkwell

Added IPA Chart references

Added Unicode and supporting infrastructure
Created IPA chart

Additional references:
https://en.wikipedia.org/wiki/International_Phonetic_Alphabet
https://en.wikipedia.org/wiki/Phonetic_symbols_in_Unicode
1 parent ba6cd6b5
Pipeline #193 passed
in 27 seconds
......@@ -240,24 +240,29 @@ public final class LangBuilder implements IStrappedApp {
button.addActionListener(new UnifiedListener() {
@Override public void handleEvent(ActionHandle action) {
int a = 0;
String t = "plugin".concat(plugin.getName());
String t = plugin.getName();
Component c;
JPanel jp;
for ( a = 0; a < desktop.getTabCount(); a++ ) {
log.debug("Tab Index: ".concat(String.valueOf(a)));
c = desktop.getComponent(a);
c = desktop.getComponentAt(a);
if ( c == null ) {
log.error("Component at ".concat(String.valueOf(a)).concat(" does not exist!"));
}
else {
log.debug(c.getClass().getName());
if ( t.equals(c.getName()) ) { return; }
else if (c instanceof JPanel) {
jp = (JPanel) c;
log.debug(jp.getName());
if ( t.equals(jp.getName()) ) {
desktop.setSelectedIndex(a);
return;
}
}
}
if ( plugin.hasWindow() ) {
JPanel jp = plugin.getPanel();
jp = plugin.getPanel();
jp.setName(t);
desktop.addTab(plugin.getDisplayName(), plugin.getPanel());
desktop.addTab(plugin.getDisplayName(), jp);
}
}
});
......
......@@ -15,8 +15,7 @@ public class WelcomeWindow extends IStrappedPlugin {
private JEditorPane viewer;
@Override public void init() {
jPanel = new JPanel();
jPanel.setLayout(new BorderLayout());
jPanel = new JPanel(new BorderLayout(5, 5));
viewer = new JEditorPane();
jPanel.add(viewer);
......@@ -32,6 +31,6 @@ public class WelcomeWindow extends IStrappedPlugin {
viewer.setText(vh.generate(null, hm));
}
@Override public String getName() { return "WelconeWindow"; }
@Override public String getName() { return "WelcomeWindow"; }
@Override public String getDisplayName() { return "Welcome!"; }
}
No preview for this file type
package me.felinewith.lang_toolkit.plugins.ipa_helper;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.Border;
import me.felinewith.lang_toolkit.library.IStrappedPlugin;
import me.felinewith.lang_toolkit.plugins.ipa_helper.util.IPAHelperListener;
import org.apache.commons.lang.WordUtils;
/**
*
......@@ -30,15 +38,28 @@ public class IPAHelper extends IStrappedPlugin {
jButton.setActionCommand("IPAHelper");
GridLayout gl = new GridLayout(8, 11);
jPanel = new JPanel(gl);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
JPanel pt;
// bilabial plosives
jPanel.add(makeLetterPanel(new String[]{"p", "b"}));
jPanel.add(makeLetterPanel());
jPanel.add(makeLetterPanel());
jPanel.add(makeLetterPanel(new String[]{"t", "d"}));
panel.add(charter(
new String[]{"BILABIAL", "LABIODENTAL", "DENTAL", "ALVEOLAR", "POSTALVEOLAR", "RETROFLEX",
"LABIALPALATAL", "ALVEOLOPALATAL", "LABIALVELAR", "VELAR", "UVULAR", "PHARYNGEAL",
"EPIGLOTTAL", "GLOTTAL"},
new String[]{"PLOSIVE", "IMPLOSIVE", "EJECTIVE", "NASAL", "TRILL", "TAPFLAP", "LATERAL_FLAP",
"FRICATIVE", "LATERAL_FRICATIVE", "EJECTIVE_FRICATIVE", "EJECTIVE_LATERAL_FRICATIVE",
"PERCUSSIVE", "APPROXIMANT", "LATERAL_APPROXIMANT", "CLICK", "LATERAL_CLICK"},
true
));
panel.add(charter(
new String[]{"FRONT", "NEAR_FRONT", "CENTRAL", "NEAR_BACK", "BACK"},
new String[]{"CLOSE", "NEAR_CLOSE", "CLOSE_MID", "MID", "OPEN_MID", "NEAR_OPEN", "OPEN"},
false
));
JScrollPane jsp = new JScrollPane(panel,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jPanel = new JPanel(new BorderLayout(5, 5));
jPanel.add(jsp);
}
@Override public String getName() { return "IPAHelper"; }
......@@ -47,18 +68,146 @@ public class IPAHelper extends IStrappedPlugin {
@Override public void getActionCommand(String command) {
}
private JPanel makeLetterPanel() { return makeLetterPanel(null, null); }
private JPanel makeLetterPanel(String[] letters) { return makeLetterPanel(letters, null); }
private JPanel makeLetterPanel(String[] letters, Color background) {
JPanel pt = new JPanel();
pt.setBorder(BorderFactory.createLineBorder(Color.BLACK));
private JPanel textWrapper(String text) {
JPanel panel = new JPanel();
panel.add(new JLabel(text));
return panel;
}
private JPanel charter(String[] cols, String[] rows, boolean voice) {
GridLayout gl = new GridLayout(rows.length + 1, cols.length + 1);
JPanel panel = new JPanel(gl);
panel.setBorder(BorderFactory.createEtchedBorder());
panel.add(textWrapper(""));
IPANames n;
for ( String c : cols ) {
panel.add(textWrapper(wordFix(c))); }
for ( String r : rows ) {
for ( String c : cols ) {
if ( cols[0].equals(c) ) { panel.add(textWrapper(wordFix(r))); }
n = null;
try { n = IPANames.valueOf(c.concat("_").concat(r)); }
catch ( IllegalArgumentException ex ) {}
if ( n == null ) { panel.add(textWrapper("")); }
else { panel.add(makeLetterPanel(n, voice)); }
}
}
JPanel outer = new JPanel();
outer.setLayout(new BoxLayout(outer, BoxLayout.X_AXIS));
outer.add(panel);
JPanel right = new JPanel();
right.setLayout(new BorderLayout());
outer.add(right);
return outer;
}
private JPanel makeLetterPanel(IPANames name, boolean voice) { return makeLetterPanel(name, voice, null); }
private JPanel makeLetterPanel(IPANames name, boolean voice, Color background) {
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
if ( !name.isBoth() ) { panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); }
if ( background == null ) { panel.setBackground(Color.WHITE); }
else { panel.setBackground(background); }
JLabel left = new JLabel();
JLabel right = new JLabel();
JPanel pleft = new JPanel();
JPanel pright = new JPanel();
pleft.setBackground(panel.getBackground());
pright.setBackground(panel.getBackground());
pleft.add(left);
pright.add(right);
if ( name.hasLeft()) { left.setText(name.getLeft()); }
if ( name.hasRight()) { right.setText(name.getRight()); }
StringBuilder leftTip = new StringBuilder();
StringBuilder rightTip = new StringBuilder();
if ( name.isBoth() ) {}
else if ( voice ) {
leftTip.append("Voiced ");
rightTip.append("Unvoiced ");
}
else {
leftTip.append("Unrounded ");
rightTip.append("Rounded ");
}
String pt = wordFix(name.toString());
leftTip.append(pt);
rightTip.append(pt);
if ( name.hasLeft()) {
left.setName(name.toString());
pleft.addMouseListener(new Borderer(pleft));
pleft.setName(name.toString());
toolTipHelper(leftTip.toString(), left, pleft);
}
if ( name.hasRight()) {
right.setName(name.toString());
pright.addMouseListener(new Borderer(pright));
pright.setName(name.toString());
toolTipHelper(rightTip.toString(), right, pright);
}
left.setHorizontalAlignment(JLabel.CENTER);
left.setHorizontalTextPosition(JLabel.CENTER);
right.setHorizontalAlignment(JLabel.CENTER);
right.setHorizontalTextPosition(JLabel.CENTER);
pleft.setBorder(BorderFactory.createLineBorder(panel.getBackground(), 2));
pright.setBorder(BorderFactory.createLineBorder(panel.getBackground(), 2));
if ( name.isBoth() ) {
panel.add(left);
left.addMouseListener(new Borderer(panel));
panel.setToolTipText(left.getToolTipText());
panel.addMouseListener(new Borderer(panel));
panel.setName(name.toString());
}
else {
panel.add(pleft);
panel.add(pright);
}
return panel;
}
private String wordFix(String input) { return WordUtils.capitalize(input.replaceAll("_", " ").toLowerCase()); }
if ( background == null ) { pt.setBackground(Color.WHITE); }
else { pt.setBackground(background); }
private void nameHelper(IPANames name, JComponent... comps) {
for ( JComponent comp : comps ) { comp.setName(name.toString()); }
}
private void toolTipHelper(String toolTip, JComponent... comps) {
for ( JComponent comp : comps ) { comp.setToolTipText(toolTip);
//if ( comp instanceof JLabel ) { ((JLabel) comp).setToolTipText(toolTip); }
//if ( comp instanceof JPanel ) { ((JPanel) comp).setToolTipText(toolTip); }
}
}
private class Borderer implements MouseListener {
private JPanel p;
private Border b;
if ( letters != null ) {
for ( String s : letters ) { pt.add(new JLabel(s)); }
public Borderer(JPanel panel) { p = panel; }
@Override public void mouseClicked(MouseEvent e) {}
@Override public void mousePressed(MouseEvent e) {}
@Override public void mouseReleased(MouseEvent e) {}
@Override public void mouseEntered(MouseEvent e) {
b = p.getBorder();
p.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 2));
}
return pt;
@Override public void mouseExited(MouseEvent e) { p.setBorder(b); }
}
}
package me.felinewith.lang_toolkit.plugins.ipa_helper;
/**
*
* @author jlhawkwell
*/
public enum IPANameParts {
VOICED,
UNVOICED,
BILABIAL,
DENTAL,
ALVEOLAR,
POSTALVEOLAR,
RETROFLEX,
PALATAL,
LABIAL,
VELAR,
UVULAR,
PHARYNGEAL,
GLOTTAL,
PLOSIVE,
IMPLOSIVE,
EJECTIVE,
NASAL,
TRILL,
TAPFLAP,
FLAP,
FRICATIVE,
LATERAL,
PERCUSSIVE,
APPROXIMANT,
CLICK,
EPIGLOTTAL,
FRONT,
NEAR,
CENTRAL,
BACK,
CLOSE,
OPEN,
ROUNDED,
PRIMARYSTRESS,
SECONDARYSTRESS,
LONG,
HALF_LONG,
EXTRA_SHORT,
MINOR,
MAJOR,
SYLLABLEBREAK,
LINKING,
ASPIRATED,
MORE,
LESS,
ADVANCED,
RETRACTED,
CENTRALIZED,
SYLLABIC,
NON,
RHOTICITY,
BREATHY,
CREAKY,
LINGUOLABIAL,
LABIALIZED,
PALATALIZED,
VELARIZED,
PHARYNGEALIZED,
RAISED,
LOWERED,
TONGUEROOT,
APICAL,
LAMINAL,
NASALIZED,
RELEASE,
NOAUDIBLERELEASE,
EXTRA,
HIGH,
MID,
LOW,
DOWNSTEP,
UPSTEP,
RISING,
FALLING,
GLOBAL,
;
}
package me.felinewith.lang_toolkit.plugins.ipa_helper;
import java.util.ArrayList;
import org.apache.logging.log4j.LogManager;
/**
*
* @author jlhawkwell
*/
public enum IPANames {
// <editor-fold desc="Consonants">
// plosive
BILABIAL_PLOSIVE("\u0070", "\u0062"),
LABIODENTAL_PLOSIVE("\u0070\u032a", "\u0062\u032a"),
DENTAL_PLOSIVE("\u0074\u032a", "\u0064\u032a"),
ALVEOLAR_PLOSIVE("\u0074", "\u0064"),
RETROFLEX_PLOSIVE("\u0288", "\u0256"),
ALVEOLOPALATAL_PLOSIVE("\u0236", "\u0221"),
PALATAL_PLOSIVE("\u0063", "\u025f"),
LABIALVELAR_PLOSIVE("\u006b\u0361\u0070", "\u0261\u0361\u0062"),
VELAR_PLOSIVE("\u006b", "\u0261"),
UVULAR_PLOSIVE("\u0071", "\u0262"),
EPIGLOTTAL_PLOSIVE("\u02a1"),
GLOTTAL_PLOSIVE("\u0294"),
// implosive
BILABIAL_IMPLOSIVE("\u0253\u0325", "\u0253"),
DENTAL_IMPLOSIVE(null, "\u0257\u032a"),
ALVEOLAR_IMPLOSIVE(null, "\u0257"),
RETROFLEX_IMPLOSIVE(null, "\u1d91"),
PALATAL_IMPLOSIVE(null, "\u0284"),
VELAR_IMPLOSIVE(null, "\u0260"),
UVULAR_IMPLOSIVE(null, "\u029b"),
// ejective
BILABIAL_EJECTIVE("\u0070\u02bc"),
DENTAL_EJECTIVE("\u0074\u032a\u02bc"),
ALVEOLAR_EJECTIVE("\u0074\u02bc"),
RETROFLEX_EJECTIVE("\u0288\u02bc"),
PALATAL_EJECTIVE("\u0063\u02bc"),
VELAR_EJECTIVE("\u006b\u02bc"),
UVULAR_EJECTIVE("\u0071\u02bc"),
// nasal
BILABIAL_NASAL("\u006d\u0325", "\u006d"),
LABIODENTAL_NASAL("\u0271\u030a", "\u0271"),
DENTAL_NASAL("\u006e\u032a\u030a", "\u006e\u032a"),
ALVEOLAR_NASAL("\u006e\u0325", "\u006e"),
RETROFLEX_NASAL("\u0273\u030a", "\u0273"),
ALVEOLOPALATAL_NASAL(null, "\u0235"),
PALATAL_NASAL(null, "\u0272"),
LABIALVELAR_NASAL(null, "\u014b\u0361\u006d"),
VELAR_NASAL(null, "\u014b"),
UVULAR_NASAL(null, "\u0274"),
// trill
BILABIAL_TRILL(null, "\u0299"),
ALVEOLAR_TRILL("\u0072\u0325", "\u0072"),
RETROFLEX_TRILL(null, "\u027d\u0361\u0072"),
UVULAR_TRILL(null, "\u0280"),
EPIGLOTTAL_TRILL(null, "!?"),
// tap or flap
BILABIAL_TAPFLAP(null, "\u2c71\u031f"),
LABIODENTAL_TAPFLAP(null, "\u2c71"),
ALVEOLAR_TAPFLAP(null, "\u027e"),
RETROFLEX_TAPFLAP(null, "\u027d"),
EPIGLOTTAL_TAPFLAP(null, "!?"),
// lateral flap
ALVEOLAR_LATERAL_FLAP(null, "\u027a"),
RETROFLEX_LATERAL_FLAP(null, "!?"),
PALATAL_LATERAL_FLAP(null, "!?"),
VELAR_LATERAL_FLAP(null, "!?"),
// fricative
BILABIAL_FRICATIVE("\u0278", "\u03b2"),
LABIODENTAL_FRICATIVE("\u0066", "\u0076"),
DENTAL_FRICATIVE("\u03b8", "\u00f0"),
ALVEOLAR_FRICATIVE("\u0073", "\u007a"),
POSTALVEOLAR_FRICATIVE("\u0283", "\u0392"),
RETROFLEX_FRICATIVE("\u0282", "\u0290"),
ALVEOLOPALATAL_FRICATIVE("\u0255", "\u0291"),
PALATAL_FRICATIVE("\u0063\u0327", "\u029d"),
VELAR_FRICATIVE("\u0078", "\u0263"),
UVULAR_FRICATIVE("\u03c7", "\u0281"),
PHARYNGEAL_FRICATIVE("\u0127", "\u0295"),
EPIGLOTTAL_FRICATIVE("\u029c", "\u02a2"),
GLOTTAL_FRICATIVE("\u0068", "\u0266"),
// lateral fricative
ALVEOLAR_LATERAL_FRICATIVE("\u026c", "\u026e"),
RETROFLEX_LATERAL_FRICATIVE(null, "\ua78e"),
// ejective fricative
ALVEOLAR_EJECTIVE_FRICATIVE("\u0073\u02bc"),
POSTALVEOLAR_EJECTIVE_FRICATIVE("\u0283\u02bc"),
// ejective lateral fricative
ALVEOLAR_EJECTIVE_LATERAL_FRICATIVE("\u026c\u02bc"),
// percussive
BILABIAL_PERCUSSIVE("\u02ac", "\u02ac"),
DENTAL_PERCUSSIVE("\u02ad", "\u02ad"),
// approximant
BILABIAL_APPROXIMANT("\u03b2\u031e\u030a", "\u03b2\u031e"),
LABIODENTAL_APPROXIMANT("\u028b\u0325", "\u028b"),
DENTAL_APPROXIMANT(null, "\u00f0\u031e"),
ALVEOLAR_APPROXIMANT("\u0279\u0325", "\u0279"),
RETROFLEX_APPROXIMANT("\u027b\u030a", "\u027b"),
LABIALPALATAL_APPROXIMANT("\u0265\u030a", "\u0265"),
PALATAL_APPROXIMANT(null, "\u006a"),
LABIALVELAR_APPROXIMANT("\u028d", "\u0077"),
VELAR_APPROXIMANT(null, "\u0270"),
// lateral approximant
ALVEOLAR_LATERAL_APPROXIMANT("\u006c\u0325", "\u006c"),
RETROFLEX_LATERAL_APPROXIMANT(null, "\u026d"),
ALVEOLOPALATAL_LATERAL_APPROXIMANT(null, "\u0234"),
PALATAL_LATERAL_APPROXIMANT(null, "\u028e"),
VELAR_LATERAL_APPROXIMANT(null, "\u029f"),
// click consonant
BILABIAL_CLICK("\u0298", "\u0298"),
DENTAL_CLICK("\u01c0", "\u01c0"),
ALVEOLAR_CLICK("\u01c3", "\u01c3"),
POSTALVEOLAR_CLICK("\u01c3 / \u01c2", "\u01c3 / \u01c2"),
// lateral click
DENTAL_LATERAL_CLICK("\u01c1\u0296", "\u01c1\u0296"),
ALVEOLAR_LATERAL_CLICK("\u01c1", "\u01c1"),
// </editor-fold>
// <editor-fold desc="Vowels">
// close
FRONT_CLOSE("\u0069", "\u0079"),
CENTRAL_CLOSE("\u0268", "\u0289"),
BACK_CLOSE("\u026f", "\u0075"),
// near close
NEAR_FRONT_NEAR_CLOSE("\u026a", "\u028f"),
CENTRAL_NEAR_CLOSE("\u026a\u0308", "\u028a\u0308"),
NEAR_BACK_NEAR_CLOSE(null, "\u028a"),
// close mid
FRONT_CLOSE_MID("\u0065", "\u00f8"),
CENTRAL_CLOSE_MID("\u0258", "\u0275"),
BACK_CLOSE_MID("\u0264", "\u006f"),
// mid
CENTRAL_MID("\u0259", "\u0259"),
// open mid
FRONT_OPEN_MID("\u025b", "\u0153"),
CENTRAL_OPEN_MID("\u025c", "\u025e"),
BACK_OPEN_MID("\u028c", "\u0254"),
// near open
FRONT_NEAR_OPEN("\u00e6", "\u02e6"),
CENTRAL_NEAR_OPEN("\u0250", "\u0250"),
// open
FRONT_OPEN("\u0061", "\u0276"),
BACK_OPEN("\u0251", "\u0252"),
VOWEL_LENGTH_MARKER("\u02d0", "\u02d0"),
// </editor-fold>
;
private String v;
private String uv;
private IPANameParts[] parts;
private IPANames(String symbol, IPANameParts... ipaparts) {
v = symbol;
uv = null;
parts = ipaparts;
}
private IPANames(String voiced, String unvoiced, IPANameParts... ipaparts) {
v = voiced;
uv = unvoiced;
if ( parts == null ) {
ArrayList<IPANameParts> list = new ArrayList<>();
IPANameParts ip;
String[] pt = toString().split("_");
for ( String s : pt ) {
switch ( s ) {
case "LABIODENTAL":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.DENTAL);
break;
case "LABIALPALATAL":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.PALATAL);
break;
case "ALVEOLOPALATAL":
list.add(IPANameParts.ALVEOLAR);
list.add(IPANameParts.PALATAL);
break;
case "LABIALVELAR":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.VELAR);
break;
default:
try {
ip = IPANameParts.valueOf(s);
if ( ip != null ) { list.add(ip); }
}
catch ( IllegalArgumentException ex ) {}
}
}
LogManager.getLogger().warn(toString());
if ( !list.isEmpty() ) { parts = list.toArray(new IPANameParts[list.size()]); }
}
else { parts = ipaparts; }
}
public boolean hasLeft() { return (v != null); }
public boolean hasRight() { return (uv != null); }
public boolean hasVoiced() { return hasLeft(); }
public boolean hasUnvoiced() { return hasRight(); }
public boolean hasUnrounded() { return hasLeft(); }
public boolean hasRounded() { return hasRight(); }
public boolean hasBoth() {
if ( hasLeft() != hasRight() ) { return false; }
if ( hasLeft() && hasRight() ) { return true; }
return false;
}
public boolean isBoth() {
if ( hasLeft() != hasRight() ) { return false; }
if ( hasLeft() && hasRight() ) {
if ( v.equals(uv) ) { return true; }
}
return false;
}
public String getLeft() { return v; }
public String getRight() { return uv; }
public String getVoiced() { return v; }
public String getUnvoiced() { return uv; }
public String getUnrounded() { return v; }
public String getRounded() { return uv; }
public IPANameParts[] getNameParts() { return parts; }
}
package me.felinewith.lang_toolkit.plugins.ipa_helper;
import java.util.ArrayList;
import org.apache.logging.log4j.LogManager;
/**
*
* @author jlhawkwell
*/
public enum UnicodeNames {
// <editor-fold desc="Diacritics">
NON_VOICED("\u02f3", "\u0325"),
VOICED("\u02ec", "\u032c"),
ASPIRATED("\u02b0"),
MORE_ROUNDED(null, "\u0339"),
LESS_ROUNDED(null, "\u031c"),
ADVANCED("\u02d6", "\u031f"),
RETRACTED("\u02cd", "\u0320"),
CENTRALIZED(null, "\u0308"),
MID_CENTRALIZED("\u02df", "\u033d"),
SYLLABIC("\u02cc", "\u0329"),
NON_SYLLABIC(null, "\uu032f"),
RHOTICITY("\u02de"),
BREATHY_VOICED(null, "\u0324"),
CREAKY_VOICED("\u02f7", "\u0330"),
LINGUOLABIAL("\u02b7"),
PALATALIZED("\u02b2"),
VELARIZED("\u02e0"),
PHARYNGEALIZED("\u02e4"),
VELARIZED_PHARYNGEALIZED(null, "\u0334"),
RAISED("\u02d4", "\u031d"),
LOWERED("\u02d5", "\u031e"),
ADVANCED_TONGUEROOT(null, "\u0318"),
RETRACTED_TONGUEROOT(null, "\u0319"),
DENTAL(null, "\u032a"),
APICAL("\u02fd", "\u033a"),
LAMINAL(null, "\u033b"),
NASALIZED(null, "\u0303"),
NASAL_RELEASE("\u207f"),
LATERAL_RELEASE("\u02e1"),
NOAUDIBLERELEASE("\u02fa", "\u031a")
// </editor-fold>
;
private String m;
private String c;
private IPANameParts[] parts;
private UnicodeNames(String modifier, IPANameParts... ipaparts) {
m = modifier;
c = null;
parts = ipaparts;
}
private UnicodeNames(String modifier, String combining, IPANameParts... ipaparts) {
m = modifier;
c = combining;
if ( parts == null ) {
ArrayList<IPANameParts> list = new ArrayList<>();
IPANameParts ip;
String[] pt = toString().split("_");
for ( String s : pt ) {
switch ( s ) {
case "LABIODENTAL":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.DENTAL);
break;
case "LABIALPALATAL":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.PALATAL);
break;
case "ALVEOLOPALATAL":
list.add(IPANameParts.ALVEOLAR);
list.add(IPANameParts.PALATAL);
break;
case "LABIALVELAR":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.VELAR);
break;
default:
try {
ip = IPANameParts.valueOf(s);
if ( ip != null ) { list.add(ip); }
}
catch ( IllegalArgumentException ex ) {}
}
}
LogManager.getLogger().warn(toString());
if ( !list.isEmpty() ) { parts = list.toArray(new IPANameParts[list.size()]); }
}
else { parts = ipaparts; }
}
public boolean hasModifier() { return (m != null);}
public boolean hasCombining() { return (c != null); }
public boolean hasBoth() {
if ( hasModifier()!= hasCombining()) { return false; }
if ( hasModifier()&& hasCombining()) {
if ( m.equals(c) ) { return true; }
}
return false;
}
public String getModifier() { return m; }
public String getCombining() { return c; }
public IPANameParts[] getFunction() { return parts; }
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!