All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xbib.cql.model.breadcrumb.FacetBreadcrumbTrail Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy