## modules/fxml/src/main/java/com/sun/javafx/fxml/builder/TriangleMeshBuilder.java

Print this page

    rev 4839 : RT-2529: Locale specific runtime errors (Turkish)

       8  * particular file as subject to the "Classpath" exception as provided
       9  * by Oracle in the LICENSE file that accompanied this code.
      10  *
      11  * This code is distributed in the hope that it will be useful, but WITHOUT
      12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14  * version 2 for more details (a copy is included in the LICENSE file that
      15  * accompanied this code).
      16  *
      17  * You should have received a copy of the GNU General Public License version
      18  * 2 along with this work; if not, write to the Free Software Foundation,
      19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
      20  *
      21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      22  * or visit www.oracle.com if you need additional information or have any
      23  * questions.
      24  */
      25
      26 package com.sun.javafx.fxml.builder;
      27

      28 import java.util.Map.Entry;
      29 import java.util.Set;
      30 import java.util.StringTokenizer;
      31 import java.util.TreeMap;
      32 import javafx.scene.shape.TriangleMesh;
      33 import javafx.util.Builder;
      34
      35 public class TriangleMeshBuilder extends TreeMap<String, Object> implements Builder<TriangleMesh> {
      36
      37     private static final String VALUE_SEPARATOR = ",";
      38
      39     private float[] points;
      40     private float[] texCoords;
      41     private int[] faces;
      42     private int[] faceSmoothingGroups;
      43
      44     @Override
      45     public TriangleMesh build() {
      46         TriangleMesh mesh = new TriangleMesh();
      47         if (points != null) {
      75             int counter = 0;
      76             while (tokenizer.hasMoreTokens()) {
      77                 texCoords[counter++] = Float.parseFloat(tokenizer.nextToken().trim());
      78             }
      79         } else if ("faces".equalsIgnoreCase(key)) {
      80             StringTokenizer tokenizer = new StringTokenizer((String) value, VALUE_SEPARATOR);
      81             faces = new int[tokenizer.countTokens()];
      82             int counter = 0;
      83             while (tokenizer.hasMoreTokens()) {
      84                 faces[counter++] = Integer.parseInt(tokenizer.nextToken().trim());
      85             }
      86         } else if ("facesmoothinggroups".equalsIgnoreCase(key)) {
      87             StringTokenizer tokenizer = new StringTokenizer((String) value, VALUE_SEPARATOR);
      88             faceSmoothingGroups = new int[tokenizer.countTokens()];
      89             int counter = 0;
      90             while (tokenizer.hasMoreTokens()) {
      91                 faceSmoothingGroups[counter++] = Integer.parseInt(tokenizer.nextToken().trim());
      92             }
      93         }
      94
      95         return super.put(key.toLowerCase(), value);
      96     }
      97
      98     @Override
      99     public Set<Entry<String, Object>> entrySet() {
     100         return super.entrySet();
     101     }
     102
     103 }
       8  * particular file as subject to the "Classpath" exception as provided
       9  * by Oracle in the LICENSE file that accompanied this code.
      10  *
      11  * This code is distributed in the hope that it will be useful, but WITHOUT
      12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14  * version 2 for more details (a copy is included in the LICENSE file that
      15  * accompanied this code).
      16  *
      17  * You should have received a copy of the GNU General Public License version
      18  * 2 along with this work; if not, write to the Free Software Foundation,
      19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
      20  *
      21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      22  * or visit www.oracle.com if you need additional information or have any
      23  * questions.
      24  */
      25
      26 package com.sun.javafx.fxml.builder;
      27
      28 import java.util.Locale;
      29 import java.util.Map.Entry;
      30 import java.util.Set;
      31 import java.util.StringTokenizer;
      32 import java.util.TreeMap;
      33 import javafx.scene.shape.TriangleMesh;
      34 import javafx.util.Builder;
      35
      36 public class TriangleMeshBuilder extends TreeMap<String, Object> implements Builder<TriangleMesh> {
      37
      38     private static final String VALUE_SEPARATOR = ",";
      39
      40     private float[] points;
      41     private float[] texCoords;
      42     private int[] faces;
      43     private int[] faceSmoothingGroups;
      44
      45     @Override
      46     public TriangleMesh build() {
      47         TriangleMesh mesh = new TriangleMesh();
      48         if (points != null) {
      76             int counter = 0;
      77             while (tokenizer.hasMoreTokens()) {
      78                 texCoords[counter++] = Float.parseFloat(tokenizer.nextToken().trim());
      79             }
      80         } else if ("faces".equalsIgnoreCase(key)) {
      81             StringTokenizer tokenizer = new StringTokenizer((String) value, VALUE_SEPARATOR);
      82             faces = new int[tokenizer.countTokens()];
      83             int counter = 0;
      84             while (tokenizer.hasMoreTokens()) {
      85                 faces[counter++] = Integer.parseInt(tokenizer.nextToken().trim());
      86             }
      87         } else if ("facesmoothinggroups".equalsIgnoreCase(key)) {
      88             StringTokenizer tokenizer = new StringTokenizer((String) value, VALUE_SEPARATOR);
      89             faceSmoothingGroups = new int[tokenizer.countTokens()];
      90             int counter = 0;
      91             while (tokenizer.hasMoreTokens()) {
      92                 faceSmoothingGroups[counter++] = Integer.parseInt(tokenizer.nextToken().trim());
      93             }
      94         }
      95
      96         return super.put(key.toLowerCase(Locale.ROOT), value);
      97     }
      98
      99     @Override
     100     public Set<Entry<String, Object>> entrySet() {
     101         return super.entrySet();
     102     }
     103
     104 }