Created
May 29, 2015 19:14
-
-
Save t81lal/2f37b9edaed99ae85766 to your computer and use it in GitHub Desktop.
Breadth first
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private NumberNode firstNumber(AbstractNode node) { | |
if(node == null || node.children() == 0) | |
return null; | |
for(AbstractNode n : node) { | |
if(n instanceof NumberNode) | |
return (NumberNode) n; | |
} | |
for(AbstractNode n : node) { | |
NumberNode n1 = firstNumber(n); | |
if(n1 != null) | |
return n1; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this right?