void add(Map<SearchState,SearchState> nextQueue, Node<String> node, int startIndex,
             double chunkScore,
             boolean isTokenEnd,
             Map<Dp,Chunk> chunking, char[] cs, int end) {

        if (chunkScore > mDistanceThreshold)
            return;

        SearchState state2
            = new SearchState(node,startIndex,chunkScore);

        SearchState exState = nextQueue.get(state2);

        if (exState != null && exState.mScore < chunkScore)
            return;

        nextQueue.put(state2,state2);

        // finish match at token end by adding each cat (may be 0)
        if (isTokenEnd) {
            for (int i = 0; i < node.mEntries.length; ++i) {
                Chunk newChunk
                    = ChunkFactory
                    .createChunk(startIndex,end+1,
                                 node.mEntries[i].category().toString(),
                                 chunkScore);
                Dp dpNewChunk = new Dp(newChunk);
                Chunk oldChunk = chunking.get(dpNewChunk);
                if (oldChunk != null && oldChunk.score() <= chunkScore)
                    continue;
                chunking.remove(dpNewChunk);
                chunking.put(dpNewChunk,newChunk);
            }
        }

        // insert
        for (int i = 0; i < node.mDtrChars.length; ++i)
            add(nextQueue,node.mDtrNodes[i],startIndex,
                chunkScore - mEditDistance.insertWeight(node.mDtrChars[i]),
                isTokenEnd,chunking,cs,end);
    }