/* 
 * @(#)Mgmt.java        1.0 09/12/14
 *
 * This file has been auto-generated by JNC, the
 * Java output format plug-in of pyang.
 * Origin: module "hcta-epc", revision: "2014-09-18".
 */

package hctaEpc.fgw.system;

import Element;

import ElementChildrenIterator;

import Epc;

import JNCException;

import Unit;

import com.tailf.jnc.YangElement;
import com.tailf.jnc.YangUInt16;

/**
 * This class represents an element from 
 * the namespace http://hitachi-cta.com/ns/epc
 * generated to "src/hctaEpc/fgw/system/mgmt"
 * <p>
 * See line 126 in
 * fgwConfig.yang
 *
 * @version 1.0 2014-12-09
 * @author Auto Generated
 */
public class Mgmt extends YangElement {

    private static final long serialVersionUID = 1L;

    /**
     * Constructor for an empty Mgmt object.
     */
    public Mgmt() {
        super(Epc.NAMESPACE, "mgmt");
    }

    /**
     * Clones this object, returning an exact copy.
     * @return A clone of the object.
     */
    public Mgmt clone() {
        return (Mgmt)cloneContent(new Mgmt());
    }

    /**
     * Clones this object, returning a shallow copy.
     * @return A clone of the object. Children are not included.
     */
    public Mgmt cloneShallow() {
        return (Mgmt)cloneShallowContent(new Mgmt());
    }

    /**
     * @return An array with the identifiers of any key children
     */
    public String[] keyNames() {
        return null;
    }

    /**
     * @return An array with the identifiers of any children, in order.
     */
    public String[] childrenNames() {
        return new String[] {
            "unit",
        };
    }

    /* Access methods for list child: "unit". */

    /**
     * Gets list entry "unit", with specified keys.
     * @param unitIdValue Key argument of child.
     */
    public Unit getUnit(YangUInt16 unitIdValue) throws JNCException {
        String path = "unit[unitId='" + unitIdValue + "']";
        return (Unit)searchOne(path);
    }

    /**
     * Gets list entry "unit", with specified keys.
     * The keys are specified as strings.
     * @param unitIdValue Key argument of child.
     */
    public Unit getUnit(String unitIdValue) throws JNCException {
        String path = "unit[unitId='" + unitIdValue + "']";
        return (Unit)searchOne(path);
    }

    /**
     * Iterator method for the list "unit".
     * @return An iterator for the list.
     */
    public ElementChildrenIterator unitIterator() {
        return new ElementChildrenIterator(children, "unit");
    }

    /**
     * Adds list entry "unit", using an existing object.
     * @param unit The object to add.
     * @return The added child.
     */
    public Unit addUnit(Unit unit) throws JNCException {
        insertChild(unit, childrenNames());
        return unit;
    }

    /**
     * Adds list entry "unit", with specified keys.
     * @param unitIdValue Key argument of child.
     * @return The added child.
     */
    public Unit addUnit(YangUInt16 unitIdValue) throws JNCException {
        Unit unit = new Unit(unitIdValue);
        return addUnit(unit);
    }

    /**
     * Adds list entry "unit", with specified keys.
     * The keys are specified as strings.
     * @param unitIdValue Key argument of child.
     * @return The added child.
     */
    public Unit addUnit(String unitIdValue) throws JNCException {
        Unit unit = new Unit(unitIdValue);
        return addUnit(unit);
    }

    /**
     * Adds list entry "unit".
     * This method is used for creating subtree filters.
     * @return The added child.
     */
    public Unit addUnit() throws JNCException {
        Unit unit = new Unit();
        insertChild(unit, childrenNames());
        return unit;
    }

    /**
     * Deletes list entry "unit", with specified keys.
     * @param unitIdValue Key argument of child.
     */
    public void deleteUnit(YangUInt16 unitIdValue) throws JNCException {
        String path = "unit[unitId='" + unitIdValue + "']";
        delete(path);
    }

    /**
     * Deletes list entry "unit", with specified keys.
     * The keys are specified as strings.
     * @param unitIdValue Key argument of child.
     */
    public void deleteUnit(String unitIdValue) throws JNCException {
        String path = "unit[unitId='" + unitIdValue + "']";
        delete(path);
    }

    /**
     * Support method for addChild.
     * Adds a child to this object.
     * 
     * @param child The child to add
     */
    public void addChild(Element child) {
        super.addChild(child);
    }

}
