package ru.rulex.conclusion.dagger;

import java.util.ArrayDeque;
import java.util.Queue;

import com.google.common.collect.ImmutableMap;

import ru.rulex.conclusion.AssertionUnit;
import ru.rulex.conclusion.Selector;

import ru.rulex.conclusion.dagger.AssertionUnits.IntExpression;
import ru.rulex.conclusion.dagger.AssertionUnits.StringExpression;
import ru.rulex.conclusion.dagger.AssertionUnits.FloatExpression;

@SuppressWarnings("rawtypes")
public enum SelectorKeeper implements Selector<Object, Object>
{
  INSTANCE
  {

    private ImmutableMap<String, Class<? extends AssertionUnit>> map = ImmutableMap.of( "getInteger",
        IntExpression.class, "getOtherInteger", IntExpression.class, "getFloat", FloatExpression.class,
        "", StringExpression.class );

    private Queue<Class<? extends AssertionUnit>> classesQueue = new ArrayDeque<>();

    private Queue<Selector> selectorsQueue = new ArrayDeque<>();
    
    @Override
    public Object select( Object argument )
    {
       Selector selector = selectorsQueue.poll();
       return selector.select( argument );
    }

    @Override
    public <T, E> void setDelegate( Selector<T, E> delegate )
    {
      selectorsQueue.offer( delegate );
    }

    public Class<? extends AssertionUnit> getExpressionClass()
    {
      return classesQueue.poll();
    }

    @Override
    public void setExpressionClass( String methodName )
    {
      classesQueue.offer( map.get( methodName ) );
    }
  };

  public abstract <T, E> void setDelegate( Selector<T, E> delegate );

  public abstract Class<? extends AssertionUnit> getExpressionClass();

  public abstract void setExpressionClass( String methodName );

  <E, T> Selector<E, T> cast()
  {
    return (Selector<E, T>) this;
  }
}
@@ -84,16 +84,61 @@
 Queue;%0A%0A
+import com.google.common.base.Preconditions;%0A
 import c
@@ -256,17 +256,16 @@
 lector;%0A
-%0A
 import r
@@ -569,23 +569,65 @@
  %7B%0A%0A    
-private
+//Map for association Class MethodName %0A    final
  Immutab
@@ -852,31 +852,29 @@
 ass );%0A%0A    
-private
+final
  Queue%3CClass
@@ -944,15 +944,13 @@
     
-private
+final
  Que
@@ -1003,17 +1003,13 @@
 ();%0A
+%0A
     
-%0A    
 @Ove
@@ -1005,32 +1005,67 @@
 ;%0A%0A    @Override
+%0A    @SuppressWarnings(%22unchecked%22)
 %0A    public Obje
@@ -1145,24 +1145,71 @@
 eue.poll();%0A
+       Preconditions.checkNotNull( selector );%0A
        retur
@@ -1832,16 +1832,49 @@
 ame );%0A%0A
+  @SuppressWarnings(%22unchecked%22)%0A
   %3CE, T%3E

fix couple type