// Path: src/com/rcwang/seal/expand/Wrapper.java
// public static class EntityLiteral implements Comparable<EntityLiteral> {
//     public String arg1;
//     public String arg2;
//     public EntityLiteral(String arg1) { this.arg1=StringFactory.get(arg1); }
//     public EntityLiteral(String arg1, String arg2) { this(arg1); this.arg2 = StringFactory.get(arg2); }
//     public EntityLiteral(String ... names) {
//         if (names.length > 0) this.arg1=StringFactory.get(names[0]);
//         if (names.length > 1) this.arg2 = StringFactory.get(names[1]);
//         if (names.length > 2) log.warn("Attempt to create entity literal with more than two strings:" + names);
//     }
//   public String toString() { 
//         StringBuilder sb = new StringBuilder(arg1);
//         if (arg2!= null) sb.append(Entity.RELATION_SEPARATOR).append(arg2);
//         return sb.toString();
//     }
//   final public boolean equals(Object o) {
//       if (! (o instanceof EntityLiteral)) return false;
//       EntityLiteral e = (EntityLiteral) o;
//       return arg1 == e.arg1 && arg2 == e.arg2; 
//   }
//   final public int hashCode() { 
//       int a1 = arg1.hashCode();
//       if (arg2!=null) return a1 ^ arg2.hashCode();
//       return a1;
//   }
//   final public int compareTo(EntityLiteral e) {
//       return this.toString().compareTo(e.toString());
//   }
// }


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.rcwang.seal.expand.Wrapper.EntityLiteral;

      if (this == obj) return true;
      if (obj == null) return false;
      if (getClass() != obj.getClass()) return false;
      final SID other = (SID) obj;
      if (!Arrays.equals(array, other.array))
        return false;
      return true;
    }
    
    @Override
    public int hashCode() {
      return 31 + Arrays.hashCode(array);
    }
    
    public Iterator<String> iterator() {
      return Arrays.asList(array).iterator();
    }
    
    public int length() {
      int length = 0;
      for (String s : this)
        length += s.length();
      return length;
    }

    @Override
    public String toString() {
      return StringFactory.toName(this);
    }
    

// Path: src/com/rcwang/seal/expand/Wrapper.java
// public static class EntityLiteral implements Comparable<EntityLiteral> {
//     public String arg1;
//     public String arg2;
//     public EntityLiteral(String arg1) { this.arg1=StringFactory.get(arg1); }
//     public EntityLiteral(String arg1, String arg2) { this(arg1); this.arg2 = StringFactory.get(arg2); }
//     public EntityLiteral(String ... names) {
//         if (names.length > 0) this.arg1=StringFactory.get(names[0]);
//         if (names.length > 1) this.arg2 = StringFactory.get(names[1]);
//         if (names.length > 2) log.warn("Attempt to create entity literal with more than two strings:" + names);
//     }
//   public String toString() { 
//         StringBuilder sb = new StringBuilder(arg1);
//         if (arg2!= null) sb.append(Entity.RELATION_SEPARATOR).append(arg2);
//         return sb.toString();
//     }
//   final public boolean equals(Object o) {
//       if (! (o instanceof EntityLiteral)) return false;
//       EntityLiteral e = (EntityLiteral) o;
//       return arg1 == e.arg1 && arg2 == e.arg2; 
//   }
//   final public int hashCode() { 
//       int a1 = arg1.hashCode();
//       if (arg2!=null) return a1 ^ arg2.hashCode();
//       return a1;
//   }
//   final public int compareTo(EntityLiteral e) {
//       return this.toString().compareTo(e.toString());
//   }
// }


// Path: src/com/rcwang/seal/util/StringFactory.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.rcwang.seal.expand.Wrapper.EntityLiteral;

      if (this == obj) return true;
      if (obj == null) return false;
      if (getClass() != obj.getClass()) return false;
      final SID other = (SID) obj;
      if (!Arrays.equals(array, other.array))
        return false;
      return true;
    }
    
    @Override
    public int hashCode() {
      return 31 + Arrays.hashCode(array);
    }
    
    public Iterator<String> iterator() {
      return Arrays.asList(array).iterator();
    }
    
    public int length() {
      int length = 0;
      for (String s : this)
        length += s.length();
      return length;
    }

    @Override
    public String toString() {
      return StringFactory.toName(this);
    }
    

    public EntityLiteral toLiteral() { return new EntityLiteral(StringFactory.toName(this)); }
