package net.zero918nobita.Xemime;

/**
 * 文字列クラス
 * @author Kodai Matsumoto
 */

class X_String extends X_Handler {
    private final String value;

    X_String(String str) {
        value = str;
    }

    @Override
    public String toString() {
        return value;
    }

    @Override
    public boolean equals(Object obj) {
        return (obj instanceof X_String) && (this.value.equals(obj.toString()));
    }

    @Override
    X_String add(X_Code obj) throws Exception {
        if (obj instanceof X_String) {
            return new X_String(this.value + ((X_String) obj).value);
        } else {
            throw new Exception("String型オブジェクトに他の型のオブジェクトを加算することはできません");
        }
    }
}

@@ -28,16 +28,45 @@
 emime;%0A%0A
+import java.util.ArrayList;%0A%0A
 /**%0A * %E6%96%87
@@ -219,16 +219,75 @@
  = str;%0A
+        setMember(new X_Symbol(%22length%22), new X_Length());%0A
     %7D%0A%0A 
@@ -689,16 +689,16 @@
  else %7B%0A
-
         
@@ -778,11 +778,287 @@
  %7D%0A    %7D
+%0A%0A    private class X_Length extends X_Native %7B%0A        X_Length() %7B%0A            super(1);%0A        %7D%0A%0A        @Override%0A        protected X_Int exec(ArrayList%3CX_Code%3E params) throws Exception %7B%0A            return new X_Int((params.get(0)).toString().length());%0A        %7D%0A    %7D
 %0A%7D%0A

Implement String.length()