home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / sun / awt / im / InputMethodLocator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.9 KB  |  100 lines

  1. package sun.awt.im;
  2.  
  3. import java.awt.AWTException;
  4. import java.awt.im.spi.InputMethodDescriptor;
  5. import java.util.Locale;
  6.  
  7. final class InputMethodLocator {
  8.    private InputMethodDescriptor descriptor;
  9.    private ClassLoader loader;
  10.    private Locale locale;
  11.  
  12.    InputMethodLocator(InputMethodDescriptor var1, ClassLoader var2, Locale var3) {
  13.       if (var1 == null) {
  14.          throw new NullPointerException("descriptor can't be null");
  15.       } else {
  16.          this.descriptor = var1;
  17.          this.loader = var2;
  18.          this.locale = var3;
  19.       }
  20.    }
  21.  
  22.    public boolean equals(Object var1) {
  23.       if (var1 == this) {
  24.          return true;
  25.       } else if (var1 != null && this.getClass() == var1.getClass()) {
  26.          InputMethodLocator var2 = (InputMethodLocator)var1;
  27.          if (!this.descriptor.getClass().equals(var2.descriptor.getClass())) {
  28.             return false;
  29.          } else if ((this.loader != null || var2.loader == null) && (this.loader == null || this.loader.equals(var2.loader))) {
  30.             return (this.locale != null || var2.locale == null) && (this.locale == null || this.locale.equals(var2.locale));
  31.          } else {
  32.             return false;
  33.          }
  34.       } else {
  35.          return false;
  36.       }
  37.    }
  38.  
  39.    public int hashCode() {
  40.       int var1 = this.descriptor.hashCode();
  41.       if (this.loader != null) {
  42.          var1 |= this.loader.hashCode() << 10;
  43.       }
  44.  
  45.       if (this.locale != null) {
  46.          var1 |= this.locale.hashCode() << 20;
  47.       }
  48.  
  49.       return var1;
  50.    }
  51.  
  52.    InputMethodDescriptor getDescriptor() {
  53.       return this.descriptor;
  54.    }
  55.  
  56.    ClassLoader getClassLoader() {
  57.       return this.loader;
  58.    }
  59.  
  60.    Locale getLocale() {
  61.       return this.locale;
  62.    }
  63.  
  64.    boolean isLocaleAvailable(Locale var1) {
  65.       try {
  66.          Locale[] var2 = this.descriptor.getAvailableLocales();
  67.  
  68.          for(int var3 = 0; var3 < var2.length; ++var3) {
  69.             if (var2[var3].equals(var1)) {
  70.                return true;
  71.             }
  72.          }
  73.       } catch (AWTException var4) {
  74.       }
  75.  
  76.       return false;
  77.    }
  78.  
  79.    InputMethodLocator deriveLocator(Locale var1) {
  80.       return var1 == this.locale ? this : new InputMethodLocator(this.descriptor, this.loader, var1);
  81.    }
  82.  
  83.    boolean sameInputMethod(InputMethodLocator var1) {
  84.       if (var1 == this) {
  85.          return true;
  86.       } else if (var1 == null) {
  87.          return false;
  88.       } else if (!this.descriptor.getClass().equals(var1.descriptor.getClass())) {
  89.          return false;
  90.       } else {
  91.          return (this.loader != null || var1.loader == null) && (this.loader == null || this.loader.equals(var1.loader));
  92.       }
  93.    }
  94.  
  95.    String getActionCommandString() {
  96.       String var1 = this.descriptor.getClass().getName();
  97.       return this.locale == null ? var1 : var1 + "\n" + this.locale.toString();
  98.    }
  99. }
  100.