/*
* Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nuxeo - initial API and implementation
*
* $Id$
*/
package org.eclipse.ecr.core.query.sql.model;
/**
* A named reference to a variable (this can be a field or table).
*
* @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
*
*/
public class Reference implements Operand {
private static final long serialVersionUID = -1725102431543210429L;
public final String name;
public Reference(String name) {
this.name = name;
}
@Override
public void accept(IVisitor visitor) {
visitor.visitReference(this);
}
@Override
public String toString() {
return name;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Reference) {
return name.contentEquals(((Reference) obj).name);
}
return false;
}
@Override
public int hashCode() {
return name.hashCode();
}
public boolean isPathReference() {
return false;
}
}