package com.thaiopensource.xml.dtd;

class Atom {
  private int tokenType;
  private String token;
  private Entity entity;

  Atom(Entity entity) {
    this.entity = entity;
    this.tokenType = -1;
    this.token = null;
  }

  Atom(int tokenType, String token) {
    this.tokenType = tokenType;
    this.token = token;
  }

  final int getTokenType() {
    return tokenType;
  }

  final String getToken() {
    return token;
  }

  final Entity getEntity() {
    return entity;
  }

  void setEntity(Entity entity) {
    this.entity = entity;
  }

  public int hashCode() {
    return token.hashCode();
  }

  public boolean equals(Object obj) {
    if (obj == null || !(obj instanceof Atom))
      return false;
    Atom other = (Atom)obj;
    if (this.entity != null)
      return this.entity == other.entity;
    else
      return this.tokenType == other.tokenType && this.token.equals(other.token);
  }
}


@@ -53,16 +53,22 @@
 private 
+final 
 int toke
@@ -84,16 +84,22 @@
 private 
+final 
 String t
@@ -114,16 +114,22 @@
 private 
+final 
 Entity e
@@ -325,32 +325,196 @@
 .token = token;%0A
+    this.entity = null;%0A  %7D%0A%0A  Atom(int tokenType, String token, Entity entity) %7B%0A    this.tokenType = tokenType;%0A    this.token = token;%0A    this.entity = entity;%0A
   %7D%0A%0A  final int
@@ -634,24 +634,24 @@
 tEntity() %7B%0A
+
     return e
@@ -666,73 +666,8 @@
  %7D%0A%0A
-  void setEntity(Entity entity) %7B%0A    this.entity = entity;%0A  %7D%0A%0A
   pu

Make it immutable.