Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.MacroDef$Text


            try {
                switch (bufferType) {
                    case Float: {
                        final String normalizedText = Text.normalizeString(text);
                        if (normalizedText.length() == 0) {
                            return new Text("");
                        }
                        final StringTokenizer tokenizer = new StringTokenizer(normalizedText, " ");
                        final float[] floatArray = new float[count];
                        for (int i = 0; i < count; i++) {
                            floatArray[i] = parseFloat(tokenizer.nextToken());
                        }

                        dataCache.getFloatArrays().put(currentElement, floatArray);

                        return new Text("");
                    }
                    case Double: {
                        final String normalizedText = Text.normalizeString(text);
                        if (normalizedText.length() == 0) {
                            return new Text("");
                        }
                        final StringTokenizer tokenizer = new StringTokenizer(normalizedText, " ");
                        final double[] doubleArray = new double[count];
                        for (int i = 0; i < count; i++) {
                            doubleArray[i] = Double.parseDouble(tokenizer.nextToken().replace(",", "."));
                        }

                        dataCache.getDoubleArrays().put(currentElement, doubleArray);

                        return new Text("");
                    }
                    case Int: {
                        final String normalizedText = Text.normalizeString(text);
                        if (normalizedText.length() == 0) {
                            return new Text("");
                        }
                        final StringTokenizer tokenizer = new StringTokenizer(normalizedText, " ");
                        final int[] intArray = new int[count];
                        int i = 0;
                        while (tokenizer.hasMoreTokens()) {
                            intArray[i++] = Integer.parseInt(tokenizer.nextToken());
                        }

                        dataCache.getIntArrays().put(currentElement, intArray);

                        return new Text("");
                    }
                    case P: {
                        list.clear();
                        final String normalizedText = Text.normalizeString(text);
                        if (normalizedText.length() == 0) {
                            return new Text("");
                        }
                        final StringTokenizer tokenizer = new StringTokenizer(normalizedText, " ");
                        while (tokenizer.hasMoreTokens()) {
                            list.add(tokenizer.nextToken());
                        }
                        final int listSize = list.size();
                        final int[] intArray = new int[listSize];
                        for (int i = 0; i < listSize; i++) {
                            intArray[i] = Integer.parseInt(list.get(i));
                        }

                        dataCache.getIntArrays().put(currentElement, intArray);

                        return new Text("");
                    }
                    default:
                        break;
                }
            } catch (final NoSuchElementException e) {
                throw new ColladaException("Number of values in collada array does not match its count attribute: "
                        + count, e);
            }
            return new Text(Text.normalizeString(text));
        }
View Full Code Here


        }
        Content content = htmlContent.get(0);
        if(!(content instanceof Text)) {
            return null;
        }
        Text htmlText = (Text) content;
        return normalized(htmlText.getValue());
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.MacroDef$Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.