NiceKey.java

jmud-0.11/src/util/nice/NiceKey.java · 608 B

From the archive jmud-0_11.tgz

Download the archive   « Back to the archive contents

package util.nice;

public class NiceKey {
  public static final int K_INT = 0;
  public static final int K_STR = 1;

  private int    theType;
  private Object theKey;

  public NiceKey(int type, Object key) {
    theType = type;
    theKey  = key;
  }

  public NiceKey(int val) {
    theType = K_INT;
    theKey  = new Integer(val);
  }

  public NiceKey(String str) {
    theType = K_STR;
    theKey  = str;
  }

  public int getKeyType() {
    return theType;
  }

  public int getIntKey() {
    return ((Integer) theKey).intValue();
  }

  public String getStrKey() {
    return (String) theKey;
  }
}

Site Stats

Snippets: 1791
Codebases: 571