org.xbib.cql.Index Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cql Show documentation
Show all versions of cql Show documentation
Contextual Query Language compiler for Java
The newest version!
package org.xbib.cql;
/**
* Abstract syntax tree of CQL - Index.
* The Index consists of context and name
* The default context is "cql" and is of the same concept like a namespace.
*/
public class Index extends AbstractNode {
private String context;
private String name;
public Index(String name) {
this.name = name;
int pos = name.indexOf('.');
if (pos > 0) {
this.context = name.substring(0, pos);
this.name = name.substring(pos + 1);
}
}
public Index(SimpleName name) {
this(name.getName());
}
/**
* @return the context of the index
*/
public String getContext() {
return context;
}
/**
* Get the name of the index.
*
* @return the name of the index
*/
public String getName() {
return name;
}
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public String toString() {
return context != null ? context + "." + name : name;
}
}