thaiim

16:53:27.890 INFO  jd.cli.Main - Decompiling thaiim.jar
package com.sun.inputmethods.internal.thaiim;

import java.awt.AWTEvent;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.awt.im.spi.InputMethod;
import java.awt.im.spi.InputMethodContext;
import java.util.Locale;

class ThaiInputMethod
  implements InputMethod
{
  private ThaiInputMethodImpl impl;
  private Locale locale;
  
  ThaiInputMethod(Locale paramLocale, ThaiInputMethodImpl paramThaiInputMethodImpl)
  {
    locale = paramLocale;
    impl = paramThaiInputMethodImpl;
  }
  
  public void setInputMethodContext(InputMethodContext paramInputMethodContext)
  {
    impl.setInputMethodContext(paramInputMethodContext);
  }
  
  public boolean setLocale(Locale paramLocale)
  {
    if (paramLocale.getLanguage().equals(locale.getLanguage())) {
      return true;
    }
    return false;
  }
  
  public Locale getLocale()
  {
    return locale;
  }
  
  public void setCharacterSubsets(Character.Subset[] paramArrayOfSubset) {}
  
  public void setCompositionEnabled(boolean paramBoolean)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean isCompositionEnabled()
  {
    return true;
  }
  
  public void reconvert()
  {
    throw new UnsupportedOperationException("This input method does not reconvert.");
  }
  
  public void dispatchEvent(AWTEvent paramAWTEvent)
  {
    if ((paramAWTEvent instanceof KeyEvent))
    {
      KeyEvent localKeyEvent = (KeyEvent)paramAWTEvent;
      if (paramAWTEvent.getID() == 400) {
        impl.handleKeyTyped(localKeyEvent);
      }
    }
  }
  
  public void notifyClientWindowChange(Rectangle paramRectangle) {}
  
  public void activate() {}
  
  public void deactivate(boolean paramBoolean) {}
  
  public void hideWindows() {}
  
  public void removeNotify() {}
  
  public void endComposition()
  {
    impl.endComposition();
  }
  
  public void dispose() {}
  
  public Object getControlObject()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     com.sun.inputmethods.internal.thaiim.ThaiInputMethod
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.inputmethods.internal.thaiim;

import java.awt.Image;
import java.awt.im.spi.InputMethod;
import java.awt.im.spi.InputMethodDescriptor;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class ThaiInputMethodDescriptor
  implements InputMethodDescriptor
{
  static final Locale THAI = new Locale("th");
  
  public Locale[] getAvailableLocales()
  {
    return new Locale[] { THAI };
  }
  
  public boolean hasDynamicLocaleList()
  {
    return false;
  }
  
  public synchronized String getInputMethodDisplayName(Locale paramLocale1, Locale paramLocale2)
  {
    try
    {
      ResourceBundle localResourceBundle = ResourceBundle.getBundle("com.sun.inputmethods.internal.thaiim.resources.DisplayNames", paramLocale2);
      
      return localResourceBundle.getString("DisplayName.Thai");
    }
    catch (MissingResourceException localMissingResourceException) {}
    return "Thai Input Method";
  }
  
  public Image getInputMethodIcon(Locale paramLocale)
  {
    return null;
  }
  
  public InputMethod createInputMethod()
    throws Exception
  {
    ThaiInputMethodImpl localThaiInputMethodImpl = new ThaiInputMethodImpl();
    return new ThaiInputMethod(THAI, localThaiInputMethodImpl);
  }
  
  public String toString()
  {
    return getClass().getName();
  }
}

/* Location:
 * Qualified Name:     com.sun.inputmethods.internal.thaiim.ThaiInputMethodDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.inputmethods.internal.thaiim;

import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.awt.font.TextHitInfo;
import java.awt.im.spi.InputMethodContext;
import java.text.AttributedString;

class ThaiInputMethodImpl
{
  private static final char[] keyboardMap = { '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', ' ', '?', '.', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '/', '-', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '"', ')', '?', '(', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', ',', '?', '' };
  private static final TextHitInfo ZERO_TRAILING_HIT_INFO = TextHitInfo.trailing(0);
  private ThaiRules rules;
  private InputMethodContext context;
  
  private char getMappedChar(char paramChar)
  {
    if (paramChar <= keyboardMap.length) {
      return keyboardMap[paramChar];
    }
    return paramChar;
  }
  
  void setInputMethodContext(InputMethodContext paramInputMethodContext)
  {
    context = paramInputMethodContext;
    rules = new ThaiRules(paramInputMethodContext);
  }
  
  void handleKeyTyped(KeyEvent paramKeyEvent)
  {
    char c1 = paramKeyEvent.getKeyChar();
    char c2 = getMappedChar(c1);
    if (!Character.UnicodeBlock.THAI.equals(Character.UnicodeBlock.of(c2))) {
      return;
    }
    if (rules.isInputValid(c2))
    {
      Character localCharacter = new Character(c2);
      String str = localCharacter.toString();
      context.dispatchInputMethodEvent(1100, new AttributedString(str).getIterator(), 1, ZERO_TRAILING_HIT_INFO, ZERO_TRAILING_HIT_INFO);
    }
    else
    {
      Toolkit.getDefaultToolkit().beep();
    }
    paramKeyEvent.consume();
  }
  
  void endComposition() {}
}

/* Location:
 * Qualified Name:     com.sun.inputmethods.internal.thaiim.ThaiInputMethodImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.inputmethods.internal.thaiim;

import java.awt.im.InputMethodRequests;
import java.text.AttributedCharacterIterator;

public class ThaiRules
{
  public static final char BASE = '?';
  public static final byte NON = 0;
  public static final byte CONS = 1;
  public static final byte LV = 2;
  public static final byte FV1 = 3;
  public static final byte FV2 = 4;
  public static final byte FV3 = 5;
  public static final byte FV4 = 6;
  public static final byte BV1 = 7;
  public static final byte BV2 = 8;
  public static final byte BD = 9;
  public static final byte TONE = 10;
  public static final byte AD1 = 11;
  public static final byte AD2 = 12;
  public static final byte AD3 = 13;
  public static final byte AV1 = 14;
  public static final byte AV2 = 15;
  public static final byte AV3 = 16;
  public static final byte STRICT = 0;
  public static final byte LOOSE = 1;
  public static final byte NOREPLACE = 2;
  public static final byte[] CHARTYPE = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 15, 3, 6, 14, 16, 15, 16, 7, 8, 9, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 4, 0, 12, 10, 10, 10, 10, 11, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  private InputMethodRequests requests;
  
  ThaiRules(InputMethodRequests paramInputMethodRequests)
  {
    requests = paramInputMethodRequests;
  }
  
  public static byte getCharType(char paramChar)
  {
    int i = paramChar - '?';
    byte b;
    if ((i < 0) || (i >= CHARTYPE.length)) {
      b = 0;
    } else {
      b = CHARTYPE[i];
    }
    return b;
  }
  
  private static boolean isValid(char paramChar1, char paramChar2, int[] paramArrayOfInt)
  {
    return (paramArrayOfInt[getCharType(paramChar1)] & 1 << getCharType(paramChar2)) != 0;
  }
  
  private static final int[] INPUTVALIDITY = { 39, 131071, 2, 39, 39, 55, 39, 3111, 1063, 39, 111, 39, 39, 39, 3111, 1063, 9255 };
  private static final int[] COMPOSABLE = { 0, 131008, 0, 0, 0, 0, 0, 3072, 1024, 0, 64, 0, 0, 0, 3072, 1024, 9216 };
  private static final int[] REPLACABLE = { 0, 0, 0, 0, 0, 0, 129472, 127936, 129984, 131008, 15872, 114496, 131008, 65472, 127936, 129984, 121792 };
  private static final int[] SWAPPABLE = { 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0, 115072, 16512, 0, 65536, 0, 0, 0 };
  
  public static boolean isInputValid(char paramChar1, char paramChar2)
  {
    return isValid(paramChar1, paramChar2, INPUTVALIDITY);
  }
  
  public static boolean isComposable(char paramChar1, char paramChar2)
  {
    return isValid(paramChar1, paramChar2, COMPOSABLE);
  }
  
  public static boolean isSwappable(char paramChar1, char paramChar2)
  {
    return isValid(paramChar1, paramChar2, SWAPPABLE);
  }
  
  public static boolean isReplacable(char paramChar1, char paramChar2)
  {
    return isValid(paramChar1, paramChar2, REPLACABLE);
  }
  
  public static boolean isForward(char paramChar)
  {
    return getCharType(paramChar) < 6;
  }
  
  public static boolean isDead(char paramChar)
  {
    return getCharType(paramChar) > 5;
  }
  
  public boolean isInputValid(char paramChar)
  {
    int i = requests.getInsertPositionOffset();
    if (i == 0)
    {
      j = getCharType(paramChar);
      return (j < 3) || (j == 5);
    }
    int j = requests.getCommittedText(i - 1, i, null).first();
    if (isForward(paramChar))
    {
      if (isInputValid(j, paramChar))
      {
        if ((getCharType(j) == 10) && (getCharType(paramChar) == 3))
        {
          if (i == 1) {
            return true;
          }
          char c = requests.getCommittedText(i - 2, i - 1, null).first();
          
          return isInputValid(c, paramChar);
        }
        return true;
      }
      if ((j == 3634) && (paramChar == '?')) {
        return true;
      }
      if ((j == 3661) && (paramChar == '?')) {
        return true;
      }
      return false;
    }
    if (isInputValid(j, paramChar))
    {
      if ((getCharType(j) == 10) && (getCharType(paramChar) == 6)) {
        return i != 1;
      }
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     com.sun.inputmethods.internal.thaiim.ThaiRules
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd