package net.zero918nobita.Xemime;

/**
 * 二項演算子
 * @author Kodai Matsumoto
 */

class X_BinExpr extends X_Code {
    private TokenType op; // 演算子の種類(＋,－,＊,／)
    X_Code obj1; // 左側の式
    X_Code obj2; // 右側の式

    X_BinExpr(int n, TokenType operator, X_Code o1, X_Code o2) {
        super(n);
        op = operator;
        obj1 = o1;
        obj2 = o2;
    }

    X_Code run() throws Exception {
        X_Code result = null;
        X_Code o1 = obj1.run();
        X_Code o2 = obj2.run();

        if (op == TokenType.AND) {
            result = o1.and(getLocation(), o2);
        } else if (op == TokenType.OR) {
            result = o1.or(getLocation(), o2);
        } else if (op == TokenType.XOR) {
            result = o1.xor(getLocation(), o2);
        } else {
            switch (op) { // 演算子ごとに処理を振り分ける
                case ADD:
                    result = o1.add(getLocation(), o2);
                    break;
                case SUB:
                    result = o1.sub(getLocation(), o2);
                    break;
                case MUL:
                    result = o1.multiply(getLocation(), o2);
                    break;
                case DIV:
                    result = o1.divide(getLocation(), o2);
                    break;
                case L:
                    result = o1.less(getLocation(), o2);
                    break;
                case LE:
                    result = o1.le(getLocation(), o2);
                    break;
                case G:
                    result = o1.greater(getLocation(), o2);
                    break;
                case GE:
                    result = o1.ge(getLocation(), o2);
                    break;
                case EQ:
                    if (o1.equals(o2)) result = X_Bool.T;
                    else result = X_Bool.Nil;
                    break;
                case NE:
                    if (o1.equals(o2)) result = X_Bool.Nil;
                    else result = X_Bool.T;
                    break;
            }
        }
        return result;
    }
}

@@ -102,24 +102,42 @@
 ds X_Code %7B%0A
+    /** %E6%BC%94%E7%AE%97%E5%AD%90%E3%81%AE%E7%A8%AE%E9%A1%9E */%0A
     private 
@@ -153,27 +153,24 @@
  op;
- // %E6%BC%94%E7%AE%97%E5%AD%90%E3%81%AE%E7%A8%AE%E9%A1%9E(%EF%BC%8B,%EF%BC%8D,%EF%BC%8A,%EF%BC%8F)
+%0A    /** %E5%B7%A6%E5%81%B4%E3%81%AE%E5%BC%8F */
 %0A   
@@ -186,16 +186,24 @@
 bj1;
- // %E5%B7%A6%E5%81%B4%E3%81%AE%E5%BC%8F
+%0A    /** %E5%8F%B3%E5%81%B4%E3%81%AE%E5%BC%8F */
 %0A   
@@ -219,16 +219,8 @@
 bj2;
- // %E5%8F%B3%E5%81%B4%E3%81%AE%E5%BC%8F
 %0A%0A  

Update javadoc