public void process(FacesContext faces, PhaseId phase) {
        // stop if not rendered
        if (!isRendered()) {
            return;
        }

        // validate attributes
        validateAttributes();

        // reset index
        captureScopeValues();
        setIndex(-1);

        try {
            // has children
            if (getChildCount() > 0) {
                boolean dynamic = isDynamic();
                int i = getOffset();
                int end = getSize();
                int step = getStep();
                end = (end >= 0) ? i + end : Integer.MAX_VALUE - 1;

                // grab renderer
                String rendererType = getRendererType();
                Renderer renderer = null;
                if (rendererType != null) {
                    renderer = getRenderer(faces);
                }

                _count = 0;

                setIndex(i);
                while (i <= end && isIndexAvailable()) {

                    if (PhaseId.RENDER_RESPONSE.equals(phase) && renderer != null) {
                        renderer.encodeChildren(faces, this);
                    }
                    else {
                        for (int j = 0, childCount = getChildCount(); j < childCount; j++) {
                            UIComponent child = getChildren().get(j);

                            if (dynamic && child instanceof Tab && !((Tab) child).isLoaded(i)) {
                                continue;
                            }

                            if (PhaseId.APPLY_REQUEST_VALUES.equals(phase)) {
                                child.processDecodes(faces);
                            }
                            else if (PhaseId.PROCESS_VALIDATIONS.equals(phase)) {
                                child.processValidators(faces);
                            }
                            else if (PhaseId.UPDATE_MODEL_VALUES.equals(phase)) {
                                child.processUpdates(faces);
                            }
                            else if (PhaseId.RENDER_RESPONSE.equals(phase)) {
                                child.encodeAll(faces);
                            }
                        }
                    }

                    ++_count;

                    i += step;

                    setIndex(i);
                }
            }
        }
        catch (IOException e) {
            throw new FacesException(e);
        }
        finally {
            setIndex(-1);
            restoreScopeValues();
        }
    }
Calculates the count value for the given index.

@param index

@return
primefaces/src/main/java/org/primefaces/component/api/UITabPanel.java