// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/filter/BasicResultFilters.java
// public class BasicResultFilters
// {
//     private static final Locale DEFAULT_LOCALE = Locale.getDefault();
// 
//     public static class LowerCase extends FilterPipelineTask<String, String>
//     {
//         private Locale locale;
// 
//         public LowerCase(Locale locale)
//         {
//             this.locale = locale;
//         }
// 
//         public LowerCase()
//         {
//             this.locale = DEFAULT_LOCALE;
//         }
// 
//         @Override
//         public String process(String input) throws Exception
//         {
//             return input.toLowerCase(locale);
//         }
//     }
// 
//     public static class UpperCase extends FilterPipelineTask<String, String>
//     {
//         private Locale locale;
// 
//         public UpperCase(Locale locale)
//         {
//             this.locale = locale;
//         }
// 
//         public UpperCase()
//         {
//             this.locale = DEFAULT_LOCALE;
//         }
// 
//         public String process(String input) throws Exception
//         {
//             return input.toUpperCase(locale);
//         }
//     }
// 
//     public static class NoOperation extends FilterPipelineTask<Object, Object>
//     {
//         public Object process(Object input) throws Exception
//         {
//             return input;
//         }
//     }
// }
// 
// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/filter/FilterPipelineBuilder.java
// public class FilterPipelineBuilder
// {
//     private final FilterPipelineTask<?,?> parent;
//     private FilterPipelineTask<?,?> current;
// 
//     public FilterPipelineBuilder(FilterPipelineTask<?, ?> first)
//     {
//         this(first, first);
//     }
// 
//     private FilterPipelineBuilder(FilterPipelineTask<?, ?> first, FilterPipelineTask<?, ?> current)
//     {
//         this.parent = first;
//         this.current = current;
//     }
// 
//     public FilterPipelineBuilder add(String name, FilterPipelineTask<?,?> nextTask)
//     {
//         this.current.setLast(name, nextTask);
//         this.current = nextTask;
//         return this;
//     }
// 
//     public FilterPipelineTask<?,?> build()
//     {
//         return this.parent;
//     }
// }
// 
// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/filter/FilterPipelineExecutor.java
// public class FilterPipelineExecutor
// {
//     private static final Logger logger = LoggerFactory.getLogger(FilterPipelineExecutor.class);
// 
//     public static <F,T> T execute(FilterPipelineTask<F, T> task, T initialInput)
//     {
//         FilterPipelineTask<?, ?> taskPtr = task;
//         T result = initialInput;
//         try
//         {
//             while (true)
//             {
//                 FilterPipelineTask<F,T> taskGeneric = (FilterPipelineTask<F,T>) taskPtr;
//                 result = taskGeneric.process((F) result);
//                 taskPtr = taskPtr.next;
//                 if(taskPtr == null)
//                     return result;
//             }
//         }
//         catch (Exception e)
//         {
//             logger.info("An unhandled exception to occurred while processing " +
//                     "pipeline [{}]", task.getName(), e);
//         }
//         return null;
//     }
// }
// 
// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/filter/FilterPipelineTask.java
// public abstract class FilterPipelineTask<F, T>
// {
//     private String name;
//     public FilterPipelineTask<?, ?> next;
// 
//     protected <K, V> void setLast(String name, FilterPipelineTask<K, V> last)
//     {
//         if (last == this)
//             throw new IllegalArgumentException("provided last task ["
//                     + last.name + "] cannot be set to itself");
//         if (this.next == null)
//         {
//             this.next = last;
//             this.name = name;
//         }
//         else
//         {
//             this.next.setLast(name, last);
//         }
//     }
// 
//     public abstract T process(F input) throws Exception;
// 
//     public String getName()
//     {
//         return name;
//     }
// }


import org.apache.cassandra.utils.ByteBufferUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.cassandra.db.index.sasi.analyzer.filter.BasicResultFilters;
import org.apache.cassandra.db.index.sasi.analyzer.filter.FilterPipelineBuilder;
import org.apache.cassandra.db.index.sasi.analyzer.filter.FilterPipelineExecutor;
import org.apache.cassandra.db.index.sasi.analyzer.filter.FilterPipelineTask;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.AsciiType;
import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.serializers.MarshalException;
                return true;
            }
            catch (MarshalException e)
            {
                logger.error("Failed to deserialize value with " + validator, e);
                return false;
            }
            finally
            {
                hasNext = false;
            }
        }

        return false;
    }

    @Override
    public void reset(ByteBuffer input)
    {
        this.next = null;
        this.input = input;
        this.hasNext = true;
    }

    private FilterPipelineTask getFilterPipeline()
    {
        FilterPipelineBuilder builder = new FilterPipelineBuilder(new BasicResultFilters.NoOperation());
        if (options.isCaseSensitive() && options.shouldLowerCaseOutput())
            builder = builder.add("to_lower", new BasicResultFilters.LowerCase());
        if (options.isCaseSensitive() && options.shouldUpperCaseOutput())
// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/filter/BasicResultFilters.java
// public class BasicResultFilters
// {
//     private static final Locale DEFAULT_LOCALE = Locale.getDefault();
// 
//     public static class LowerCase extends FilterPipelineTask<String, String>
//     {
//         private Locale locale;
// 
//         public LowerCase(Locale locale)
//         {
//             this.locale = locale;
//         }
// 
//         public LowerCase()
//         {
//             this.locale = DEFAULT_LOCALE;
//         }
// 
//         @Override
//         public String process(String input) throws Exception
//         {
//             return input.toLowerCase(locale);
//         }
//     }
// 
//     public static class UpperCase extends FilterPipelineTask<String, String>
//     {
//         private Locale locale;
// 
//         public UpperCase(Locale locale)
//         {
//             this.locale = locale;
//         }
// 
//         public UpperCase()
//         {
//             this.locale = DEFAULT_LOCALE;
//         }
// 
//         public String process(String input) throws Exception
//         {
//             return input.toUpperCase(locale);
//         }
//     }
// 
//     public static class NoOperation extends FilterPipelineTask<Object, Object>
//     {
//         public Object process(Object input) throws Exception
//         {
//             return input;
//         }
//     }
// }
// 
// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/filter/FilterPipelineBuilder.java
// public class FilterPipelineBuilder
// {
//     private final FilterPipelineTask<?,?> parent;
//     private FilterPipelineTask<?,?> current;
// 
//     public FilterPipelineBuilder(FilterPipelineTask<?, ?> first)
//     {
//         this(first, first);
//     }
// 
//     private FilterPipelineBuilder(FilterPipelineTask<?, ?> first, FilterPipelineTask<?, ?> current)
//     {
//         this.parent = first;
//         this.current = current;
//     }
// 
//     public FilterPipelineBuilder add(String name, FilterPipelineTask<?,?> nextTask)
//     {
//         this.current.setLast(name, nextTask);
//         this.current = nextTask;
//         return this;
//     }
// 
//     public FilterPipelineTask<?,?> build()
//     {
//         return this.parent;
//     }
// }
// 
// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/filter/FilterPipelineExecutor.java
// public class FilterPipelineExecutor
// {
//     private static final Logger logger = LoggerFactory.getLogger(FilterPipelineExecutor.class);
// 
//     public static <F,T> T execute(FilterPipelineTask<F, T> task, T initialInput)
//     {
//         FilterPipelineTask<?, ?> taskPtr = task;
//         T result = initialInput;
//         try
//         {
//             while (true)
//             {
//                 FilterPipelineTask<F,T> taskGeneric = (FilterPipelineTask<F,T>) taskPtr;
//                 result = taskGeneric.process((F) result);
//                 taskPtr = taskPtr.next;
//                 if(taskPtr == null)
//                     return result;
//             }
//         }
//         catch (Exception e)
//         {
//             logger.info("An unhandled exception to occurred while processing " +
//                     "pipeline [{}]", task.getName(), e);
//         }
//         return null;
//     }
// }
// 
// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/filter/FilterPipelineTask.java
// public abstract class FilterPipelineTask<F, T>
// {
//     private String name;
//     public FilterPipelineTask<?, ?> next;
// 
//     protected <K, V> void setLast(String name, FilterPipelineTask<K, V> last)
//     {
//         if (last == this)
//             throw new IllegalArgumentException("provided last task ["
//                     + last.name + "] cannot be set to itself");
//         if (this.next == null)
//         {
//             this.next = last;
//             this.name = name;
//         }
//         else
//         {
//             this.next.setLast(name, last);
//         }
//     }
// 
//     public abstract T process(F input) throws Exception;
// 
//     public String getName()
//     {
//         return name;
//     }
// }


// Path: src/java/org/apache/cassandra/db/index/sasi/analyzer/NonTokenizingAnalyzer.java
import org.apache.cassandra.utils.ByteBufferUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.cassandra.db.index.sasi.analyzer.filter.BasicResultFilters;
import org.apache.cassandra.db.index.sasi.analyzer.filter.FilterPipelineBuilder;
import org.apache.cassandra.db.index.sasi.analyzer.filter.FilterPipelineExecutor;
import org.apache.cassandra.db.index.sasi.analyzer.filter.FilterPipelineTask;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.AsciiType;
import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.serializers.MarshalException;

                return true;
            }
            catch (MarshalException e)
            {
                logger.error("Failed to deserialize value with " + validator, e);
                return false;
            }
            finally
            {
                hasNext = false;
            }
        }

        return false;
    }

    @Override
    public void reset(ByteBuffer input)
    {
        this.next = null;
        this.input = input;
        this.hasNext = true;
    }

    private FilterPipelineTask getFilterPipeline()
    {
        FilterPipelineBuilder builder = new FilterPipelineBuilder(new BasicResultFilters.NoOperation());
        if (options.isCaseSensitive() && options.shouldLowerCaseOutput())
            builder = builder.add("to_lower", new BasicResultFilters.LowerCase());
        if (options.isCaseSensitive() && options.shouldUpperCaseOutput())
            builder = builder.add("to_upper", new BasicResultFilters.UpperCase());