class PdfTextArray {

    private List<Object> arrayList = new LinkedList<>();

    // To emit a more efficient array, we consolidate
    // repeated numbers or strings into single array entries.
    // "add( 50 ); add( -50 );" will REMOVE the combined zero from the array.
    // the alternative (leaving a zero in there) was Just Weird.
    // --Mark Storer, May 12, 2008
    private String lastStr;
    private Float lastNum;
    private boolean isRTL = false;

    // constructors
    public PdfTextArray(String str) {
        add(str);
    }

    public PdfTextArray() {
    }

    /**
     * Adds a <CODE>PdfNumber</CODE> to the <CODE>PdfArray</CODE>.
     *
     * @param number displacement of the string
     */
    public void add(PdfNumber number) {
        add((float) number.doubleValue());
    }

    public void add(float number) {<FILL_FUNCTION_BODY>}

    public void add(String str) {
        if (isRTL) {
            str = new StringBuffer(str).reverse().toString();
        }
        if (str.length() > 0) {
            if (lastStr != null) {
                if (isRTL) {
                    lastStr = str + lastStr;
                } else {
                    lastStr = lastStr + str;
                }
                replaceLast(lastStr);
            } else {
                lastStr = str;
                if (isRTL) {
                    arrayList.add(0, lastStr);
                } else {
                    arrayList.add(lastStr);
                }
            }
            lastNum = null;
        }
        // adding an empty string doesn't modify the TextArray at all
    }

    List getArrayList() {
        return arrayList;
    }

    private void replaceLast(Object obj) {
        // deliberately throw the IndexOutOfBoundsException if we screw up.
        if (isRTL) {
            arrayList.set(0, obj);
        } else {
            arrayList.set(arrayList.size() - 1, obj);
        }
    }

    public boolean getRTL() {
        return this.isRTL;
    }

    public void setRTL(boolean isRTL) {
        this.isRTL = isRTL;
    }
}

        if (number != 0) {
            if (lastNum != null) {
                lastNum = number + lastNum;
                if (lastNum != 0) {
                    replaceLast(lastNum);
                } else {
                    arrayList.remove(isRTL ? 0 : arrayList.size() - 1);
                }
            } else {
                lastNum = number;
                if (isRTL) {
                    arrayList.add(0, lastNum);
                } else {
                    arrayList.add(lastNum);
                }
            }

            lastStr = null;
        }
        // adding zero doesn't modify the TextArray at all
    
<no_super_class>