[Committed] Additional Implementation of GameStateNode's hasChild()

This is  a second implementation of the hasChild method in GameStateNode that takes a String parameter to check for a GameState's existence based on its name.  Useful for finding a GameState when outside of your application's main class (or whatever class is managing GameStates).



Index: src/com/jmex/game/state/GameStateNode.java
===================================================================
--- src/com/jmex/game/state/GameStateNode.java   (revision 4783)
+++ src/com/jmex/game/state/GameStateNode.java   (working copy)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2009 jMonkeyEngine
+ * Copyright (c) 2003-2010 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -191,7 +191,7 @@
      * Determines if the provided <code>GameState</code> is contained in the
      * children list of this node.
      *
-     * @param state the <code>GameState</code> object to check.
+     * @param state The <code>GameState</code> object to check.
      * @return true if the object is contained, false otherwise.
      */
     public boolean hasChild(G state) {
@@ -199,6 +199,21 @@
     }
    
     /**
+     * Determines if a <code>GameState</code> with the name provided is contained
+     * in the children list of this node.
+     * @param stateName The name of the <code>GameState</code> being searched for.
+     * @return true if a <code>GameState</code> with the name provided is found.
+     */
+    public boolean hasChild(String stateName){
+       Iterator<G> gsIterator = children.iterator();
+       while(gsIterator.hasNext()){
+          if(stateName.equals(gsIterator.next().getName()))
+             return true;
+       }
+       return false;
+    }
+    
+    /**
      * Will call setActive(true) on all GameStates maintained.
      */
     public void activateAllChildren() {