Example usage for com.google.common.collect TreeRangeSet create

List of usage examples for com.google.common.collect TreeRangeSet create

Introduction

In this page you can find the example usage for com.google.common.collect TreeRangeSet create.

Prototype

public static <C extends Comparable<?>> TreeRangeSet<C> create(RangeSet<C> rangeSet) 

Source Link

Document

Returns a TreeRangeSet initialized with the ranges in the specified range set.

Usage

From source file:org.opendaylight.controller.cluster.datastore.utils.UnsignedLongRangeSet.java

public static UnsignedLongRangeSet create(final RangeSet<UnsignedLong> input) {
    return new UnsignedLongRangeSet(TreeRangeSet.create(input));
}

From source file:org.opendaylight.controller.cluster.datastore.LocalFrontendHistory.java

static LocalFrontendHistory recreate(final String persistenceId, final ShardDataTree tree,
        final ShardDataTreeTransactionChain chain, final Map<UnsignedLong, Boolean> closedTransactions,
        final RangeSet<UnsignedLong> purgedTransactions) {
    return new LocalFrontendHistory(persistenceId, tree, chain, new HashMap<>(closedTransactions),
            TreeRangeSet.create(purgedTransactions));
}

From source file:org.opendaylight.controller.cluster.datastore.FrontendClientMetadataBuilder.java

FrontendClientMetadataBuilder(final FrontendClientMetadata meta) {
    this.identifier = Preconditions.checkNotNull(meta.getIdentifier());
    purgedHistories = TreeRangeSet.create(meta.getPurgedHistories());

    for (FrontendHistoryMetadata h : meta.getCurrentHistories()) {
        final FrontendHistoryMetadataBuilder b = new FrontendHistoryMetadataBuilder(identifier, h);
        currentHistories.put(b.getIdentifier(), b);
    }/*from  ww w .j  a  va 2 s .  c  o  m*/
}

From source file:org.opendaylight.controller.cluster.datastore.utils.UnsignedLongRangeSet.java

public UnsignedLongRangeSet copy() {
    return new UnsignedLongRangeSet(TreeRangeSet.create(rangeset));
}

From source file:com.github.s4ke.moar.util.RangeRep.java

static <T extends Comparable> RangeSet<T> intersect(RangeSet<T> a, RangeSet<T> b) {
    RangeSet<T> copy = TreeRangeSet.create(a);
    copy.removeAll(b.complement());//from   ww  w  . j  a  va 2 s  . c  o  m
    return copy;
}

From source file:org.apache.druid.query.filter.AndDimFilter.java

@Override
public RangeSet<String> getDimensionRangeSet(String dimension) {
    RangeSet<String> retSet = null;
    for (DimFilter field : fields) {
        RangeSet<String> rangeSet = field.getDimensionRangeSet(dimension);
        if (rangeSet != null) {
            if (retSet == null) {
                retSet = TreeRangeSet.create(rangeSet);
            } else {
                retSet.removeAll(rangeSet.complement());
            }/*  w  ww.j  a v  a2 s  .c o m*/
        }
    }
    return retSet;
}

From source file:io.horizondb.model.core.predicates.OrPredicate.java

/**    
 * {@inheritDoc}/*from  w  w  w  .  j  ava  2s. c o  m*/
 */
@Override
public RangeSet<Field> getTimestampRanges() {

    RangeSet<Field> leftRanges = this.left.getTimestampRanges();
    RangeSet<Field> rightRanges = this.right.getTimestampRanges();

    RangeSet<Field> rangeSet = TreeRangeSet.create(leftRanges);
    rangeSet.addAll(rightRanges);

    return rangeSet;
}

From source file:org.onosproject.store.resource.impl.EncodedDiscreteResources.java

EncodedDiscreteResources difference(EncodedDiscreteResources other) {
    checkArgument(this.codec.getClass() == other.codec.getClass());

    RangeSet<Integer> newRangeSet = TreeRangeSet.create(this.rangeSet);
    newRangeSet.removeAll(other.rangeSet);

    return new EncodedDiscreteResources(newRangeSet, this.codec);
}

From source file:org.onosproject.store.resource.impl.EncodedDiscreteResources.java

EncodedDiscreteResources add(EncodedDiscreteResources other) {
    checkArgument(this.codec.getClass() == other.codec.getClass());

    RangeSet<Integer> newRangeSet = TreeRangeSet.create(this.rangeSet);
    newRangeSet.addAll(other.rangeSet);//from  w w  w .  j a v  a  2  s . c om

    return new EncodedDiscreteResources(newRangeSet, this.codec);
}