// 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;

    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)); }
    
    public SID toLower() {
    	return StringFactory.toID(new EntityLiteral(StringFactory.toName(this).toLowerCase()));
    }
  }
  public static class RSID extends SID {
      int boundary;

      public RSID(List<String> strs) { super(strs); }
      public RSID(SID id) { super(id); }
      public RSID(String[] array) { super(array); }
      
      public RSID(SID a1, SID a2) {

// 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;

    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)); }
    
    public SID toLower() {
    	return StringFactory.toID(new EntityLiteral(StringFactory.toName(this).toLowerCase()));
    }
  }
  public static class RSID extends SID {
      int boundary;

      public RSID(List<String> strs) { super(strs); }
      public RSID(SID id) { super(id); }
      public RSID(String[] array) { super(array); }
      
      public RSID(SID a1, SID a2) {

          super(a1); 
