diff options
author | Julien Gouesse <[email protected]> | 2014-08-08 22:20:23 +0200 |
---|---|---|
committer | Julien Gouesse <[email protected]> | 2014-08-08 22:20:23 +0200 |
commit | 604beffc2b0bc493e9ded173b4a6780068d9c6e1 (patch) | |
tree | 814c69175e2d3a3d32ca52187c2b0f092cd0b37e | |
parent | d8553c06068332a2e604f1336238e5cdf12c762c (diff) |
Removes tons of warnings
5 files changed, 56 insertions, 60 deletions
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java index d20278c..03173d8 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java @@ -181,7 +181,6 @@ public class ColladaAnimUtils { * @param skin * our <skin> element. */ - @SuppressWarnings("unchecked") private void buildSkinMeshes(final Node ardorParentNode, final Element instanceController, final Element controller, final Element skin) { final String skinSource = skin.getAttributeValue("source"); @@ -646,7 +645,6 @@ public class ColladaAnimUtils { * * @param entry */ - @SuppressWarnings("unchecked") private void buildAnimations(final Element parentElement, final Collection<TargetChannel> targetList) { final List<Element> elementTransforms = new ArrayList<Element>(); @@ -767,42 +765,45 @@ public class ColladaAnimUtils { finalTransformList.add(transform); } - final float[] time = new float[finalTimeList.size()]; - for (int i = 0; i < finalTimeList.size(); i++) { - time[i] = finalTimeList.get(i); - } - final Transform[] transforms = finalTransformList.toArray(new Transform[finalTransformList.size()]); - - AnimationClip animationClip = animationItemRoot.getAnimationClip(); - if (animationClip == null) { - animationClip = new AnimationClip(animationItemRoot.getName()); - animationItemRoot.setAnimationClip(animationClip); - } + if (animationItemRoot != null) { - // Make an animation channel - first find if we have a matching joint - Joint joint = _dataCache.getElementJointMapping().get(parentElement); - if (joint == null) { - String nodeName = parentElement.getAttributeValue("name", (String) null); - if (nodeName == null) { // use id if name doesn't exist - nodeName = parentElement.getAttributeValue("id", parentElement.getName()); + final float[] time = new float[finalTimeList.size()]; + for (int i = 0; i < finalTimeList.size(); i++) { + time[i] = finalTimeList.get(i); } - if (nodeName != null) { - joint = _dataCache.getExternalJointMapping().get(nodeName); + final Transform[] transforms = finalTransformList.toArray(new Transform[finalTransformList.size()]); + + AnimationClip animationClip = animationItemRoot.getAnimationClip(); + if (animationClip == null) { + animationClip = new AnimationClip(animationItemRoot.getName()); + animationItemRoot.setAnimationClip(animationClip); } + // Make an animation channel - first find if we have a matching joint + Joint joint = _dataCache.getElementJointMapping().get(parentElement); if (joint == null) { - // no joint still, so make a transform channel. - final TransformChannel transformChannel = new TransformChannel(nodeName, time, transforms); - animationClip.addChannel(transformChannel); - _colladaStorage.getAnimationChannels().add(transformChannel); - return; + String nodeName = parentElement.getAttributeValue("name", (String) null); + if (nodeName == null) { // use id if name doesn't exist + nodeName = parentElement.getAttributeValue("id", parentElement.getName()); + } + if (nodeName != null) { + joint = _dataCache.getExternalJointMapping().get(nodeName); + } + + if (joint == null) { + // no joint still, so make a transform channel. + final TransformChannel transformChannel = new TransformChannel(nodeName, time, transforms); + animationClip.addChannel(transformChannel); + _colladaStorage.getAnimationChannels().add(transformChannel); + return; + } } - } - // create joint channel - final JointChannel jointChannel = new JointChannel(joint, time, transforms); - animationClip.addChannel(jointChannel); - _colladaStorage.getAnimationChannels().add(jointChannel); + // create joint channel + final JointChannel jointChannel = new JointChannel(joint, time, transforms); + animationClip.addChannel(jointChannel); + _colladaStorage.getAnimationChannels().add(jointChannel); + } } /** @@ -836,7 +837,6 @@ public class ColladaAnimUtils { * @param animationRoot * @param animationItemRoot */ - @SuppressWarnings("unchecked") private void parseAnimations(final Multimap<Element, TargetChannel> channelMap, final Element animationRoot, final AnimationItem animationItemRoot) { if (animationRoot.getChild("animation") != null) { @@ -1116,7 +1116,6 @@ public class ColladaAnimUtils { return str.toString(); } - @SuppressWarnings("unchecked") private static void getElementString(final Element e, final StringBuilder str, final int depth, final int maxDepth, final boolean showDots) { addSpacing(str, depth); @@ -1138,7 +1137,7 @@ public class ColladaAnimUtils { str.append('>'); if (depth < maxDepth) { str.append('\n'); - for (final Element child : (List<Element>) e.getChildren()) { + for (final Element child : e.getChildren()) { getElementString(child, str, depth + 1, maxDepth, showDots); } if (!"".equals(e.getText())) { diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java index 2bff121..a881fc5 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java @@ -299,7 +299,6 @@ public class ColladaDOMUtil { public void stripNamespace(final Element rootElement) { rootElement.setNamespace(null); - @SuppressWarnings("unchecked") final List<Element> children = rootElement.getChildren(); final Iterator<Element> i = children.iterator(); while (i.hasNext()) { @@ -362,7 +361,6 @@ public class ColladaDOMUtil { * @param v * @return */ - @SuppressWarnings("unchecked") public Element getPositionSource(final Element v) { for (final Element input : v.getChildren("input")) { if ("POSITION".equals(input.getAttributeValue("semantic"))) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java index 4c51259..5025e1c 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java @@ -867,10 +867,10 @@ public class ExampleRunner extends JFrame { classNameLabel.setText("Null"); // Throw an exception? classNameLabel.setFont(defaultFont); } else { - if ((value != null) && (value instanceof Class<?>)) { + if (value instanceof Class<?>) { final Class<?> clazz = (Class<?>) value; classNameLabel.setText(clazz.getSimpleName()); - } else if ((value != null) && value instanceof Package) { + } else if (value instanceof Package) { String name = ((Package) value).getName(); if (name.startsWith(tree.getModel().getRoot().toString())) { name = name.substring(tree.getModel().getRoot().toString().length() + 1); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java index d5baa45..5124b44 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java @@ -70,15 +70,15 @@ public final class PropertiesDialog extends JDialog { // UI components private JCheckBox fullscreenBox = null; - private JComboBox displayResCombo = null; + private JComboBox<String> displayResCombo = null; - private JComboBox samplesCombo = null; + private JComboBox<String> samplesCombo = null; - private JComboBox colorDepthCombo = null; + private JComboBox<String> colorDepthCombo = null; - private JComboBox displayFreqCombo = null; + private JComboBox<String> displayFreqCombo = null; - private JComboBox rendererCombo = null; + private JComboBox<String> rendererCombo = null; private JLabel icon = null; @@ -266,9 +266,9 @@ public final class PropertiesDialog extends JDialog { displayResCombo.addKeyListener(aListener); samplesCombo = setUpSamplesChooser(); samplesCombo.addKeyListener(aListener); - colorDepthCombo = new JComboBox(); + colorDepthCombo = new JComboBox<String>(); colorDepthCombo.addKeyListener(aListener); - displayFreqCombo = new JComboBox(); + displayFreqCombo = new JComboBox<String>(); displayFreqCombo.addKeyListener(aListener); fullscreenBox = new JCheckBox("Fullscreen?"); fullscreenBox.setSelected(source.isFullscreen()); @@ -411,9 +411,9 @@ public final class PropertiesDialog extends JDialog { * * @return the combo box of display modes. */ - private JComboBox setUpResolutionChooser() { + private JComboBox<String> setUpResolutionChooser() { final String[] res = getResolutions(modes); - final JComboBox resolutionBox = new JComboBox(res); + final JComboBox<String> resolutionBox = new JComboBox<String>(res); resolutionBox.setSelectedItem(source.getWidth() + " x " + source.getHeight()); resolutionBox.addActionListener(new ActionListener() { @@ -432,9 +432,9 @@ public final class PropertiesDialog extends JDialog { * * @return the list of renderers. */ - private JComboBox setUpRendererChooser() { - final JComboBox nameBox = new JComboBox(new String[] { "JOGL 2" }); - final String old = source.getRenderer(); + private JComboBox<String> setUpRendererChooser() { + final JComboBox<String> nameBox = new JComboBox<String>(new String[] { "JOGL 2" }); + // final String old = source.getRenderer(); /* * if (old != null) { if (old.startsWith("JOGL")) { */ @@ -445,8 +445,8 @@ public final class PropertiesDialog extends JDialog { return nameBox; } - private JComboBox setUpSamplesChooser() { - final JComboBox nameBox = new JComboBox(samples); + private JComboBox<String> setUpSamplesChooser() { + final JComboBox<String> nameBox = new JComboBox<String>(samples); nameBox.setSelectedItem(source.getRenderer()); return nameBox; } @@ -472,11 +472,11 @@ public final class PropertiesDialog extends JDialog { // grab available depths final String[] depths = getDepths(resolution, modes); - colorDepthCombo.setModel(new DefaultComboBoxModel(depths)); + colorDepthCombo.setModel(new DefaultComboBoxModel<String>(depths)); colorDepthCombo.setSelectedItem(colorDepth); // grab available frequencies final String[] freqs = getFrequencies(resolution, modes); - displayFreqCombo.setModel(new DefaultComboBoxModel(freqs)); + displayFreqCombo.setModel(new DefaultComboBoxModel<String>(freqs)); // Try to reset freq displayFreqCombo.setSelectedItem(displayFreq); } @@ -488,12 +488,12 @@ public final class PropertiesDialog extends JDialog { */ private void updateResolutionChoices() { if (!fullscreenBox.isSelected()) { - displayResCombo.setModel(new DefaultComboBoxModel(windowedResolutions)); - colorDepthCombo.setModel(new DefaultComboBoxModel(new String[] { "24 bpp", "16 bpp" })); - displayFreqCombo.setModel(new DefaultComboBoxModel(new String[] { "n/a" })); + displayResCombo.setModel(new DefaultComboBoxModel<String>(windowedResolutions)); + colorDepthCombo.setModel(new DefaultComboBoxModel<String>(new String[] { "24 bpp", "16 bpp" })); + displayFreqCombo.setModel(new DefaultComboBoxModel<String>(new String[] { "n/a" })); displayFreqCombo.setEnabled(false); } else { - displayResCombo.setModel(new DefaultComboBoxModel(getResolutions(modes))); + displayResCombo.setModel(new DefaultComboBoxModel<String>(getResolutions(modes))); displayFreqCombo.setEnabled(true); updateDisplayChoices(); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/TestAtlasPacker.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/TestAtlasPacker.java index 06db12a..2df7c4e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/TestAtlasPacker.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/TestAtlasPacker.java @@ -15,7 +15,6 @@ import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; -import com.ardor3d.extension.atlas.AtlasNode; import com.ardor3d.extension.atlas.AtlasPacker; /** @@ -30,7 +29,7 @@ public class TestAtlasPacker { final Random rand = new Random(); for (int i = 0; i < 2000; i++) { - final AtlasNode node = packer.insert(rand.nextInt(100) + 10, rand.nextInt(100) + 10); + /* final AtlasNode node = */packer.insert(rand.nextInt(100) + 10, rand.nextInt(100) + 10); } final JFrame frame = new JFrame("Pack"); |