net.sf.javagimmicks.collections8.transformer.TransformingRingCursor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gimmicks Show documentation
Show all versions of gimmicks Show documentation
Utility classes, APIs and tools for Java
/**
*
*/
package net.sf.javagimmicks.collections8.transformer;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.function.Function;
import net.sf.javagimmicks.collections8.RingCursor;
import net.sf.javagimmicks.transform8.Transforming;
class TransformingRingCursor
implements Transforming, RingCursor
{
protected final RingCursor _internalRingCursor;
private final Function _transformer;
TransformingRingCursor(RingCursor ringCursor, Function transformer)
{
_internalRingCursor = ringCursor;
_transformer = transformer;
}
public Function getTransformerFunction()
{
return _transformer;
}
public int size()
{
return _internalRingCursor.size();
}
public T get()
{
return getTransformerFunction().apply(_internalRingCursor.get());
}
public void insertAfter(T value)
{
throw new UnsupportedOperationException();
}
public void insertBefore(T value)
{
throw new UnsupportedOperationException();
}
public T next()
{
return getTransformerFunction().apply(_internalRingCursor.next());
}
public T previous()
{
return getTransformerFunction().apply(_internalRingCursor.previous());
}
public T remove()
{
return getTransformerFunction().apply(_internalRingCursor.remove());
}
public RingCursor cursor()
{
return TransformerUtils.decorate(_internalRingCursor.cursor(), getTransformerFunction());
}
public Iterator iterator()
{
return TransformerUtils.decorate(_internalRingCursor.iterator(), getTransformerFunction());
}
public Spliterator spliterator()
{
return TransformerUtils.decorate(_internalRingCursor.spliterator(), getTransformerFunction());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy