/* This file was generated by SableCC (http://www.sablecc.org/). */

package uk.co.zonetora.fj.ast.node;

import java.util.*;
import uk.co.zonetora.fj.ast.analysis.*;

public final class ACommaField extends PCommaField
{
    private TComma _comma_;
    private PFieldName _fieldName_;

    public ACommaField()
    {
    }

    public ACommaField(
        TComma _comma_,
        PFieldName _fieldName_)
    {
        setComma(_comma_);

        setFieldName(_fieldName_);

    }
    public Object clone()
    {
        return new ACommaField(
            (TComma) cloneNode(_comma_),
            (PFieldName) cloneNode(_fieldName_));
    }

    public void apply(Switch sw)
    {
        ((Analysis) sw).caseACommaField(this);
    }

    public TComma getComma()
    {
        return _comma_;
    }

    public void setComma(TComma node)
    {
        if(_comma_ != null)
        {
            _comma_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        _comma_ = node;
    }

    public PFieldName getFieldName()
    {
        return _fieldName_;
    }

    public void setFieldName(PFieldName node)
    {
        if(_fieldName_ != null)
        {
            _fieldName_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        _fieldName_ = node;
    }

    public String toString()
    {
        return ""
            + toString(_comma_)
            + toString(_fieldName_);
    }

    void removeChild(Node child)
    {
        if(_comma_ == child)
        {
            _comma_ = null;
            return;
        }

        if(_fieldName_ == child)
        {
            _fieldName_ = null;
            return;
        }

    }

    void replaceChild(Node oldChild, Node newChild)
    {
        if(_comma_ == oldChild)
        {
            setComma((TComma) newChild);
            return;
        }

        if(_fieldName_ == oldChild)
        {
            setFieldName((PFieldName) newChild);
            return;
        }

    }
}
