Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.Order#shuffle()

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.Order#shuffle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChainedComparator.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
public ChainedComparator(final boolean traversers, final List<Pair<Traversal.Admin<S, C>, Comparator<C>>> comparators) {
    this.traversers = traversers;
    if (comparators.isEmpty())
        this.comparators.add(new Pair<>(new IdentityTraversal(), (Comparator) Order.asc));
    else
        this.comparators.addAll(comparators);
    this.isShuffle = (Comparator) (this.comparators.get(this.comparators.size() - 1).getValue1()) == Order.shuffle;
    if (!this.isShuffle)
        this.comparators.removeAll(this.comparators.stream().filter(pair -> (Comparator) pair.getValue1() == Order.shuffle).collect(Collectors.toList()));
}
 
Example 2
Source File: MultiComparator.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
public MultiComparator(final List<Comparator<C>> comparators) {
    this.comparators = (List) comparators;
    this.isShuffle = !this.comparators.isEmpty() && Order.shuffle == this.comparators.get(this.comparators.size() - 1);
    for (int i = 0; i < this.comparators.size(); i++) {
        if (this.comparators.get(i) == Order.shuffle)
            this.startIndex = i + 1;
    }
}
 
Example 3
Source File: ReplacedStepTree.java    From sqlg with MIT License 5 votes vote down vote up
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean orderByIsOrder() {
    for (ReplacedStep<?, ?> replacedStep : linearPathToLeafNode()) {
        for (Pair<Traversal.Admin<?, ?>, Comparator<?>> objects : replacedStep.getSqlgComparatorHolder().getComparators()) {
            if (!(objects.getValue1() instanceof Order && objects.getValue1() != Order.shuffle)) {
                return false;
            }
        }
    }
    return true;
}