org.xbib.cql.model.breadcrumb.FacetBreadcrumbTrail 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
package org.xbib.cql.model.breadcrumb;
import org.xbib.cql.model.Facet;
import java.util.Iterator;
import java.util.TreeSet;
/**
* Facet breadcrumb trail.
*/
public class FacetBreadcrumbTrail extends TreeSet {
@Override
public String toString() {
return toCQL();
}
public String toCQL() {
StringBuilder sb = new StringBuilder();
if (isEmpty()) {
return sb.toString();
}
Iterator it = iterator();
if (it.hasNext()) {
sb.append(it.next().toCQL());
}
while (it.hasNext()) {
sb.append(" and ").append(it.next().toCQL());
}
return sb.toString();
}
}