/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.yang.data.api;

import java.util.Arrays;

// TODO rename to ModifyOperation

/**
 * See https://tools.ietf.org/html/rfc6241#section-7.2.
 */
public enum ModifyAction {
    MERGE(true), REPLACE(true), CREATE(false), DELETE(false), REMOVE(false), NONE(true, false);

    public static ModifyAction fromXmlValue(final String xmlNameOfAction) {
        switch (xmlNameOfAction) {
            case "merge":
                return MERGE;
            case "replace":
                return REPLACE;
            case "remove":
                return REMOVE;
            case "delete":
                return DELETE;
            case "create":
                return CREATE;
            case "none":
                return NONE;
            default:
                throw new IllegalArgumentException("Unknown operation " + xmlNameOfAction + " available operations "
                        + Arrays.toString(ModifyAction.values()));
        }
    }

    private final boolean asDefaultPermitted;
    private final boolean onElementPermitted;

    ModifyAction(final boolean asDefaultPermitted, final boolean onElementPermitted) {
        this.asDefaultPermitted = asDefaultPermitted;
        this.onElementPermitted = onElementPermitted;
    }

    ModifyAction(final boolean asDefaultPermitted) {
        this(asDefaultPermitted, true);
    }

    public boolean isAsDefaultPermitted() {
        return asDefaultPermitted;
    }

    public boolean isOnElementPermitted() {
        return onElementPermitted;
    }
}

@@ -383,53 +383,53 @@
 ;%0A%0A/
-/ TODO rename to ModifyOperation%0A%0A/**%0A * See 
+**%0A * Edit operation, as defined by %3Ca href=%22
 http
@@ -475,13 +475,186 @@
 -7.2
-.%0A */
+%22%3ERFC6241 section 7.2%3C/a%3E.%0A */%0A// FIXME: 3.0.0: rename to EditOperation, consider remodeling to take into account MERGE/REPLACE/NONE versus%0A//               CREATE/DELETE/REMOVE.
 %0Apub
@@ -1838,32 +1838,294 @@
 , true);%0A    %7D%0A%0A
+    /**%0A     * Check if this operation is a candidate for %7B@code default-operation%7D argument.%0A     *%0A     * @return True if this operation can be used as %7B@code default-operation%7D.%0A     */%0A    // FIXME: 3.0.0: consider moving this somewhere else, or renaming it%0A
     public boole

Add ModifyAction documentation