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

net.sf.javagimmicks.collections8.transformer.KeyTransformingNavigableMap Maven / Gradle / Ivy

There is a newer version: 0.99-alpha1
Show newest version
package net.sf.javagimmicks.collections8.transformer;

import java.util.NavigableMap;
import java.util.NavigableSet;
import java.util.function.Function;

class KeyTransformingNavigableMap
      extends KeyTransformingSortedMap
      implements NavigableMap
{
   KeyTransformingNavigableMap(final NavigableMap map, final Function transformer)
   {
      super(map, transformer);
   }

   @Override
   public Entry ceilingEntry(final KT key)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public KT ceilingKey(final KT key)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public NavigableSet descendingKeySet()
   {
      return TransformerUtils.decorate(
            getNavigableMap().descendingKeySet(),
            getTransformerFunction());
   }

   @Override
   public NavigableMap descendingMap()
   {
      return TransformerUtils.decorateKeyBased(
            getNavigableMap().descendingMap(),
            getTransformerFunction());
   }

   @Override
   public Entry firstEntry()
   {
      final Entry firstEntry = getNavigableMap().firstEntry();

      return firstEntry == null ? null : new KeyTransformingEntry(
            firstEntry,
            getTransformerFunction());
   }

   @Override
   public Entry floorEntry(final KT key)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public KT floorKey(final KT key)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public NavigableMap headMap(final KT toKey, final boolean inclusive)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public Entry higherEntry(final KT key)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public KT higherKey(final KT key)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public Entry lastEntry()
   {
      final Entry lastEntry = getNavigableMap().lastEntry();

      return lastEntry == null ? null : new KeyTransformingEntry(
            lastEntry,
            getTransformerFunction());
   }

   @Override
   public Entry lowerEntry(final KT key)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public KT lowerKey(final KT key)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public NavigableSet navigableKeySet()
   {
      return TransformerUtils.decorate(
            getNavigableMap().navigableKeySet(),
            getTransformerFunction());
   }

   @Override
   public Entry pollFirstEntry()
   {
      final Entry first = getNavigableMap().pollFirstEntry();

      return first == null ? null : new KeyTransformingEntry(
            first,
            getTransformerFunction());
   }

   @Override
   public Entry pollLastEntry()
   {
      final Entry lastEntry = getNavigableMap().pollLastEntry();

      return lastEntry == null ? null : new KeyTransformingEntry(
            lastEntry,
            getTransformerFunction());
   }

   @Override
   public NavigableMap subMap(final KT fromKey, final boolean fromInclusive,
         final KT toKey, final boolean toInclusive)
   {
      throw new UnsupportedOperationException();
   }

   @Override
   public NavigableMap tailMap(final KT fromKey, final boolean inclusive)
   {
      throw new UnsupportedOperationException();
   }

   protected NavigableMap getNavigableMap()
   {
      return (NavigableMap) _internalMap;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy