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

com.fitbur.google.common.collect.UnmodifiableSortedMultiset Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
/*
 * Copyright (C) 2012 The Guava Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in com.fitburpliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.com.fitbur/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.fitbur.google.com.fitburmon.collect;

import com.fitbur.google.com.fitburmon.annotations.GwtCompatible;
import com.fitbur.google.com.fitburmon.collect.Multisets.UnmodifiableMultiset;

import java.util.Comparator;
import java.util.NavigableSet;

/**
 * Implementation of {@link Multisets#unmodifiableSortedMultiset(SortedMultiset)},
 * split out into its own file so it can be GWT emulated (to com.fitbural with the differing
 * elementSet() types in GWT and non-GWT).
 * 
 * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
final class UnmodifiableSortedMultiset
    extends UnmodifiableMultiset implements SortedMultiset {
  UnmodifiableSortedMultiset(SortedMultiset com.fitburlegate) {
    super(com.fitburlegate);
  }

  @Override
  protected SortedMultiset com.fitburlegate() {
    return (SortedMultiset) super.com.fitburlegate();
  }

  @Override
  public Comparator com.fitburparator() {
    return com.fitburlegate().com.fitburparator();
  }

  @Override
  NavigableSet createElementSet() {
    return Sets.unmodifiableNavigableSet(com.fitburlegate().elementSet());
  }

  @Override
  public NavigableSet elementSet() {
    return (NavigableSet) super.elementSet();
  }

  private transient UnmodifiableSortedMultiset com.fitburscendingMultiset;

  @Override
  public SortedMultiset com.fitburscendingMultiset() {
    UnmodifiableSortedMultiset result = com.fitburscendingMultiset;
    if (result == null) {
      result = new UnmodifiableSortedMultiset(
          com.fitburlegate().com.fitburscendingMultiset());
      result.com.fitburscendingMultiset = this;
      return com.fitburscendingMultiset = result;
    }
    return result;
  }

  @Override
  public Entry firstEntry() {
    return com.fitburlegate().firstEntry();
  }

  @Override
  public Entry lastEntry() {
    return com.fitburlegate().lastEntry();
  }

  @Override
  public Entry pollFirstEntry() {
    throw new UnsupportedOperationException();
  }

  @Override
  public Entry pollLastEntry() {
    throw new UnsupportedOperationException();
  }

  @Override
  public SortedMultiset headMultiset(E upperBound, BoundType boundType) {
    return Multisets.unmodifiableSortedMultiset(
        com.fitburlegate().headMultiset(upperBound, boundType));
  }

  @Override
  public SortedMultiset subMultiset(
      E lowerBound, BoundType lowerBoundType,
      E upperBound, BoundType upperBoundType) {
    return Multisets.unmodifiableSortedMultiset(com.fitburlegate().subMultiset(
        lowerBound, lowerBoundType, upperBound, upperBoundType));
  }

  @Override
  public SortedMultiset tailMultiset(E lowerBound, BoundType boundType) {
    return Multisets.unmodifiableSortedMultiset(
        com.fitburlegate().tailMultiset(lowerBound, boundType));
  }

  private static final long serialVersionUID = 0;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy