Computation as an Expressive Computation as an Expressive MediumMediumMediumMediumLab Lab 99: Lamb Chop’s Play: Lamb Chop’s Play--AlongAlongJoshua CuneoJoshua CuneoAgendaAgendaAgendaAgenda RecursionRecursionHTMLHTMLParsing PartParsing PartII III IHTML HTML Parsing, Part Parsing, Part II.III.I Project Project 4 4 + Examples+ ExamplesRecursionRecursionRecursionRecursionvoid method1()void method1() {println("I'm in method 1");th d2()method2();}void method2() {println("I'm in method 2");p();}RecursionRecursionRecursionRecursionid th d1()void method1() {println("Beginning of method 1");method1();println("End of method 1");}}Rec sionRec sionRecursionRecursionRecursion basically means calling aRecursion basically means calling aRecursion basically means calling a Recursion basically means calling a method from inside itself.method from inside itself.int factorial(int n) {if(n >1){What the?!?if(n > 1) {return n * factorial(n-1);}lt1else return 1;}Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!ftil(3)itf t il(it ){(3)factorial(3);int factorial(int n) {if(n > 1) {return n * factorial(n-1);}(n = 3) }else return 1;}Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!factorial(3);int factorial(int n) {(n3)factorial(3);int factorial(int n) {if(n > 1) {return n * factorial(n-1);}else return 1;(n = 3);}int factorial(int n) {if(n > 1) {return n * factorial(n1);(n = 2) return n * factorial(n-1);}else return 1;}Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!factorial(3);int factorial(int n) {(n3)int factorial(int n) {(n2)factorial(3);int factorial(int n) {if(n > 1) {return n * factorial(n-1);}else return 1;(n = 3)int factorial(int n) {if(n > 1) {return n * factorial(n-1);}else return 1;(n = 2);};}int factorial(int n) {if(n >1){(n = 1) if(n > 1) {return n * factorial(n-1);}else return 1;}Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!factorial(3);int factorial(int n) {(n3)int factorial(int n) {(n2)factorial(3);int factorial(int n) {if(n > 1) {return n * factorial(n-1);}else return 1;(n = 3)int factorial(int n) {if(n > 1) {return n * factorial(n-1);}else return 1;(n = 2);};}1Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!factorial(3);int factorial(int n) {(n3)factorial(3);int factorial(int n) {if(n > 1) {return n * factorial(n-1);}else return 1;(n = 3);}int factorial(int n) {if(n > 1) {return n *1;(n = 2) return n * 1;}else return 1;}Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!factorial(3);int factorial(int n) {(n3)factorial(3);int factorial(int n) {if(n > 1) {return n * factorial(n-1);}else return 1;(n = 3);}int factorial(int n) {if(n > 1) {return2*1;(n = 2) return 2 * 1;}else return 1;}Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!factorial(3);int factorial(int n) {(n3)factorial(3);int factorial(int n) {if(n > 1) {return n * factorial(n-1);}else return 1;(n = 3);}2Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!ftil(3)itf t il(it ){(3)factorial(3);int factorial(int n) {if(n > 1) {return n * 2;}(n = 3) }else return 1;}Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!ftil(3)itf t il(it ){(3)factorial(3);int factorial(int n) {if(n > 1) {return 3 * 2;}(n = 3) }else return 1;}Inside Itself?!Inside Itself?!Inside Itself?!Inside Itself?!ftil(3)6factorial(3);6HTMLHTMLHTMLHTML<font color = “red”>Some stuff.</font>AttributeTag Text End TagHTMLHTMLHTMLHTML<html></html>HTMLHTMLHTMLHTML<html><head></head></html>HTMLHTMLHTMLHTML<html><head><title>Welcome to Awesome Class!!!</title><title>Welcome to Awesome Class!!!</title></head></html>HTMLHTMLHTMLHTML<html><head><title>Welcome to Awesome Class!!!</title><title>Welcome to Awesome Class!!!</title></head><body><body></body></html>HTMLHTMLHTMLHTML<html><head><title>Welcome to Awesome Class!!!</title><title>Welcome to Awesome Class!!!</title></head><body><body>This is awesome class!!!</body></html>HTML HierarchyHTML HierarchyHTML HierarchyHTML Hierarchy<html>html<head><title>Welcome to Awesome Class!!!</title></head><body>This is awesome class!!!head bodytitleThis is Awesome</body></html>eWelcome to Awesome Class!!!This is Awesome Class!!!Awesome Class!!!HTML HierarchyHTML HierarchyHTML HierarchyHTML Hierarchy<html>html<head><title>Welcome to Awesome Class!!!</title></head><body>This is awesome class!!!head bodytitleThis is Awesome</body></html>eWelcome to Awesome Class!!!This is Awesome Class!!!Awesome Class!!!HTML HierarchyHTML HierarchyHTML HierarchyHTML Hierarchy<html>html<head><title>Welcome to Awesome Class!!!</title></head><body>This is awesome class!!!head bodytitleThis is Awesome</body></html>tteWelcome to Awesome Class!!!This is Awesome Class!!!Awesome Class!!!HTML HierarchyHTML HierarchyHTML HierarchyHTML Hierarchy<html>html<head><title>Welcome to Awesome Class!!!</title></head><body>This is awesome class!!!head bodytitleThis is Awesome</body></html>eWelcome to Awesome Class!!!This is Awesome Class!!!Awesome Class!!!HTML HierarchyHTML HierarchyHTML HierarchyHTML Hierarchy<html>html<head><title>Welcome to Awesome Class!!!</title></head><body>This is awesome class!!!head bodytitleThis is Awesome</body></html>eWelcome to Awesome Class!!!This is Awesome Class!!!Awesome Class!!!HTML ParsingHTML ParsingHTML ParsingHTML ParsingSpace: The Final Frontier. These are the voyages of the <b>Starship Enterprise</b>. It’s continuing mission: to explore strange new worlds, to seek out new life and new civilizations <b>to boldly go</b> where no onecivilizations, <b>to boldly go</b> where no one has gone before.HTML ParsingHTML ParsingHTML ParsingHTML ParsingSpace: The Final Frontier. These are the voyages of the <b>Starship Enterprise</b>. It’s continuing mission: to explore strange new worlds, to seek out new life and new civilizations<b>to boldly go</b>where no onecivilizations, <b>to boldly go</b>where no one has gone before.HTMLParserHTMLParserhttp://htmlparser sourceforge nethttp://htmlparser sourceforge nethttp://htmlparser.sourceforge.nethttp://htmlparser.sourceforge.netHTMLParserHTMLParserHTMLParserHTMLParserimport org.htmlparser.*;import org.htmlparser.util.*;Parser parser;NodeList nodelist;HTMLParserHTMLParserHTMLParserHTMLParservoid setup(){{String url = "http://lcc.gatech.edu/~bmagerko6/classes/";url += "LCC6310/examples/parseTest.htm";hl (l)parser = new org.htmlparser.Parser(url);nodelist = parser.parse(null);}NOT
View Full Document