All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geolatte.common.cql.node.ADefaultDurationLiteral Maven / Gradle / Ivy

Go to download

This GeoLatte-common library contains the transformer framework and other common classes used by other GeoLatte modules.

There is a newer version: 0.8
Show newest version
/* This file was generated by SableCC (http://www.sablecc.org/). */

package org.geolatte.common.cql.node;

import org.geolatte.common.cql.analysis.*;

@SuppressWarnings("nls")
public final class ADefaultDurationLiteral extends PDurationLiteral
{
    private TUnsignedInteger _years_;
    private TUnsignedInteger _months_;
    private TUnsignedInteger _days_;
    private TUnsignedInteger _hours_;
    private TUnsignedInteger _minutes_;
    private TUnsignedInteger _seconds_;

    public ADefaultDurationLiteral()
    {
        // Constructor
    }

    public ADefaultDurationLiteral(
        @SuppressWarnings("hiding") TUnsignedInteger _years_,
        @SuppressWarnings("hiding") TUnsignedInteger _months_,
        @SuppressWarnings("hiding") TUnsignedInteger _days_,
        @SuppressWarnings("hiding") TUnsignedInteger _hours_,
        @SuppressWarnings("hiding") TUnsignedInteger _minutes_,
        @SuppressWarnings("hiding") TUnsignedInteger _seconds_)
    {
        // Constructor
        setYears(_years_);

        setMonths(_months_);

        setDays(_days_);

        setHours(_hours_);

        setMinutes(_minutes_);

        setSeconds(_seconds_);

    }

    @Override
    public Object clone()
    {
        return new ADefaultDurationLiteral(
            cloneNode(this._years_),
            cloneNode(this._months_),
            cloneNode(this._days_),
            cloneNode(this._hours_),
            cloneNode(this._minutes_),
            cloneNode(this._seconds_));
    }

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

    public TUnsignedInteger getYears()
    {
        return this._years_;
    }

    public void setYears(TUnsignedInteger node)
    {
        if(this._years_ != null)
        {
            this._years_.parent(null);
        }

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

            node.parent(this);
        }

        this._years_ = node;
    }

    public TUnsignedInteger getMonths()
    {
        return this._months_;
    }

    public void setMonths(TUnsignedInteger node)
    {
        if(this._months_ != null)
        {
            this._months_.parent(null);
        }

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

            node.parent(this);
        }

        this._months_ = node;
    }

    public TUnsignedInteger getDays()
    {
        return this._days_;
    }

    public void setDays(TUnsignedInteger node)
    {
        if(this._days_ != null)
        {
            this._days_.parent(null);
        }

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

            node.parent(this);
        }

        this._days_ = node;
    }

    public TUnsignedInteger getHours()
    {
        return this._hours_;
    }

    public void setHours(TUnsignedInteger node)
    {
        if(this._hours_ != null)
        {
            this._hours_.parent(null);
        }

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

            node.parent(this);
        }

        this._hours_ = node;
    }

    public TUnsignedInteger getMinutes()
    {
        return this._minutes_;
    }

    public void setMinutes(TUnsignedInteger node)
    {
        if(this._minutes_ != null)
        {
            this._minutes_.parent(null);
        }

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

            node.parent(this);
        }

        this._minutes_ = node;
    }

    public TUnsignedInteger getSeconds()
    {
        return this._seconds_;
    }

    public void setSeconds(TUnsignedInteger node)
    {
        if(this._seconds_ != null)
        {
            this._seconds_.parent(null);
        }

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

            node.parent(this);
        }

        this._seconds_ = node;
    }

    @Override
    public String toString()
    {
        return ""
            + toString(this._years_)
            + toString(this._months_)
            + toString(this._days_)
            + toString(this._hours_)
            + toString(this._minutes_)
            + toString(this._seconds_);
    }

    @Override
    void removeChild(@SuppressWarnings("unused") Node child)
    {
        // Remove child
        if(this._years_ == child)
        {
            this._years_ = null;
            return;
        }

        if(this._months_ == child)
        {
            this._months_ = null;
            return;
        }

        if(this._days_ == child)
        {
            this._days_ = null;
            return;
        }

        if(this._hours_ == child)
        {
            this._hours_ = null;
            return;
        }

        if(this._minutes_ == child)
        {
            this._minutes_ = null;
            return;
        }

        if(this._seconds_ == child)
        {
            this._seconds_ = null;
            return;
        }

        throw new RuntimeException("Not a child.");
    }

    @Override
    void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
    {
        // Replace child
        if(this._years_ == oldChild)
        {
            setYears((TUnsignedInteger) newChild);
            return;
        }

        if(this._months_ == oldChild)
        {
            setMonths((TUnsignedInteger) newChild);
            return;
        }

        if(this._days_ == oldChild)
        {
            setDays((TUnsignedInteger) newChild);
            return;
        }

        if(this._hours_ == oldChild)
        {
            setHours((TUnsignedInteger) newChild);
            return;
        }

        if(this._minutes_ == oldChild)
        {
            setMinutes((TUnsignedInteger) newChild);
            return;
        }

        if(this._seconds_ == oldChild)
        {
            setSeconds((TUnsignedInteger) newChild);
            return;
        }

        throw new RuntimeException("Not a child.");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy