private void validateAttributes() throws FacesException {
        int begin = getOffset();
        int end = getDataModel().getRowCount();
        int size = getSize();
        int step = getStep();
        boolean sizeIsEnd = false;

        if (size == -1) {
            size = end;
            sizeIsEnd = true;
        }

        if (end >= 0) {
            if (size < 0) {
                throw new FacesException("iteration size cannot be less "
                        + "than zero");
            }
            else if (!sizeIsEnd && (begin + size) > end) {
                throw new FacesException("iteration size cannot be greater "
                        + "than collection size");
            }
        }

        if ((size > -1) && (begin > end)) {
            throw new FacesException("iteration offset cannot be greater "
                    + "than collection size");
        }

        if (step == -1) {
            setStep(1);
        }

        if (step < 0) {
            throw new FacesException("iteration step size cannot be less "
                    + "than zero");
        }
        else if (step == 0) {
            throw new FacesException("iteration step size cannot be equal "
                    + "to zero");
        }

        _end = size;
    }
Calculates the count value for the given index.

@param index

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