/**
* Alipay.com Inc.
* Copyright (c) 2004-2012 All Rights Reserved.
*/
package com.alipay.zdal.parser.sql.dialect.oracle.ast.expr;
import com.alipay.zdal.parser.sql.ast.SQLExpr;
import com.alipay.zdal.parser.sql.ast.SQLExprImpl;
import com.alipay.zdal.parser.sql.ast.expr.SQLLiteralExpr;
import com.alipay.zdal.parser.sql.dialect.oracle.visitor.OracleASTVisitor;
import com.alipay.zdal.parser.sql.visitor.SQLASTVisitor;
/**
*
* @author ����
* @version $Id: OracleIntervalExpr.java, v 0.1 2012-11-17 ����3:44:04 Exp $
*/
public class OracleIntervalExpr extends SQLExprImpl implements SQLLiteralExpr, OracleExpr {
private static final long serialVersionUID = 1L;
private SQLExpr value;
private OracleIntervalType type;
private Integer precision;
private Integer factionalSecondsPrecision;
private OracleIntervalType toType;
private Integer toFactionalSecondsPrecision;
public OracleIntervalExpr() {
}
public SQLExpr getValue() {
return this.value;
}
public void setValue(SQLExpr value) {
this.value = value;
}
public OracleIntervalType getType() {
return this.type;
}
public void setType(OracleIntervalType type) {
this.type = type;
}
public Integer getPrecision() {
return this.precision;
}
public void setPrecision(Integer precision) {
this.precision = precision;
}
public Integer getFactionalSecondsPrecision() {
return this.factionalSecondsPrecision;
}
public void setFactionalSecondsPrecision(Integer factionalSecondsPrecision) {
this.factionalSecondsPrecision = factionalSecondsPrecision;
}
public OracleIntervalType getToType() {
return this.toType;
}
public void setToType(OracleIntervalType toType) {
this.toType = toType;
}
public Integer getToFactionalSecondsPrecision() {
return this.toFactionalSecondsPrecision;
}
public void setToFactionalSecondsPrecision(Integer toFactionalSecondsPrecision) {
this.toFactionalSecondsPrecision = toFactionalSecondsPrecision;
}
@Override
protected void accept0(SQLASTVisitor visitor) {
this.accept0((OracleASTVisitor) visitor);
}
public void accept0(OracleASTVisitor visitor) {
visitor.visit(this);
visitor.endVisit(this);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((factionalSecondsPrecision == null) ? 0 : factionalSecondsPrecision.hashCode());
result = prime * result + ((precision == null) ? 0 : precision.hashCode());
result = prime
* result
+ ((toFactionalSecondsPrecision == null) ? 0 : toFactionalSecondsPrecision
.hashCode());
result = prime * result + ((toType == null) ? 0 : toType.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
OracleIntervalExpr other = (OracleIntervalExpr) obj;
if (factionalSecondsPrecision == null) {
if (other.factionalSecondsPrecision != null) {
return false;
}
} else if (!factionalSecondsPrecision.equals(other.factionalSecondsPrecision)) {
return false;
}
if (precision == null) {
if (other.precision != null) {
return false;
}
} else if (!precision.equals(other.precision)) {
return false;
}
if (toFactionalSecondsPrecision == null) {
if (other.toFactionalSecondsPrecision != null) {
return false;
}
} else if (!toFactionalSecondsPrecision.equals(other.toFactionalSecondsPrecision)) {
return false;
}
if (toType != other.toType) {
return false;
}
if (type != other.type) {
return false;
}
if (value == null) {
if (other.value != null) {
return false;
}
} else if (!value.equals(other.value)) {
return false;
}
return true;
}
}