indicim

16:36:52.933 INFO  jd.cli.Main - Decompiling indicim.jar
package com.sun.inputmethods.internal.indicim;

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 DevanagariInputMethodDescriptor
  implements InputMethodDescriptor
{
  static final Locale HINDI = new Locale("hi", "IN");
  
  public Locale[] getAvailableLocales()
  {
    return new Locale[] { HINDI };
  }
  
  public boolean hasDynamicLocaleList()
  {
    return false;
  }
  
  public synchronized String getInputMethodDisplayName(Locale paramLocale1, Locale paramLocale2)
  {
    try
    {
      ResourceBundle localResourceBundle = ResourceBundle.getBundle("com.sun.inputmethods.internal.indicim.resources.DisplayNames", paramLocale2);
      return localResourceBundle.getString("DisplayName.Devanagari");
    }
    catch (MissingResourceException localMissingResourceException) {}
    return "Devanagari Input Method";
  }
  
  public Image getInputMethodIcon(Locale paramLocale)
  {
    return null;
  }
  
  public InputMethod createInputMethod()
    throws Exception
  {
    IndicInputMethodImpl localIndicInputMethodImpl = new IndicInputMethodImpl(DevanagariTables.keyboardMap, DevanagariTables.joinWithNukta, DevanagariTables.nuktaForm, DevanagariTables.substitutionTable);
    
    return new IndicInputMethod(HINDI, localIndicInputMethodImpl);
  }
  
  public String toString()
  {
    return getClass().getName();
  }
}

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

class DevanagariTables
{
  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', ' ', '?', '?', 65280, 65281, 65282, 65284, '?', '(', ')', 65285, '?', ',', '-', '.', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 65283, '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '' };
  static final char[] RA_SUB = { '?', '?' };
  static final char[] RA_SUP = { '?', '?' };
  static final char[] CONJ_JA_NYA = { '?', '?', '?' };
  static final char[] CONJ_TA_RA = { '?', '?', '?' };
  static final char[] CONJ_KA_SSA = { '?', '?', '?' };
  static final char[] CONJ_SHA_RA = { '?', '?', '?' };
  static final char[][] substitutionTable = { RA_SUB, RA_SUP, CONJ_JA_NYA, CONJ_TA_RA, CONJ_KA_SSA, CONJ_SHA_RA };
  static final char SIGN_CANDRABINDU = '?';
  static final char LETTER_I = '?';
  static final char LETTER_II = '?';
  static final char LETTER_VOCALIC_R = '?';
  static final char LETTER_KA = '?';
  static final char LETTER_KHA = '?';
  static final char LETTER_GA = '?';
  static final char LETTER_JA = '?';
  static final char LETTER_DDA = '?';
  static final char LETTER_DDHA = '?';
  static final char LETTER_PHA = '?';
  static final char VOWEL_SIGN_I = '?';
  static final char VOWEL_SIGN_II = '?';
  static final char VOWEL_SIGN_VOCALIC_R = '?';
  static final char DANDA = '?';
  static final char SIGN_OM = '?';
  static final char LETTER_VOCALIC_L = '?';
  static final char LETTER_VOCALIC_LL = '?';
  static final char LETTER_VOCALIC_RR = '?';
  static final char LETTER_QA = '?';
  static final char LETTER_KHHA = '?';
  static final char LETTER_GHHA = '?';
  static final char LETTER_ZA = '?';
  static final char LETTER_DDDHA = '?';
  static final char LETTER_RHA = '?';
  static final char LETTER_FA = '?';
  static final char VOWEL_SIGN_VOCALIC_L = '?';
  static final char VOWEL_SIGN_VOCALIC_LL = '?';
  static final char VOWEL_SIGN_VOCALIC_RR = '?';
  static final char SIGN_AVAGRAHA = '?';
  static final char[] joinWithNukta = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?' };
  static final char[] nuktaForm = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?' };
}

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

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 IndicInputMethod
  implements InputMethod
{
  private IndicInputMethodImpl impl;
  private Locale locale;
  
  IndicInputMethod(Locale paramLocale, IndicInputMethodImpl paramIndicInputMethodImpl)
  {
    locale = paramLocale;
    impl = paramIndicInputMethodImpl;
  }
  
  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.indicim.IndicInputMethod
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.inputmethods.internal.indicim;

import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;

class IndicInputMethodImpl$ACIText
  implements AttributedCharacterIterator
{
  private char[] text = null;
  private int committed = 0;
  private int index = 0;
  
  IndicInputMethodImpl$ACIText(IndicInputMethodImpl paramIndicInputMethodImpl, char[] paramArrayOfChar, int paramInt1, int paramInt2, int paramInt3)
  {
    text = new char[paramInt2];
    committed = paramInt3;
    System.arraycopy(paramArrayOfChar, paramInt1, text, 0, paramInt2);
  }
  
  public char first()
  {
    return _setIndex(0);
  }
  
  public char last()
  {
    if (text.length == 0) {
      return _setIndex(text.length);
    }
    return _setIndex(text.length - 1);
  }
  
  public char current()
  {
    if (index == text.length) {
      return 65535;
    }
    return text[index];
  }
  
  public char next()
  {
    if (index == text.length) {
      return 65535;
    }
    return _setIndex(index + 1);
  }
  
  public char previous()
  {
    if (index == 0) {
      return 65535;
    }
    return _setIndex(index - 1);
  }
  
  public char setIndex(int paramInt)
  {
    if ((paramInt < 0) || (paramInt > text.length)) {
      throw new IllegalArgumentException();
    }
    return _setIndex(paramInt);
  }
  
  public int getBeginIndex()
  {
    return 0;
  }
  
  public int getEndIndex()
  {
    return text.length;
  }
  
  public int getIndex()
  {
    return index;
  }
  
  public Object clone()
  {
    try
    {
      return (ACIText)super.clone();
    }
    catch (CloneNotSupportedException localCloneNotSupportedException)
    {
      throw new InternalError();
    }
  }
  
  public int getRunStart()
  {
    return index >= committed ? committed : 0;
  }
  
  public int getRunStart(AttributedCharacterIterator.Attribute paramAttribute)
  {
    return (index >= committed) && (paramAttribute == TextAttribute.INPUT_METHOD_UNDERLINE) ? committed : 0;
  }
  
  public int getRunStart(Set<? extends AttributedCharacterIterator.Attribute> paramSet)
  {
    return (index >= committed) && (paramSet.contains(TextAttribute.INPUT_METHOD_UNDERLINE)) ? committed : 0;
  }
  
  public int getRunLimit()
  {
    return index < committed ? committed : text.length;
  }
  
  public int getRunLimit(AttributedCharacterIterator.Attribute paramAttribute)
  {
    return (index < committed) && (paramAttribute == TextAttribute.INPUT_METHOD_UNDERLINE) ? committed : text.length;
  }
  
  public int getRunLimit(Set<? extends AttributedCharacterIterator.Attribute> paramSet)
  {
    return (index < committed) && (paramSet.contains(TextAttribute.INPUT_METHOD_UNDERLINE)) ? committed : text.length;
  }
  
  public Map getAttributes()
  {
    Hashtable localHashtable = new Hashtable();
    if ((index >= committed) && (committed < text.length)) {
      localHashtable.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
    }
    return localHashtable;
  }
  
  public Object getAttribute(AttributedCharacterIterator.Attribute paramAttribute)
  {
    if ((index >= committed) && (committed < text.length) && (paramAttribute == TextAttribute.INPUT_METHOD_UNDERLINE)) {
      return TextAttribute.UNDERLINE_LOW_ONE_PIXEL;
    }
    return null;
  }
  
  public Set getAllAttributeKeys()
  {
    HashSet localHashSet = new HashSet();
    if (committed < text.length) {
      localHashSet.add(TextAttribute.INPUT_METHOD_UNDERLINE);
    }
    return localHashSet;
  }
  
  private char _setIndex(int paramInt)
  {
    index = paramInt;
    if (paramInt == text.length) {
      return 65535;
    }
    return text[paramInt];
  }
}

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

import java.awt.event.KeyEvent;
import java.awt.font.TextAttribute;
import java.awt.font.TextHitInfo;
import java.awt.im.spi.InputMethodContext;
import java.text.AttributedCharacterIterator;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;

class IndicInputMethodImpl
{
  protected char[] KBD_MAP;
  private static final char SUBSTITUTION_BASE = '?';
  protected char[][] SUBSTITUTION_TABLE;
  private static final char INVALID_CHAR = '?';
  private static final char KEY_SIGN_VIRAMA = 'd';
  private static final char KEY_SIGN_NUKTA = ']';
  private static final char ZWJ = '?';
  private static final char ZWNJ = '?';
  private static final char BACKSPACE = '\b';
  protected char[] JOIN_WITH_NUKTA;
  protected char[] NUKTA_FORM;
  private int log2;
  private int power;
  private int extra;
  private static final TextHitInfo ZERO_TRAILING_HIT_INFO = TextHitInfo.trailing(0);
  
  private int nuktaIndex(char paramChar)
  {
    if (JOIN_WITH_NUKTA == null) {
      return -1;
    }
    int i = power;
    int j = 0;
    if (JOIN_WITH_NUKTA[extra] <= paramChar) {
      j = extra;
    }
    while (i > 1)
    {
      i >>= 1;
      if (JOIN_WITH_NUKTA[(j + i)] <= paramChar) {
        j += i;
      }
    }
    if (JOIN_WITH_NUKTA[j] != paramChar) {
      j = -1;
    }
    return j;
  }
  
  private char getMappedChar(char paramChar)
  {
    if (paramChar <= KBD_MAP.length) {
      return KBD_MAP[paramChar];
    }
    return paramChar;
  }
  
  private char[] text = new char[4];
  private int committedChars = 0;
  private int totalChars = 0;
  private boolean lastCharWasVirama = false;
  private InputMethodContext context;
  
  private static byte highBit(int paramInt)
  {
    if (paramInt <= 0) {
      return -32;
    }
    byte b = 0;
    if (paramInt >= 65536)
    {
      paramInt >>= 16;
      b = (byte)(b + 16);
    }
    if (paramInt >= 256)
    {
      paramInt >>= 8;
      b = (byte)(b + 8);
    }
    if (paramInt >= 16)
    {
      paramInt >>= 4;
      b = (byte)(b + 4);
    }
    if (paramInt >= 4)
    {
      paramInt >>= 2;
      b = (byte)(b + 2);
    }
    if (paramInt >= 2)
    {
      paramInt >>= 1;
      b = (byte)(b + 1);
    }
    return b;
  }
  
  IndicInputMethodImpl(char[] paramArrayOfChar1, char[] paramArrayOfChar2, char[] paramArrayOfChar3, char[][] paramArrayOfChar)
  {
    KBD_MAP = paramArrayOfChar1;
    JOIN_WITH_NUKTA = paramArrayOfChar2;
    NUKTA_FORM = paramArrayOfChar3;
    SUBSTITUTION_TABLE = paramArrayOfChar;
    if (JOIN_WITH_NUKTA != null)
    {
      int i = highBit(JOIN_WITH_NUKTA.length);
      
      power = (1 << i);
      extra = (JOIN_WITH_NUKTA.length - power);
    }
    else
    {
      power = (extra = 0);
    }
  }
  
  void setInputMethodContext(InputMethodContext paramInputMethodContext)
  {
    context = paramInputMethodContext;
  }
  
  void handleKeyTyped(KeyEvent paramKeyEvent)
  {
    char c = paramKeyEvent.getKeyChar();
    int i = getMappedChar(c);
    if (lastCharWasVirama) {
      switch (c)
      {
      case ']': 
        i = 8205;
        break;
      case 'd': 
        i = 8204;
        break;
      }
    }
    if (i == 65535)
    {
      paramKeyEvent.consume();
      return;
    }
    if (i == 8)
    {
      lastCharWasVirama = false;
      if (totalChars > 0) {
        totalChars = (committedChars = 0);
      }
    }
    else
    {
      int j;
      if (c == ']')
      {
        j = nuktaIndex(text[0]);
        if (j != -1) {
          text[0] = NUKTA_FORM[j];
        } else {
          text[(totalChars++)] = i;
        }
        committedChars += 1;
      }
      else
      {
        j = nuktaIndex(i);
        if (j != -1)
        {
          text[(totalChars++)] = i;
          committedChars = (totalChars - 1);
        }
        else
        {
          if (i >= 65280)
          {
            char[] arrayOfChar = SUBSTITUTION_TABLE[(i - 65280)];
            
            System.arraycopy(arrayOfChar, 0, text, totalChars, arrayOfChar.length);
            totalChars += arrayOfChar.length;
          }
          else
          {
            text[(totalChars++)] = i;
          }
          committedChars = totalChars;
        }
      }
    }
    ACIText localACIText = new ACIText(text, 0, totalChars, committedChars);
    int k = totalChars - committedChars;
    TextHitInfo localTextHitInfo1 = null;TextHitInfo localTextHitInfo2 = null;
    switch (k)
    {
    case 0: 
      break;
    case 1: 
      localTextHitInfo2 = localTextHitInfo1 = ZERO_TRAILING_HIT_INFO;
      break;
    default: 
      if (!$assertionsDisabled) {
        throw new AssertionError("The code should not reach here. There is no case where there can be more than one character pending.");
      }
      break;
    }
    context.dispatchInputMethodEvent(1100, localACIText, committedChars, localTextHitInfo1, localTextHitInfo2);
    if (totalChars == 0) {
      text[0] = 65535;
    } else {
      text[0] = text[(totalChars - 1)];
    }
    lastCharWasVirama = ((c == 'd') && (!lastCharWasVirama));
    
    totalChars -= committedChars;
    committedChars = 0;
    
    paramKeyEvent.consume();
  }
  
  void endComposition()
  {
    if (totalChars != 0)
    {
      ACIText localACIText = new ACIText(text, 0, totalChars, totalChars);
      context.dispatchInputMethodEvent(1100, localACIText, totalChars, null, null);
      
      totalChars = (committedChars = 0);
      text[0] = 65535;
      lastCharWasVirama = false;
    }
  }
  
  private class ACIText
    implements AttributedCharacterIterator
  {
    private char[] text = null;
    private int committed = 0;
    private int index = 0;
    
    ACIText(char[] paramArrayOfChar, int paramInt1, int paramInt2, int paramInt3)
    {
      text = new char[paramInt2];
      committed = paramInt3;
      System.arraycopy(paramArrayOfChar, paramInt1, text, 0, paramInt2);
    }
    
    public char first()
    {
      return _setIndex(0);
    }
    
    public char last()
    {
      if (text.length == 0) {
        return _setIndex(text.length);
      }
      return _setIndex(text.length - 1);
    }
    
    public char current()
    {
      if (index == text.length) {
        return 65535;
      }
      return text[index];
    }
    
    public char next()
    {
      if (index == text.length) {
        return 65535;
      }
      return _setIndex(index + 1);
    }
    
    public char previous()
    {
      if (index == 0) {
        return 65535;
      }
      return _setIndex(index - 1);
    }
    
    public char setIndex(int paramInt)
    {
      if ((paramInt < 0) || (paramInt > text.length)) {
        throw new IllegalArgumentException();
      }
      return _setIndex(paramInt);
    }
    
    public int getBeginIndex()
    {
      return 0;
    }
    
    public int getEndIndex()
    {
      return text.length;
    }
    
    public int getIndex()
    {
      return index;
    }
    
    public Object clone()
    {
      try
      {
        return (ACIText)super.clone();
      }
      catch (CloneNotSupportedException localCloneNotSupportedException)
      {
        throw new InternalError();
      }
    }
    
    public int getRunStart()
    {
      return index >= committed ? committed : 0;
    }
    
    public int getRunStart(AttributedCharacterIterator.Attribute paramAttribute)
    {
      return (index >= committed) && (paramAttribute == TextAttribute.INPUT_METHOD_UNDERLINE) ? committed : 0;
    }
    
    public int getRunStart(Set<? extends AttributedCharacterIterator.Attribute> paramSet)
    {
      return (index >= committed) && (paramSet.contains(TextAttribute.INPUT_METHOD_UNDERLINE)) ? committed : 0;
    }
    
    public int getRunLimit()
    {
      return index < committed ? committed : text.length;
    }
    
    public int getRunLimit(AttributedCharacterIterator.Attribute paramAttribute)
    {
      return (index < committed) && (paramAttribute == TextAttribute.INPUT_METHOD_UNDERLINE) ? committed : text.length;
    }
    
    public int getRunLimit(Set<? extends AttributedCharacterIterator.Attribute> paramSet)
    {
      return (index < committed) && (paramSet.contains(TextAttribute.INPUT_METHOD_UNDERLINE)) ? committed : text.length;
    }
    
    public Map getAttributes()
    {
      Hashtable localHashtable = new Hashtable();
      if ((index >= committed) && (committed < text.length)) {
        localHashtable.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
      }
      return localHashtable;
    }
    
    public Object getAttribute(AttributedCharacterIterator.Attribute paramAttribute)
    {
      if ((index >= committed) && (committed < text.length) && (paramAttribute == TextAttribute.INPUT_METHOD_UNDERLINE)) {
        return TextAttribute.UNDERLINE_LOW_ONE_PIXEL;
      }
      return null;
    }
    
    public Set getAllAttributeKeys()
    {
      HashSet localHashSet = new HashSet();
      if (committed < text.length) {
        localHashSet.add(TextAttribute.INPUT_METHOD_UNDERLINE);
      }
      return localHashSet;
    }
    
    private char _setIndex(int paramInt)
    {
      index = paramInt;
      if (paramInt == text.length) {
        return 65535;
      }
      return text[paramInt];
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.inputmethods.internal.indicim.IndicInputMethodImpl
 * 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