// Path: src/main/java/jp/gr/java_conf/daisy/ajax_mutator/mutatable/AttributeModification.java
// public class AttributeModification extends Mutatable {
//     private final AstNode targetDom;
//     private final AstNode targetAttribute;
//     private final AstNode attributeValue;
//     public static final Set<String> JQUERY_ATTR_SHORTCUTS
//         = ImmutableSet.of("height", "width", "text");
//     private final boolean usingJQueryShortcut;
// 
//     public AttributeModification(AstNode node, AstNode targetDom,
//             AstNode targetAttribute, AstNode attributeValue) {
//         this(node, targetDom, targetAttribute, attributeValue, false);
//     }
// 
//     public AttributeModification(AstNode node, AstNode targetDom,
//                     AstNode targetAttribute, AstNode attributeValue,
//             boolean usingJQueryShortcut) {
//         super(node);
//         this.targetDom = targetDom;
//         this.targetAttribute = targetAttribute;
//         this.attributeValue = attributeValue;
//         this.usingJQueryShortcut = usingJQueryShortcut;
//     }
// 
//     public AstNode getTargetDom() {
//         return targetDom;
//     }
// 
//     public AstNode getTargetAttribute() {
//         return targetAttribute;
//     }
// 
//     public AstNode getAttributeValue() {
//         return attributeValue;
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder builder = new StringBuilder();
//         builder.append(super.toString()).append('\n');
//         builder.append("  DOM attribute modification: [dom:");
//         builder.append(targetDom.toSource()).append(", attr:");
//         builder.append(targetAttribute.toSource()).append(", val:");
//         builder.append(attributeValue.toSource()).append("]");
//         return builder.toString();
//     }
// }


import java.util.List;
import jp.gr.java_conf.daisy.ajax_mutator.detector.AbstractDetector;
import jp.gr.java_conf.daisy.ajax_mutator.mutatable.AttributeModification;
import org.mozilla.javascript.ast.AstNode;
import org.mozilla.javascript.ast.FunctionCall;
import org.mozilla.javascript.ast.PropertyGet;
package jp.gr.java_conf.daisy.ajax_mutator.detector.jquery;




/**
 * detector for jQuery attribute modifications, which can be classfied into two
 * types: (1) attr method: e.g., elm.attr('attr_name', 'attr_value') (2)
 * shortcut method: e.g., elm.width('hoge')
 *
 * @author Kazuki Nishiura
 */
public class JQueryAttributeModificationDetector extends
        AbstractDetector<AttributeModification> {
    private static final String ATTR_KEYWORD = "attr";

    @Override
    public AttributeModification detect(AstNode node) {
        return detectFromFunctionCall(node, false);
    }

    @Override
// Path: src/main/java/jp/gr/java_conf/daisy/ajax_mutator/mutatable/AttributeModification.java
// public class AttributeModification extends Mutatable {
//     private final AstNode targetDom;
//     private final AstNode targetAttribute;
//     private final AstNode attributeValue;
//     public static final Set<String> JQUERY_ATTR_SHORTCUTS
//         = ImmutableSet.of("height", "width", "text");
//     private final boolean usingJQueryShortcut;
// 
//     public AttributeModification(AstNode node, AstNode targetDom,
//             AstNode targetAttribute, AstNode attributeValue) {
//         this(node, targetDom, targetAttribute, attributeValue, false);
//     }
// 
//     public AttributeModification(AstNode node, AstNode targetDom,
//                     AstNode targetAttribute, AstNode attributeValue,
//             boolean usingJQueryShortcut) {
//         super(node);
//         this.targetDom = targetDom;
//         this.targetAttribute = targetAttribute;
//         this.attributeValue = attributeValue;
//         this.usingJQueryShortcut = usingJQueryShortcut;
//     }
// 
//     public AstNode getTargetDom() {
//         return targetDom;
//     }
// 
//     public AstNode getTargetAttribute() {
//         return targetAttribute;
//     }
// 
//     public AstNode getAttributeValue() {
//         return attributeValue;
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder builder = new StringBuilder();
//         builder.append(super.toString()).append('\n');
//         builder.append("  DOM attribute modification: [dom:");
//         builder.append(targetDom.toSource()).append(", attr:");
//         builder.append(targetAttribute.toSource()).append(", val:");
//         builder.append(attributeValue.toSource()).append("]");
//         return builder.toString();
//     }
// }


// Path: src/main/java/jp/gr/java_conf/daisy/ajax_mutator/detector/jquery/JQueryAttributeModificationDetector.java
import java.util.List;
import jp.gr.java_conf.daisy.ajax_mutator.detector.AbstractDetector;
import jp.gr.java_conf.daisy.ajax_mutator.mutatable.AttributeModification;
import org.mozilla.javascript.ast.AstNode;
import org.mozilla.javascript.ast.FunctionCall;
import org.mozilla.javascript.ast.PropertyGet;

package jp.gr.java_conf.daisy.ajax_mutator.detector.jquery;




/**
 * detector for jQuery attribute modifications, which can be classfied into two
 * types: (1) attr method: e.g., elm.attr('attr_name', 'attr_value') (2)
 * shortcut method: e.g., elm.width('hoge')
 *
 * @author Kazuki Nishiura
 */
public class JQueryAttributeModificationDetector extends
        AbstractDetector<AttributeModification> {
    private static final String ATTR_KEYWORD = "attr";

    @Override
    public AttributeModification detect(AstNode node) {
        return detectFromFunctionCall(node, false);
    }

    @Override
    public AttributeModification detectFromFunctionCall(