org.geolatte.common.cql.node.AFromToTimespanLiteral Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geolatte-common Show documentation
Show all versions of geolatte-common Show documentation
This GeoLatte-common library contains the transformer framework and other common classes used by other
GeoLatte modules.
/* 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 AFromToTimespanLiteral extends PTimespanLiteral
{
private TDatetime _from_;
private TDatetime _to_;
public AFromToTimespanLiteral()
{
// Constructor
}
public AFromToTimespanLiteral(
@SuppressWarnings("hiding") TDatetime _from_,
@SuppressWarnings("hiding") TDatetime _to_)
{
// Constructor
setFrom(_from_);
setTo(_to_);
}
@Override
public Object clone()
{
return new AFromToTimespanLiteral(
cloneNode(this._from_),
cloneNode(this._to_));
}
public void apply(Switch sw)
{
((Analysis) sw).caseAFromToTimespanLiteral(this);
}
public TDatetime getFrom()
{
return this._from_;
}
public void setFrom(TDatetime node)
{
if(this._from_ != null)
{
this._from_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._from_ = node;
}
public TDatetime getTo()
{
return this._to_;
}
public void setTo(TDatetime node)
{
if(this._to_ != null)
{
this._to_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._to_ = node;
}
@Override
public String toString()
{
return ""
+ toString(this._from_)
+ toString(this._to_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._from_ == child)
{
this._from_ = null;
return;
}
if(this._to_ == child)
{
this._to_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._from_ == oldChild)
{
setFrom((TDatetime) newChild);
return;
}
if(this._to_ == oldChild)
{
setTo((TDatetime) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}