package io.jaq.spsc;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.LinkedTransferQueue;

public class SPSCQueueFactory {
    public static final int QUEUE_CAPACITY = 1 << Integer.getInteger("pow2.capacity", 15);
    public static Queue<Integer> createQueue() {
        int type = Integer.getInteger("q.type", 0);
        switch (type) {
        case -2:
            return new LinkedTransferQueue<Integer>();
        case -1:
            return new ConcurrentLinkedQueue<Integer>();
        case 0:
            return new InlinedCountersSpscConcurrentArrayQueue<Integer>(QUEUE_CAPACITY);
        case 1:
            return new BQueue<Integer>(QUEUE_CAPACITY);
        case 2:
            return new FFBuffer<Integer>(QUEUE_CAPACITY);
        case 3:
            return new FFBufferWithOfferBatch<Integer>(QUEUE_CAPACITY);
        case 4:
            return new FloatingCountersSpscConcurrentArrayQueue<Integer>(QUEUE_CAPACITY);
        }
        throw new IllegalArgumentException("Type: " + type);
    }

}

@@ -285,90 +285,112 @@
 tic 
-Queue%3CInteger%3E createQueue() %7B%0A        int type = Integer.getInteger(%22q.type%22, 0);
+final int QUEUE_TYPE = Integer.getInteger(%22q.type%22, 0);%0A    public static Queue%3CInteger%3E createQueue() %7B
 %0A   
@@ -402,20 +402,26 @@
 switch (
-type
+QUEUE_TYPE
 ) %7B%0A    
@@ -1071,20 +1071,26 @@
 pe: %22 + 
-type
+QUEUE_TYPE
 );%0A    %7D

Make queue type a constant