[{"data":1,"prerenderedAt":4849},["ShallowReactive",2],{"item-lessons-light-ch25-command-based-programming":3,"item-examples-light-ch25-command-based-programming":444,"item-exercises-light-ch25-command-based-programming":753,"item-lesson-full-ch25-command-based-programming-25.5":1070,"item-example-full-ch25-command-based-programming-25.5":1707,"item-exercise-full-ch25-command-based-programming-25.5":2485},[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276,280,284,288,292,296,300,304,308,312,316,320,324,328,332,336,340,344,348,352,356,360,364,368,372,376,380,384,388,392,396,400,404,408,412,416,420,424,428,432,436,440],{"path":5,"title":6,"stem":7},"\u002Fshockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1-why-java-for-frc","Why Java for FRC?","shockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1.1-why-java-for-frc",{"path":9,"title":10,"stem":11},"\u002Fshockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers","shockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":13,"title":14,"stem":15},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":17,"title":18,"stem":19},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":21,"title":22,"stem":23},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":25,"title":26,"stem":27},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":29,"title":30,"stem":31},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":33,"title":34,"stem":35},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":37,"title":38,"stem":39},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":41,"title":42,"stem":43},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":45,"title":46,"stem":47},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":49,"title":50,"stem":51},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":53,"title":54,"stem":55},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":57,"title":58,"stem":59},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":61,"title":62,"stem":63},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":65,"title":66,"stem":67},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":69,"title":70,"stem":71},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","Control Structures: if Statements & For Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":73,"title":74,"stem":75},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":77,"title":78,"stem":79},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":81,"title":82,"stem":83},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":85,"title":86,"stem":87},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":89,"title":90,"stem":91},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":93,"title":94,"stem":95},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":97,"title":98,"stem":99},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":101,"title":102,"stem":103},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws)","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":105,"title":106,"stem":107},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F8-while-loops","While Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.8-while-loops",{"path":109,"title":110,"stem":111},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":113,"title":114,"stem":115},"\u002Fshockwave-curriculum\u002Flessons\u002Fch06-strings\u002F1-strings","Strings","shockwave-curriculum\u002Flessons\u002Fch06-strings\u002F6.1-strings",{"path":117,"title":118,"stem":119},"\u002Fshockwave-curriculum\u002Flessons\u002Fch06-strings\u002F2-string-algorithms","String Algorithms","shockwave-curriculum\u002Flessons\u002Fch06-strings\u002F6.2-string-algorithms",{"path":121,"title":122,"stem":123},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","The Class Blueprint","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":125,"title":126,"stem":127},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":129,"title":130,"stem":131},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":133,"title":134,"stem":135},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":137,"title":138,"stem":139},"\u002Fshockwave-curriculum\u002Flessons\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\"","shockwave-curriculum\u002Flessons\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":141,"title":142,"stem":143},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":145,"title":146,"stem":147},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":149,"title":150,"stem":151},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":153,"title":154,"stem":155},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":157,"title":158,"stem":159},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":161,"title":162,"stem":163},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":165,"title":166,"stem":167},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":169,"title":170,"stem":171},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":173,"title":174,"stem":175},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":177,"title":178,"stem":179},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":181,"title":182,"stem":183},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":185,"title":186,"stem":187},"\u002Fshockwave-curriculum\u002Flessons\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices","shockwave-curriculum\u002Flessons\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":189,"title":190,"stem":191},"\u002Fshockwave-curriculum\u002Flessons\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch","shockwave-curriculum\u002Flessons\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":193,"title":194,"stem":195},"\u002Fshockwave-curriculum\u002Flessons\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas","shockwave-curriculum\u002Flessons\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":197,"title":198,"stem":199},"\u002Fshockwave-curriculum\u002Flessons\u002Fch14-why-design-patterns\u002F14-why-design-patterns","Why Design Patterns?","shockwave-curriculum\u002Flessons\u002Fch14-why-design-patterns\u002F14-why-design-patterns",{"path":201,"title":202,"stem":203},"\u002Fshockwave-curriculum\u002Flessons\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap)","shockwave-curriculum\u002Flessons\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":205,"title":206,"stem":207},"\u002Fshockwave-curriculum\u002Flessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics","shockwave-curriculum\u002Flessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":209,"title":210,"stem":211},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":213,"title":214,"stem":215},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":217,"title":218,"stem":219},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":221,"title":222,"stem":223},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":225,"title":226,"stem":227},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":229,"title":230,"stem":231},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":233,"title":234,"stem":235},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":237,"title":238,"stem":239},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":241,"title":242,"stem":243},"\u002Fshockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts","shockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":245,"title":246,"stem":247},"\u002Fshockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References","shockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":249,"title":250,"stem":251},"\u002Fshockwave-curriculum\u002Flessons\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern","shockwave-curriculum\u002Flessons\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":253,"title":254,"stem":255},"\u002Fshockwave-curriculum\u002Flessons\u002Fch21-static-factories\u002F21-static-factories","Static Factories","shockwave-curriculum\u002Flessons\u002Fch21-static-factories\u002F21-static-factories",{"path":257,"title":258,"stem":259},"\u002Fshockwave-curriculum\u002Flessons\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern","shockwave-curriculum\u002Flessons\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":261,"title":262,"stem":263},"\u002Fshockwave-curriculum\u002Flessons\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability","shockwave-curriculum\u002Flessons\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":265,"title":266,"stem":267},"\u002Fshockwave-curriculum\u002Flessons\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions","shockwave-curriculum\u002Flessons\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":269,"title":270,"stem":271},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming?","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":273,"title":274,"stem":275},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":277,"title":278,"stem":279},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":281,"title":282,"stem":283},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":285,"title":286,"stem":287},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":289,"title":290,"stem":291},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":293,"title":294,"stem":295},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":297,"title":298,"stem":299},"\u002Fshockwave-curriculum\u002Flessons\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways","shockwave-curriculum\u002Flessons\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":301,"title":302,"stem":303},"\u002Fshockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design","shockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":305,"title":306,"stem":307},"\u002Fshockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F2-impact-of-program-design","Impact of Program Design","shockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F27.2-impact-of-program-design",{"path":309,"title":310,"stem":311},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":313,"title":314,"stem":315},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":317,"title":318,"stem":319},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":321,"title":322,"stem":323},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",{"path":325,"title":326,"stem":327},"\u002Fshockwave-curriculum\u002Flessons\u002Fch29-git-and-github-basics\u002F1-coming-soon","Git & GitHub Basics — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch29-git-and-github-basics\u002F29.1-coming-soon",{"path":329,"title":330,"stem":331},"\u002Fshockwave-curriculum\u002Flessons\u002Fch30-git-history-and-merging\u002F1-coming-soon","Git — History & Merging — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch30-git-history-and-merging\u002F30.1-coming-soon",{"path":333,"title":334,"stem":335},"\u002Fshockwave-curriculum\u002Flessons\u002Fch31-dev-environment-and-tooling\u002F1-coming-soon","Dev Environment & Tooling — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch31-dev-environment-and-tooling\u002F31.1-coming-soon",{"path":337,"title":338,"stem":339},"\u002Fshockwave-curriculum\u002Flessons\u002Fch32-unit-testing\u002F1-coming-soon","Unit Testing — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch32-unit-testing\u002F32.1-coming-soon",{"path":341,"title":342,"stem":343},"\u002Fshockwave-curriculum\u002Flessons\u002Fch33-advantagekit-autologging\u002F1-coming-soon","AdvantageKit — AutoLogging — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch33-advantagekit-autologging\u002F33.1-coming-soon",{"path":345,"title":346,"stem":347},"\u002Fshockwave-curriculum\u002Flessons\u002Fch34-log-replay\u002F1-coming-soon","Log Replay — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch34-log-replay\u002F34.1-coming-soon",{"path":349,"title":350,"stem":351},"\u002Fshockwave-curriculum\u002Flessons\u002Fch35-advantagescope-i-visualization\u002F1-coming-soon","AdvantageScope I: Visualization — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch35-advantagescope-i-visualization\u002F35.1-coming-soon",{"path":353,"title":354,"stem":355},"\u002Fshockwave-curriculum\u002Flessons\u002Fch36-advantagescope-ii-custom-3d-assets\u002F1-coming-soon","AdvantageScope II: Custom 3D Assets — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch36-advantagescope-ii-custom-3d-assets\u002F36.1-coming-soon",{"path":357,"title":358,"stem":359},"\u002Fshockwave-curriculum\u002Flessons\u002Fch37-autonomous-i\u002F1-coming-soon","Autonomous I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch37-autonomous-i\u002F37.1-coming-soon",{"path":361,"title":362,"stem":363},"\u002Fshockwave-curriculum\u002Flessons\u002Fch38-autonomous-ii-pathplanner-and-trajectories\u002F1-coming-soon","Autonomous II: PathPlanner & Trajectories — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch38-autonomous-ii-pathplanner-and-trajectories\u002F38.1-coming-soon",{"path":365,"title":366,"stem":367},"\u002Fshockwave-curriculum\u002Flessons\u002Fch39-control-fundamentals\u002F1-coming-soon","Control Fundamentals — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch39-control-fundamentals\u002F39.1-coming-soon",{"path":369,"title":370,"stem":371},"\u002Fshockwave-curriculum\u002Flessons\u002Fch40-motion-profiles\u002F1-coming-soon","Motion Profiles — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch40-motion-profiles\u002F40.1-coming-soon",{"path":373,"title":374,"stem":375},"\u002Fshockwave-curriculum\u002Flessons\u002Fch41-hardware-fundamentals\u002F1-coming-soon","Hardware Fundamentals — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch41-hardware-fundamentals\u002F41.1-coming-soon",{"path":377,"title":378,"stem":379},"\u002Fshockwave-curriculum\u002Flessons\u002Fch42-photonvision\u002F1-coming-soon","PhotonVision — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch42-photonvision\u002F42.1-coming-soon",{"path":381,"title":382,"stem":383},"\u002Fshockwave-curriculum\u002Flessons\u002Fch43-apriltags-and-pose\u002F1-coming-soon","AprilTags & Pose — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch43-apriltags-and-pose\u002F43.1-coming-soon",{"path":385,"title":386,"stem":387},"\u002Fshockwave-curriculum\u002Flessons\u002Fch44-subsystems-i\u002F1-coming-soon","Subsystems I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch44-subsystems-i\u002F44.1-coming-soon",{"path":389,"title":390,"stem":391},"\u002Fshockwave-curriculum\u002Flessons\u002Fch45-subsystems-ii-advanced\u002F1-coming-soon","Subsystems II — Advanced — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch45-subsystems-ii-advanced\u002F45.1-coming-soon",{"path":393,"title":394,"stem":395},"\u002Fshockwave-curriculum\u002Flessons\u002Fch46-team-utilities-i\u002F1-coming-soon","Team Utilities I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch46-team-utilities-i\u002F46.1-coming-soon",{"path":397,"title":398,"stem":399},"\u002Fshockwave-curriculum\u002Flessons\u002Fch47-field-constants\u002F1-coming-soon","Field Constants — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch47-field-constants\u002F47.1-coming-soon",{"path":401,"title":402,"stem":403},"\u002Fshockwave-curriculum\u002Flessons\u002Fch48-troubleshooting-i-runtime-debug\u002F1-coming-soon","Troubleshooting I — Runtime Debug — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch48-troubleshooting-i-runtime-debug\u002F48.1-coming-soon",{"path":405,"title":406,"stem":407},"\u002Fshockwave-curriculum\u002Flessons\u002Fch49-troubleshooting-ii-can-and-sim\u002F1-coming-soon","Troubleshooting II: CAN & Sim — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch49-troubleshooting-ii-can-and-sim\u002F49.1-coming-soon",{"path":409,"title":410,"stem":411},"\u002Fshockwave-curriculum\u002Flessons\u002Fch50-vendor-libraries-talonfx\u002F1-coming-soon","Vendor Libraries: TalonFX — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch50-vendor-libraries-talonfx\u002F50.1-coming-soon",{"path":413,"title":414,"stem":415},"\u002Fshockwave-curriculum\u002Flessons\u002Fch51-robot-alerts\u002F1-coming-soon","Robot Alerts — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch51-robot-alerts\u002F51.1-coming-soon",{"path":417,"title":418,"stem":419},"\u002Fshockwave-curriculum\u002Flessons\u002Fch52-wpilib-commands\u002F1-coming-soon","WPILib Commands — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch52-wpilib-commands\u002F52.1-coming-soon",{"path":421,"title":422,"stem":423},"\u002Fshockwave-curriculum\u002Flessons\u002Fch53-wpilib-geometry\u002F1-coming-soon","WPILib Geometry — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch53-wpilib-geometry\u002F53.1-coming-soon",{"path":425,"title":426,"stem":427},"\u002Fshockwave-curriculum\u002Flessons\u002Fch54-networktables\u002F1-coming-soon","NetworkTables — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch54-networktables\u002F54.1-coming-soon",{"path":429,"title":430,"stem":431},"\u002Fshockwave-curriculum\u002Flessons\u002Fch55-command-scheduler\u002F1-coming-soon","Command Scheduler — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch55-command-scheduler\u002F55.1-coming-soon",{"path":433,"title":434,"stem":435},"\u002Fshockwave-curriculum\u002Flessons\u002Fch56-wpilib-timers\u002F1-coming-soon","WPILib Timers — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch56-wpilib-timers\u002F56.1-coming-soon",{"path":437,"title":438,"stem":439},"\u002Fshockwave-curriculum\u002Flessons\u002Fch57-wpilib-triggers\u002F1-coming-soon","WPILib Triggers — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch57-wpilib-triggers\u002F57.1-coming-soon",{"path":441,"title":442,"stem":443},"\u002Fshockwave-curriculum\u002Flessons\u002Fch58-vendor-units-and-conversions\u002F1-coming-soon","Vendor Units & Conversions — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch58-vendor-units-and-conversions\u002F58.1-coming-soon",[445,449,453,457,461,465,469,473,477,481,485,489,493,497,501,505,509,513,517,521,525,529,533,537,541,545,549,553,557,561,565,569,573,577,581,585,589,593,597,601,605,609,613,617,621,625,629,633,637,641,645,649,653,657,661,665,669,673,677,681,685,689,693,697,701,705,709,713,717,721,725,729,733,737,741,745,749],{"path":446,"title":447,"stem":448},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":450,"title":451,"stem":452},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":454,"title":455,"stem":456},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":458,"title":459,"stem":460},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":462,"title":463,"stem":464},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":466,"title":467,"stem":468},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":470,"title":471,"stem":472},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":474,"title":475,"stem":476},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":478,"title":479,"stem":480},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":482,"title":483,"stem":484},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":486,"title":487,"stem":488},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":490,"title":491,"stem":492},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":494,"title":495,"stem":496},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":498,"title":499,"stem":500},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":502,"title":503,"stem":504},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":506,"title":507,"stem":508},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","if Statements & For Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":510,"title":511,"stem":512},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":514,"title":515,"stem":516},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":518,"title":519,"stem":520},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":522,"title":523,"stem":524},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":526,"title":527,"stem":528},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":530,"title":531,"stem":532},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":534,"title":535,"stem":536},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":538,"title":539,"stem":540},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws) — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":542,"title":543,"stem":544},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F8-while-loops","While Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.8-while-loops",{"path":546,"title":547,"stem":548},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":550,"title":551,"stem":552},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F1-strings","Strings — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F6.1-strings",{"path":554,"title":555,"stem":556},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F2-string-algorithms","String Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F6.2-string-algorithms",{"path":558,"title":559,"stem":560},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","Anatomy of a Java Class — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":562,"title":563,"stem":564},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":566,"title":567,"stem":568},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":570,"title":571,"stem":572},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":574,"title":575,"stem":576},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\" — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":578,"title":579,"stem":580},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":582,"title":583,"stem":584},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":586,"title":587,"stem":588},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":590,"title":591,"stem":592},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":594,"title":595,"stem":596},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":598,"title":599,"stem":600},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":602,"title":603,"stem":604},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":606,"title":607,"stem":608},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":610,"title":611,"stem":612},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":614,"title":615,"stem":616},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":618,"title":619,"stem":620},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":622,"title":623,"stem":624},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":626,"title":627,"stem":628},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":630,"title":631,"stem":632},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":634,"title":635,"stem":636},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap) — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":638,"title":639,"stem":640},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":642,"title":643,"stem":644},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":646,"title":647,"stem":648},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":650,"title":651,"stem":652},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":654,"title":655,"stem":656},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":658,"title":659,"stem":660},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":662,"title":663,"stem":664},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":666,"title":667,"stem":668},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":670,"title":671,"stem":672},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":674,"title":675,"stem":676},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":678,"title":679,"stem":680},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":682,"title":683,"stem":684},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":686,"title":687,"stem":688},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch21-static-factories\u002F21-static-factories","Static Factories — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch21-static-factories\u002F21-static-factories",{"path":690,"title":691,"stem":692},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":694,"title":695,"stem":696},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":698,"title":699,"stem":700},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":702,"title":703,"stem":704},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming? — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":706,"title":707,"stem":708},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":710,"title":711,"stem":712},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":714,"title":715,"stem":716},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":718,"title":719,"stem":720},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":722,"title":723,"stem":724},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":726,"title":727,"stem":728},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":730,"title":731,"stem":732},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":734,"title":735,"stem":736},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":738,"title":739,"stem":740},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":742,"title":743,"stem":744},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":746,"title":747,"stem":748},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":750,"title":751,"stem":752},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",[754,758,762,766,770,774,778,782,786,790,794,798,802,806,810,814,818,822,826,830,834,838,842,846,850,854,858,862,866,870,874,878,882,886,890,894,898,902,906,910,914,918,922,926,930,934,938,942,946,950,954,958,962,966,970,974,978,982,986,990,994,998,1002,1006,1010,1014,1018,1022,1026,1030,1034,1038,1042,1046,1050,1054,1058,1062,1066],{"path":755,"title":756,"stem":757},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers — Exercises","shockwave-curriculum\u002Fexercises\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":759,"title":760,"stem":761},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":763,"title":764,"stem":765},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":767,"title":768,"stem":769},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":771,"title":772,"stem":773},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":775,"title":776,"stem":777},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":779,"title":780,"stem":781},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":783,"title":784,"stem":785},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":787,"title":788,"stem":789},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":791,"title":792,"stem":793},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":795,"title":796,"stem":797},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":799,"title":800,"stem":801},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":803,"title":804,"stem":805},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":807,"title":808,"stem":809},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":811,"title":812,"stem":813},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":815,"title":816,"stem":817},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","if Statements & For Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":819,"title":820,"stem":821},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":823,"title":824,"stem":825},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":827,"title":828,"stem":829},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":831,"title":832,"stem":833},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":835,"title":836,"stem":837},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":839,"title":840,"stem":841},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":843,"title":844,"stem":845},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":847,"title":848,"stem":849},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws) — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":851,"title":852,"stem":853},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F8-while-loops","While Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.8-while-loops",{"path":855,"title":856,"stem":857},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":859,"title":860,"stem":861},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F1-strings","Strings — Exercises","shockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F6.1-strings",{"path":863,"title":864,"stem":865},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F2-string-algorithms","String Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F6.2-string-algorithms",{"path":867,"title":868,"stem":869},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","Anatomy of a Java Class — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":871,"title":872,"stem":873},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":875,"title":876,"stem":877},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":879,"title":880,"stem":881},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":883,"title":884,"stem":885},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\" — Exercises","shockwave-curriculum\u002Fexercises\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":887,"title":888,"stem":889},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":891,"title":892,"stem":893},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":895,"title":896,"stem":897},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":899,"title":900,"stem":901},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":903,"title":904,"stem":905},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":907,"title":908,"stem":909},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":911,"title":912,"stem":913},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":915,"title":916,"stem":917},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":919,"title":920,"stem":921},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":923,"title":924,"stem":925},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":927,"title":928,"stem":929},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":931,"title":932,"stem":933},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices — Exercises","shockwave-curriculum\u002Fexercises\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":935,"title":936,"stem":937},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch — Exercises","shockwave-curriculum\u002Fexercises\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":939,"title":940,"stem":941},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas — Exercises","shockwave-curriculum\u002Fexercises\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":943,"title":944,"stem":945},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch14-why-design-patterns\u002F14-why-design-patterns","Why Design Patterns? — Exercises","shockwave-curriculum\u002Fexercises\u002Fch14-why-design-patterns\u002F14-why-design-patterns",{"path":947,"title":948,"stem":949},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap) — Exercises","shockwave-curriculum\u002Fexercises\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":951,"title":952,"stem":953},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics — Exercises","shockwave-curriculum\u002Fexercises\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":955,"title":956,"stem":957},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":959,"title":960,"stem":961},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":963,"title":964,"stem":965},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":967,"title":968,"stem":969},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":971,"title":972,"stem":973},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":975,"title":976,"stem":977},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":979,"title":980,"stem":981},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":983,"title":984,"stem":985},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":987,"title":988,"stem":989},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts — Exercises","shockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":991,"title":992,"stem":993},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References — Exercises","shockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":995,"title":996,"stem":997},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern — Exercises","shockwave-curriculum\u002Fexercises\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":999,"title":1000,"stem":1001},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch21-static-factories\u002F21-static-factories","Static Factories — Exercises","shockwave-curriculum\u002Fexercises\u002Fch21-static-factories\u002F21-static-factories",{"path":1003,"title":1004,"stem":1005},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern — Exercises","shockwave-curriculum\u002Fexercises\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":1007,"title":1008,"stem":1009},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability — Exercises","shockwave-curriculum\u002Fexercises\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":1011,"title":1012,"stem":1013},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":1015,"title":1016,"stem":1017},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming? — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":1019,"title":1020,"stem":1021},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":1023,"title":1024,"stem":1025},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":1027,"title":1028,"stem":1029},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":1031,"title":1032,"stem":1033},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":1035,"title":1036,"stem":1037},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":1039,"title":1040,"stem":1041},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":1043,"title":1044,"stem":1045},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways — Exercises","shockwave-curriculum\u002Fexercises\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":1047,"title":1048,"stem":1049},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design — Exercises","shockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":1051,"title":1052,"stem":1053},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F2-impact-of-program-design","Impact of Program Design — Exercises","shockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F27.2-impact-of-program-design",{"path":1055,"title":1056,"stem":1057},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":1059,"title":1060,"stem":1061},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":1063,"title":1064,"stem":1065},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":1067,"title":1068,"stem":1069},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",{"id":1071,"title":286,"body":1072,"description":1119,"extension":1700,"meta":1701,"navigation":1704,"path":285,"seo":1705,"stem":287,"__hash__":1706},"lessons\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.5-managing-transitions.md",{"type":1073,"value":1074,"toc":1689},"minimark",[1075,1079,1089,1113,1340,1387,1391,1398,1431,1438,1442,1470,1474,1489,1522,1535,1543,1556,1560,1610,1614,1652,1685],[1076,1077,286],"h1",{"id":1078},"managing-transitions",[1080,1081,1083,1084,1088],"h2",{"id":1082},"from-diagram-to-code-one-switch-one-case-per-state","From Diagram to Code: One ",[1085,1086,1087],"code",{},"switch",", One Case per State",[1090,1091,1092,1093,1096,1097,1099,1100,1103,1104,1108,1109,1112],"p",{},"Lesson 25.4 designed the intake's state machine — four states, a start state, and a transition table — and gave the mechanism a single enum field, ",[1085,1094,1095],{},"currentState",". Turning the design into code takes one ",[1085,1098,1087],{}," over that field, using the arrow form from Lesson 5.12. Each ",[1085,1101,1102],{},"case"," does two jobs: it runs that state's ",[1105,1106,1107],"strong",{},"state action",", then checks the ",[1105,1110,1111],{},"guard conditions"," of that state's outgoing transitions:",[1114,1115,1120],"pre",{"className":1116,"code":1117,"language":1118,"meta":1119,"style":1119},"language-java shiki shiki-themes github-light github-dark","private void update()\n{\n    switch (currentState)\n    {\n        case IDLE ->\n        {\n            motor.setThrottle(0.0);\n            if (intakeButton.getAsBoolean())\n            {\n                enter(IntakeState.INTAKING); \u002F\u002F the way out of the start state\n            }\n        }\n        case INTAKING ->\n        {\n            motor.setThrottle(0.5);\n            if (pieceSensor.get())\n            {\n                enter(IntakeState.HOLDING);\n            }\n        }\n        case HOLDING ->\n        {\n            motor.setThrottle(0.1); \u002F\u002F gentle hold pressure\n            if (scoreButton.getAsBoolean())\n            {\n                enter(IntakeState.SCORING);\n            }\n        }\n        case SCORING ->\n        {\n            motor.setThrottle(-0.5);\n            if (!pieceSensor.get())\n            {\n                enter(IntakeState.IDLE);\n            }\n        }\n    }\n}\n","java","",[1085,1121,1122,1130,1136,1142,1148,1154,1160,1166,1172,1178,1184,1190,1196,1202,1207,1213,1219,1224,1230,1235,1240,1246,1251,1257,1263,1268,1274,1279,1284,1290,1295,1301,1307,1312,1318,1323,1328,1334],{"__ignoreMap":1119},[1123,1124,1127],"span",{"class":1125,"line":1126},"line",1,[1123,1128,1129],{},"private void update()\n",[1123,1131,1133],{"class":1125,"line":1132},2,[1123,1134,1135],{},"{\n",[1123,1137,1139],{"class":1125,"line":1138},3,[1123,1140,1141],{},"    switch (currentState)\n",[1123,1143,1145],{"class":1125,"line":1144},4,[1123,1146,1147],{},"    {\n",[1123,1149,1151],{"class":1125,"line":1150},5,[1123,1152,1153],{},"        case IDLE ->\n",[1123,1155,1157],{"class":1125,"line":1156},6,[1123,1158,1159],{},"        {\n",[1123,1161,1163],{"class":1125,"line":1162},7,[1123,1164,1165],{},"            motor.setThrottle(0.0);\n",[1123,1167,1169],{"class":1125,"line":1168},8,[1123,1170,1171],{},"            if (intakeButton.getAsBoolean())\n",[1123,1173,1175],{"class":1125,"line":1174},9,[1123,1176,1177],{},"            {\n",[1123,1179,1181],{"class":1125,"line":1180},10,[1123,1182,1183],{},"                enter(IntakeState.INTAKING); \u002F\u002F the way out of the start state\n",[1123,1185,1187],{"class":1125,"line":1186},11,[1123,1188,1189],{},"            }\n",[1123,1191,1193],{"class":1125,"line":1192},12,[1123,1194,1195],{},"        }\n",[1123,1197,1199],{"class":1125,"line":1198},13,[1123,1200,1201],{},"        case INTAKING ->\n",[1123,1203,1205],{"class":1125,"line":1204},14,[1123,1206,1159],{},[1123,1208,1210],{"class":1125,"line":1209},15,[1123,1211,1212],{},"            motor.setThrottle(0.5);\n",[1123,1214,1216],{"class":1125,"line":1215},16,[1123,1217,1218],{},"            if (pieceSensor.get())\n",[1123,1220,1222],{"class":1125,"line":1221},17,[1123,1223,1177],{},[1123,1225,1227],{"class":1125,"line":1226},18,[1123,1228,1229],{},"                enter(IntakeState.HOLDING);\n",[1123,1231,1233],{"class":1125,"line":1232},19,[1123,1234,1189],{},[1123,1236,1238],{"class":1125,"line":1237},20,[1123,1239,1195],{},[1123,1241,1243],{"class":1125,"line":1242},21,[1123,1244,1245],{},"        case HOLDING ->\n",[1123,1247,1249],{"class":1125,"line":1248},22,[1123,1250,1159],{},[1123,1252,1254],{"class":1125,"line":1253},23,[1123,1255,1256],{},"            motor.setThrottle(0.1); \u002F\u002F gentle hold pressure\n",[1123,1258,1260],{"class":1125,"line":1259},24,[1123,1261,1262],{},"            if (scoreButton.getAsBoolean())\n",[1123,1264,1266],{"class":1125,"line":1265},25,[1123,1267,1177],{},[1123,1269,1271],{"class":1125,"line":1270},26,[1123,1272,1273],{},"                enter(IntakeState.SCORING);\n",[1123,1275,1277],{"class":1125,"line":1276},27,[1123,1278,1189],{},[1123,1280,1282],{"class":1125,"line":1281},28,[1123,1283,1195],{},[1123,1285,1287],{"class":1125,"line":1286},29,[1123,1288,1289],{},"        case SCORING ->\n",[1123,1291,1293],{"class":1125,"line":1292},30,[1123,1294,1159],{},[1123,1296,1298],{"class":1125,"line":1297},31,[1123,1299,1300],{},"            motor.setThrottle(-0.5);\n",[1123,1302,1304],{"class":1125,"line":1303},32,[1123,1305,1306],{},"            if (!pieceSensor.get())\n",[1123,1308,1310],{"class":1125,"line":1309},33,[1123,1311,1177],{},[1123,1313,1315],{"class":1125,"line":1314},34,[1123,1316,1317],{},"                enter(IntakeState.IDLE);\n",[1123,1319,1321],{"class":1125,"line":1320},35,[1123,1322,1189],{},[1123,1324,1326],{"class":1125,"line":1325},36,[1123,1327,1195],{},[1123,1329,1331],{"class":1125,"line":1330},37,[1123,1332,1333],{},"    }\n",[1123,1335,1337],{"class":1125,"line":1336},38,[1123,1338,1339],{},"}\n",[1090,1341,1342,1343,1346,1347,1350,1351,1354,1355,1350,1358,1361,1362,1365,1366,1369,1370,1373,1374,1377,1378,1350,1380,1382,1383,1386],{},"Compare it with the transition table: every row became one ",[1085,1344,1345],{},"if"," inside the case for its \"From\" state. Here ",[1085,1348,1349],{},"motor"," is a ",[1085,1352,1353],{},"DriveMotor"," (Ch.4), ",[1085,1356,1357],{},"pieceSensor",[1085,1359,1360],{},"DigitalInput"," (Ch.3), and ",[1085,1363,1364],{},"intakeButton"," and ",[1085,1367,1368],{},"scoreButton"," are ",[1085,1371,1372],{},"BooleanSupplier","s (Lesson 19.1) handed to the intake's constructor — a controller button's ",[1085,1375,1376],{},"Trigger"," works, since a ",[1085,1379,1376],{},[1085,1381,1372],{}," (Lesson 25.6). The arrow form can't fall through from one case into the next, so no ",[1085,1384,1385],{},"break;"," is needed.",[1080,1388,1390],{"id":1389},"transitions-and-entry-actions-go-through-one-method","Transitions and Entry Actions Go Through One Method",[1090,1392,1393,1394,1397],{},"A transition is just a new value in the state field — but routing every transition through one small method gives the machine a single place for ",[1105,1395,1396],{},"entry actions",", the things that should happen exactly once on entering a state:",[1114,1399,1401],{"className":1116,"code":1400,"language":1118,"meta":1119,"style":1119},"private void enter(IntakeState next)\n{\n    \u002F\u002F entry action: log every change, once\n    System.out.println(\"Intake: \" + currentState + \" -> \" + next);\n    currentState = next;\n}\n",[1085,1402,1403,1408,1412,1417,1422,1427],{"__ignoreMap":1119},[1123,1404,1405],{"class":1125,"line":1126},[1123,1406,1407],{},"private void enter(IntakeState next)\n",[1123,1409,1410],{"class":1125,"line":1132},[1123,1411,1135],{},[1123,1413,1414],{"class":1125,"line":1138},[1123,1415,1416],{},"    \u002F\u002F entry action: log every change, once\n",[1123,1418,1419],{"class":1125,"line":1144},[1123,1420,1421],{},"    System.out.println(\"Intake: \" + currentState + \" -> \" + next);\n",[1123,1423,1424],{"class":1125,"line":1150},[1123,1425,1426],{},"    currentState = next;\n",[1123,1428,1429],{"class":1125,"line":1156},[1123,1430,1339],{},[1090,1432,1433,1434,1437],{},"Logging every transition like this is one of the most useful debugging tools a state machine can have. A state-specific entry action goes here too — for example, restarting a timer when entering ",[1085,1435,1436],{},"SCORING",", so a guard in that case could check how long the intake has been scoring.",[1080,1439,1441],{"id":1440},"how-the-machine-leaves-its-start-state","How the Machine Leaves Its Start State",[1090,1443,1444,1445,1447,1448,1451,1452,1454,1455,1458,1459,1462,1463,1466,1467,1469],{},"Trace it from power-on. ",[1085,1446,1095],{}," starts as ",[1085,1449,1450],{},"IDLE",", so every loop runs the ",[1085,1453,1450],{}," case: the rollers stay stopped, and the guard ",[1085,1456,1457],{},"intakeButton.getAsBoolean()"," is checked. The first loop where the driver is pressing the intake button, the guard is true and ",[1085,1460,1461],{},"enter(IntakeState.INTAKING)"," runs. From the next loop on, the ",[1085,1464,1465],{},"INTAKING"," case runs instead. Outside inputs never assign ",[1085,1468,1095],{}," directly; they only feed the guards, and the machine decides for itself when to move.",[1080,1471,1473],{"id":1472},"running-the-machine-every-loop-a-default-command","Running the Machine Every Loop: A Default Command",[1090,1475,1476,1477,1480,1481,1484,1485,1488],{},"A state machine has to be checked every loop, and in Commands v3 anything that controls a mechanism every loop belongs in a command. The natural fit is the mechanism's ",[1105,1478,1479],{},"default command"," (Lesson 25.3), built with ",[1085,1482,1483],{},"runRepeatedly"," so ",[1085,1486,1487],{},"update()"," runs once per loop:",[1114,1490,1492],{"className":1116,"code":1491,"language":1118,"meta":1119,"style":1119},"public Command stateMachineCommand()\n{\n    return runRepeatedly(this::update)\n        .withPriority(Command.LOWEST_PRIORITY)\n        .named(\"Intake State Machine\");\n}\n",[1085,1493,1494,1499,1503,1508,1513,1518],{"__ignoreMap":1119},[1123,1495,1496],{"class":1125,"line":1126},[1123,1497,1498],{},"public Command stateMachineCommand()\n",[1123,1500,1501],{"class":1125,"line":1132},[1123,1502,1135],{},[1123,1504,1505],{"class":1125,"line":1138},[1123,1506,1507],{},"    return runRepeatedly(this::update)\n",[1123,1509,1510],{"class":1125,"line":1144},[1123,1511,1512],{},"        .withPriority(Command.LOWEST_PRIORITY)\n",[1123,1514,1515],{"class":1125,"line":1150},[1123,1516,1517],{},"        .named(\"Intake State Machine\");\n",[1123,1519,1520],{"class":1125,"line":1156},[1123,1521,1339],{},[1090,1523,1524,1525,1528,1529,1531,1532,1534],{},"During setup (Lesson 25.7 shows where), it's installed once with ",[1085,1526,1527],{},"intake.setDefaultCommand(intake.stateMachineCommand());",". The lowest priority means any other command that requires the intake — say, a manual \"eject\" button for a stuck piece — can take over. While it does, ",[1085,1530,1487],{}," doesn't run, but ",[1085,1533,1095],{}," is an ordinary field, so it keeps its value; when the other command ends, the default command starts again and the machine picks up in the state it was in.",[1080,1536,1538,1539,1542],{"id":1537},"sidebar-v3s-built-in-statemachine-alpha","Sidebar: v3's Built-In ",[1085,1540,1541],{},"StateMachine"," (Alpha)",[1090,1544,1545,1546,1548,1549,1552,1553,1555],{},"Commands v3 also includes a ",[1085,1547,1541],{}," class, where each state is a whole command and transitions are declared with methods like ",[1085,1550,1551],{},"switchTo(...).when(...)",". It was added in May 2026 and changed again in September 2026, so it's still settling; this course teaches the enum-and-",[1085,1554,1087],{}," pattern above, which works the same in any version and is what the later subsystem chapters build on.",[1080,1557,1559],{"id":1558},"common-pitfalls","Common Pitfalls",[1561,1562,1563,1576,1593,1604],"ul",{},[1564,1565,1566,1572,1573,1575],"li",{},[1105,1567,1568,1569,1571],{},"Putting transition logic in the wrong ",[1085,1570,1102],{},"."," A guard checked inside the wrong state's case either never triggers, or moves the machine out of a state it wasn't in. Each ",[1085,1574,1345],{}," belongs in the case for its transition's \"From\" state.",[1564,1577,1578,1587,1588,1590,1591,1571],{},[1105,1579,1580,1581,1583,1584,1571],{},"Assigning ",[1085,1582,1095],{}," directly instead of calling ",[1085,1585,1586],{},"enter(...)"," A direct assignment skips the entry actions, and assignments scattered across many methods make it much harder to reason about when and why transitions happen — keep every transition inside the one ",[1085,1589,1087],{},", going through ",[1085,1592,1586],{},[1564,1594,1595,1600,1601,1603],{},[1105,1596,1597,1598,1571],{},"Leaving a state out of the ",[1085,1599,1087],{}," A ",[1085,1602,1087],{}," statement doesn't have to list every enum constant, so a missing case compiles fine — and a machine that enters that state does nothing and never leaves it.",[1564,1605,1606,1609],{},[1105,1607,1608],{},"Expecting the state machine to run while another command owns the mechanism."," The default command pauses whenever a higher-priority command requires the mechanism; the state field keeps its value until the default command resumes.",[1080,1611,1613],{"id":1612},"key-takeaways","Key Takeaways",[1561,1615,1616,1622,1631,1634,1643],{},[1564,1617,1618,1619,1621],{},"An arrow-form ",[1085,1620,1087],{}," over the state field, with one case per state, runs each state's action and checks only that state's guards.",[1564,1623,1624,1625,1627,1628,1630],{},"Every row of the transition table becomes one ",[1085,1626,1345],{}," in its \"From\" state's case; routing transitions through one ",[1085,1629,1586],{}," method gives entry actions (like logging) a single home.",[1564,1632,1633],{},"The machine leaves its start state when a guard fed by an outside input — like a driver's button — becomes true; outside code feeds guards, it doesn't assign the state.",[1564,1635,1636,1637,1639,1640,1571],{},"In Commands v3, the ",[1085,1638,1087],{}," runs every loop as the mechanism's default command: ",[1085,1641,1642],{},"runRepeatedly(this::update).withPriority(Command.LOWEST_PRIORITY).named(...)",[1564,1644,1645,1646,1648,1649,1651],{},"v3's built-in ",[1085,1647,1541],{}," class exists but is alpha; the enum-and-",[1085,1650,1087],{}," pattern is the one this course builds on.",[1090,1653,1654,1655,1658,1659,1662,1663,1666,1667,1669,1670,1673,1674,1662,1677,1680,1681,1684],{},"Derived from ",[1085,1656,1657],{},"other-reference-repo",": ",[1085,1660,1661],{},"team-5817-training\u002Fsubsystems\u002F02-state-based-servo-subsystems.md",", ",[1085,1664,1665],{},"03-state-based-roller-subsystems.md"," (T5817 31.1-4); v3 default-command placement and ",[1085,1668,1541],{}," sidebar from allwpilib ",[1085,1671,1672],{},"main"," (",[1085,1675,1676],{},"commandsv3\u002F…\u002Fcommand3\u002FMechanism.java",[1085,1678,1679],{},"StateMachine.java",")\n",[1105,1682,1683],{},"Deck context:"," mechacoder-test\u002Fsrc\u002Flessons\u002Fjava-2.js, slide 11 (\"Managing Transitions\") — IntakeState switch example",[1686,1687,1688],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":1119,"searchDepth":1132,"depth":1132,"links":1690},[1691,1693,1694,1695,1696,1698,1699],{"id":1082,"depth":1132,"text":1692},"From Diagram to Code: One switch, One Case per State",{"id":1389,"depth":1132,"text":1390},{"id":1440,"depth":1132,"text":1441},{"id":1472,"depth":1132,"text":1473},{"id":1537,"depth":1132,"text":1697},"Sidebar: v3's Built-In StateMachine (Alpha)",{"id":1558,"depth":1132,"text":1559},{"id":1612,"depth":1132,"text":1613},"md",{"outlineRef":1702,"status":1703},"25.5 — Managing Transitions (switch) (T5817 31.1-4)","new — authored lesson (fuller depth than the teaser slide; rewritten for Commands v3, WPILib 2027)",true,{"title":286,"description":1119},"5HXlYe5Kbdr9s7VrTbktpo157_eSJXyYKaB2VfQJNX4",{"id":1708,"title":719,"body":1709,"description":1119,"extension":1700,"meta":2480,"navigation":1704,"path":718,"seo":2483,"stem":720,"__hash__":2484},"examples\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.5-managing-transitions.md",{"type":1073,"value":1710,"toc":2470},[1711,1714,1718,1732,1770,1773,1851,1885,1889,1925,1929,1956,1997,2006,2015,2220,2229,2233,2263,2276,2280,2294,2414,2433,2442,2446,2468],[1076,1712,719],{"id":1713},"managing-transitions-worked-example",[1080,1715,1717],{"id":1716},"problem","Problem",[1090,1719,1720,1721,1724,1725,1727,1728,1731],{},"An ",[1085,1722,1723],{},"Elevator"," mechanism has four states, stored in a ",[1085,1726,1095],{}," field that starts at ",[1085,1729,1730],{},"LOWERED",":",[1114,1733,1735],{"className":1116,"code":1734,"language":1118,"meta":1119,"style":1119},"public enum ElevatorState\n{\n    LOWERED,\n    RAISING,\n    AT_TOP,\n    LOWERING\n}\n",[1085,1736,1737,1742,1746,1751,1756,1761,1766],{"__ignoreMap":1119},[1123,1738,1739],{"class":1125,"line":1126},[1123,1740,1741],{},"public enum ElevatorState\n",[1123,1743,1744],{"class":1125,"line":1132},[1123,1745,1135],{},[1123,1747,1748],{"class":1125,"line":1138},[1123,1749,1750],{},"    LOWERED,\n",[1123,1752,1753],{"class":1125,"line":1144},[1123,1754,1755],{},"    RAISING,\n",[1123,1757,1758],{"class":1125,"line":1150},[1123,1759,1760],{},"    AT_TOP,\n",[1123,1762,1763],{"class":1125,"line":1156},[1123,1764,1765],{},"    LOWERING\n",[1123,1767,1768],{"class":1125,"line":1162},[1123,1769,1339],{},[1090,1771,1772],{},"Its design, as a transition table:",[1774,1775,1776,1792],"table",{},[1777,1778,1779],"thead",{},[1780,1781,1782,1786,1789],"tr",{},[1783,1784,1785],"th",{},"From",[1783,1787,1788],{},"To",[1783,1790,1791],{},"Guard condition",[1793,1794,1795,1810,1824,1838],"tbody",{},[1780,1796,1797,1802,1807],{},[1798,1799,1800],"td",{},[1085,1801,1730],{},[1798,1803,1804],{},[1085,1805,1806],{},"RAISING",[1798,1808,1809],{},"the operator presses the raise button",[1780,1811,1812,1816,1821],{},[1798,1813,1814],{},[1085,1815,1806],{},[1798,1817,1818],{},[1085,1819,1820],{},"AT_TOP",[1798,1822,1823],{},"the top limit switch is pressed",[1780,1825,1826,1830,1835],{},[1798,1827,1828],{},[1085,1829,1820],{},[1798,1831,1832],{},[1085,1833,1834],{},"LOWERING",[1798,1836,1837],{},"the operator presses the lower button",[1780,1839,1840,1844,1848],{},[1798,1841,1842],{},[1085,1843,1834],{},[1798,1845,1846],{},[1085,1847,1730],{},[1798,1849,1850],{},"the bottom limit switch is pressed",[1090,1852,1853,1854,1857,1858,1662,1860,1863,1864,1866,1867,1870,1871,1873,1874,1863,1877,1879,1880,1882,1883,1571],{},"The state actions: the motor gets ",[1085,1855,1856],{},"0.0"," when ",[1085,1859,1730],{},[1085,1861,1862],{},"0.6"," while ",[1085,1865,1806],{},", a gentle ",[1085,1868,1869],{},"0.05"," to hold position ",[1085,1872,1820],{},", and ",[1085,1875,1876],{},"-0.3",[1085,1878,1834],{},". Write the elevator's ",[1085,1881,1487],{}," method and the command that runs it every loop, then trace four loops starting from ",[1085,1884,1730],{},[1080,1886,1888],{"id":1887},"step-1-plan-it-first","Step 1: Plan It First",[1890,1891,1892,1904,1907,1913,1922],"ol",{},[1564,1893,1894,1895,1897,1898,1900,1901,1903],{},"Put one arrow-form ",[1085,1896,1087],{}," over ",[1085,1899,1095],{}," inside ",[1085,1902,1487],{},": one case per state.",[1564,1905,1906],{},"In each case, set the motor for that state, then check only that state's guard.",[1564,1908,1909,1910,1912],{},"Route every transition through an ",[1085,1911,1586],{}," method, so the change is logged once.",[1564,1914,1915,1916,1918,1919,1921],{},"Wrap ",[1085,1917,1487],{}," in a lowest-priority ",[1085,1920,1483],{}," command to use as the default command.",[1564,1923,1924],{},"Trace four loops to check it.",[1080,1926,1928],{"id":1927},"step-2-one-case-per-state-with-its-own-guard","Step 2: One Case per State, With Its Own Guard",[1090,1930,1931,1350,1933,1354,1935,1365,1938,1369,1941,1943,1944,1365,1947,1369,1950,1952,1953,1955],{},[1085,1932,1349],{},[1085,1934,1353],{},[1085,1936,1937],{},"topLimit",[1085,1939,1940],{},"bottomLimit",[1085,1942,1360],{},"s, and ",[1085,1945,1946],{},"raiseButton",[1085,1948,1949],{},"lowerButton",[1085,1951,1372],{},"s handed to the elevator's constructor. The ",[1085,1954,1806],{}," case shows the shape every case follows — action first, then that state's guard:",[1114,1957,1959],{"className":1116,"code":1958,"language":1118,"meta":1119,"style":1119},"case RAISING ->\n{\n    motor.setThrottle(0.6);\n    if (topLimit.get())\n    {\n        enter(ElevatorState.AT_TOP);\n    }\n}\n",[1085,1960,1961,1966,1970,1975,1980,1984,1989,1993],{"__ignoreMap":1119},[1123,1962,1963],{"class":1125,"line":1126},[1123,1964,1965],{},"case RAISING ->\n",[1123,1967,1968],{"class":1125,"line":1132},[1123,1969,1135],{},[1123,1971,1972],{"class":1125,"line":1138},[1123,1973,1974],{},"    motor.setThrottle(0.6);\n",[1123,1976,1977],{"class":1125,"line":1144},[1123,1978,1979],{},"    if (topLimit.get())\n",[1123,1981,1982],{"class":1125,"line":1150},[1123,1983,1147],{},[1123,1985,1986],{"class":1125,"line":1156},[1123,1987,1988],{},"        enter(ElevatorState.AT_TOP);\n",[1123,1990,1991],{"class":1125,"line":1162},[1123,1992,1333],{},[1123,1994,1995],{"class":1125,"line":1168},[1123,1996,1339],{},[1090,1998,1999,2000,2002,2003,2005],{},"The top limit switch only matters while the elevator is moving up, so its check goes inside ",[1085,2001,1806],{}," — and nowhere else. If it were placed in the ",[1085,2004,1730],{}," case instead, it would never be reached while the elevator is actually rising, and the elevator would drive into its hard stop.",[1080,2007,2009,2010,1365,2012],{"id":2008},"step-3-the-whole-update-and-enter","Step 3: The Whole ",[1085,2011,1487],{},[1085,2013,2014],{},"enter()",[1114,2016,2018],{"className":1116,"code":2017,"language":1118,"meta":1119,"style":1119},"private void update()\n{\n    switch (currentState)\n    {\n        case LOWERED ->\n        {\n            motor.setThrottle(0.0);\n            if (raiseButton.getAsBoolean())\n            {\n                enter(ElevatorState.RAISING);\n            }\n        }\n        case RAISING ->\n        {\n            motor.setThrottle(0.6);\n            if (topLimit.get())\n            {\n                enter(ElevatorState.AT_TOP);\n            }\n        }\n        case AT_TOP ->\n        {\n            motor.setThrottle(0.05); \u002F\u002F gentle hold\n            if (lowerButton.getAsBoolean())\n            {\n                enter(ElevatorState.LOWERING);\n            }\n        }\n        case LOWERING ->\n        {\n            motor.setThrottle(-0.3);\n            if (bottomLimit.get())\n            {\n                enter(ElevatorState.LOWERED);\n            }\n        }\n    }\n}\n\nprivate void enter(ElevatorState next)\n{\n    System.out.println(\"Elevator: \" + currentState + \" -> \" + next);\n    currentState = next;\n}\n",[1085,2019,2020,2024,2028,2032,2036,2041,2045,2049,2054,2058,2063,2067,2071,2076,2080,2085,2090,2094,2099,2103,2107,2112,2116,2121,2126,2130,2135,2139,2143,2148,2152,2157,2162,2166,2171,2175,2179,2183,2187,2193,2199,2204,2210,2215],{"__ignoreMap":1119},[1123,2021,2022],{"class":1125,"line":1126},[1123,2023,1129],{},[1123,2025,2026],{"class":1125,"line":1132},[1123,2027,1135],{},[1123,2029,2030],{"class":1125,"line":1138},[1123,2031,1141],{},[1123,2033,2034],{"class":1125,"line":1144},[1123,2035,1147],{},[1123,2037,2038],{"class":1125,"line":1150},[1123,2039,2040],{},"        case LOWERED ->\n",[1123,2042,2043],{"class":1125,"line":1156},[1123,2044,1159],{},[1123,2046,2047],{"class":1125,"line":1162},[1123,2048,1165],{},[1123,2050,2051],{"class":1125,"line":1168},[1123,2052,2053],{},"            if (raiseButton.getAsBoolean())\n",[1123,2055,2056],{"class":1125,"line":1174},[1123,2057,1177],{},[1123,2059,2060],{"class":1125,"line":1180},[1123,2061,2062],{},"                enter(ElevatorState.RAISING);\n",[1123,2064,2065],{"class":1125,"line":1186},[1123,2066,1189],{},[1123,2068,2069],{"class":1125,"line":1192},[1123,2070,1195],{},[1123,2072,2073],{"class":1125,"line":1198},[1123,2074,2075],{},"        case RAISING ->\n",[1123,2077,2078],{"class":1125,"line":1204},[1123,2079,1159],{},[1123,2081,2082],{"class":1125,"line":1209},[1123,2083,2084],{},"            motor.setThrottle(0.6);\n",[1123,2086,2087],{"class":1125,"line":1215},[1123,2088,2089],{},"            if (topLimit.get())\n",[1123,2091,2092],{"class":1125,"line":1221},[1123,2093,1177],{},[1123,2095,2096],{"class":1125,"line":1226},[1123,2097,2098],{},"                enter(ElevatorState.AT_TOP);\n",[1123,2100,2101],{"class":1125,"line":1232},[1123,2102,1189],{},[1123,2104,2105],{"class":1125,"line":1237},[1123,2106,1195],{},[1123,2108,2109],{"class":1125,"line":1242},[1123,2110,2111],{},"        case AT_TOP ->\n",[1123,2113,2114],{"class":1125,"line":1248},[1123,2115,1159],{},[1123,2117,2118],{"class":1125,"line":1253},[1123,2119,2120],{},"            motor.setThrottle(0.05); \u002F\u002F gentle hold\n",[1123,2122,2123],{"class":1125,"line":1259},[1123,2124,2125],{},"            if (lowerButton.getAsBoolean())\n",[1123,2127,2128],{"class":1125,"line":1265},[1123,2129,1177],{},[1123,2131,2132],{"class":1125,"line":1270},[1123,2133,2134],{},"                enter(ElevatorState.LOWERING);\n",[1123,2136,2137],{"class":1125,"line":1276},[1123,2138,1189],{},[1123,2140,2141],{"class":1125,"line":1281},[1123,2142,1195],{},[1123,2144,2145],{"class":1125,"line":1286},[1123,2146,2147],{},"        case LOWERING ->\n",[1123,2149,2150],{"class":1125,"line":1292},[1123,2151,1159],{},[1123,2153,2154],{"class":1125,"line":1297},[1123,2155,2156],{},"            motor.setThrottle(-0.3);\n",[1123,2158,2159],{"class":1125,"line":1303},[1123,2160,2161],{},"            if (bottomLimit.get())\n",[1123,2163,2164],{"class":1125,"line":1309},[1123,2165,1177],{},[1123,2167,2168],{"class":1125,"line":1314},[1123,2169,2170],{},"                enter(ElevatorState.LOWERED);\n",[1123,2172,2173],{"class":1125,"line":1320},[1123,2174,1189],{},[1123,2176,2177],{"class":1125,"line":1325},[1123,2178,1195],{},[1123,2180,2181],{"class":1125,"line":1330},[1123,2182,1333],{},[1123,2184,2185],{"class":1125,"line":1336},[1123,2186,1339],{},[1123,2188,2190],{"class":1125,"line":2189},39,[1123,2191,2192],{"emptyLinePlaceholder":1704},"\n",[1123,2194,2196],{"class":1125,"line":2195},40,[1123,2197,2198],{},"private void enter(ElevatorState next)\n",[1123,2200,2202],{"class":1125,"line":2201},41,[1123,2203,1135],{},[1123,2205,2207],{"class":1125,"line":2206},42,[1123,2208,2209],{},"    System.out.println(\"Elevator: \" + currentState + \" -> \" + next);\n",[1123,2211,2213],{"class":1125,"line":2212},43,[1123,2214,1426],{},[1123,2216,2218],{"class":1125,"line":2217},44,[1123,2219,1339],{},[1090,2221,2222,2223,2225,2226,2228],{},"Each row of the transition table became exactly one ",[1085,2224,1345],{},", inside the case for its \"From\" state. Every state has a way out, including the start state, ",[1085,2227,1730],{},", which leaves when the operator presses the raise button.",[1080,2230,2232],{"id":2231},"step-4-run-it-every-loop-as-the-default-command","Step 4: Run It Every Loop as the Default Command",[1114,2234,2236],{"className":1116,"code":2235,"language":1118,"meta":1119,"style":1119},"public Command stateMachineCommand()\n{\n    return runRepeatedly(this::update)\n        .withPriority(Command.LOWEST_PRIORITY)\n        .named(\"Elevator State Machine\");\n}\n",[1085,2237,2238,2242,2246,2250,2254,2259],{"__ignoreMap":1119},[1123,2239,2240],{"class":1125,"line":1126},[1123,2241,1498],{},[1123,2243,2244],{"class":1125,"line":1132},[1123,2245,1135],{},[1123,2247,2248],{"class":1125,"line":1138},[1123,2249,1507],{},[1123,2251,2252],{"class":1125,"line":1144},[1123,2253,1512],{},[1123,2255,2256],{"class":1125,"line":1150},[1123,2257,2258],{},"        .named(\"Elevator State Machine\");\n",[1123,2260,2261],{"class":1125,"line":1156},[1123,2262,1339],{},[1090,2264,2265,2266,2269,2270,2272,2273,2275],{},"Installed once during setup with ",[1085,2267,2268],{},"elevator.setDefaultCommand(elevator.stateMachineCommand());",", this calls ",[1085,2271,1487],{}," once per scheduler loop whenever no other command needs the elevator. Its lowest priority means a manual override — say, a \"hold still\" command the operator can trigger if something jams — takes over the elevator immediately; ",[1085,2274,1095],{}," keeps its value, and the machine resumes from it once the override ends.",[1080,2277,2279],{"id":2278},"step-5-trace-four-loops","Step 5: Trace Four Loops",[1090,2281,2282,2283,2285,2286,2289,2290,2293],{},"The elevator starts ",[1085,2284,1730],{},". The raise button is pressed on loops 2-4; the top limit switch reads ",[1085,2287,2288],{},"false"," on loops 1-3 and ",[1085,2291,2292],{},"true"," on loop 4.",[1774,2295,2296,2318],{},[1777,2297,2298],{},[1780,2299,2300,2303,2306,2309,2312,2315],{},[1783,2301,2302],{},"Loop",[1783,2304,2305],{},"State at start",[1783,2307,2308],{},"Motor set to",[1783,2310,2311],{},"Guard checked",[1783,2313,2314],{},"Guard value",[1783,2316,2317],{},"State at end",[1793,2319,2320,2344,2367,2391],{},[1780,2321,2322,2325,2329,2333,2336,2340],{},[1798,2323,2324],{},"1",[1798,2326,2327],{},[1085,2328,1730],{},[1798,2330,2331],{},[1085,2332,1856],{},[1798,2334,2335],{},"raise button",[1798,2337,2338],{},[1085,2339,2288],{},[1798,2341,2342],{},[1085,2343,1730],{},[1780,2345,2346,2349,2353,2357,2359,2363],{},[1798,2347,2348],{},"2",[1798,2350,2351],{},[1085,2352,1730],{},[1798,2354,2355],{},[1085,2356,1856],{},[1798,2358,2335],{},[1798,2360,2361],{},[1085,2362,2292],{},[1798,2364,2365],{},[1085,2366,1806],{},[1780,2368,2369,2372,2376,2380,2383,2387],{},[1798,2370,2371],{},"3",[1798,2373,2374],{},[1085,2375,1806],{},[1798,2377,2378],{},[1085,2379,1862],{},[1798,2381,2382],{},"top limit",[1798,2384,2385],{},[1085,2386,2288],{},[1798,2388,2389],{},[1085,2390,1806],{},[1780,2392,2393,2396,2400,2404,2406,2410],{},[1798,2394,2395],{},"4",[1798,2397,2398],{},[1085,2399,1806],{},[1798,2401,2402],{},[1085,2403,1862],{},[1798,2405,2382],{},[1798,2407,2408],{},[1085,2409,2292],{},[1798,2411,2412],{},[1085,2413,1820],{},[1090,2415,2416,2417,2419,2420,2422,2423,2425,2426,2429,2430,1571],{},"On loop 2, the motor was still set to ",[1085,2418,1856],{}," — that line ran before the guard — and the new state only takes effect on loop 3, one loop (20ms) later. The same thing happens on loop 4: the motor gets ",[1085,2421,1862],{}," one last time, and the gentle hold of ",[1085,2424,1820],{}," starts on loop 5. That's the normal rhythm of a state machine run once per loop: act on the current state, decide the next one, and let the next loop act on it. The console shows exactly two lines, one per transition: ",[1085,2427,2428],{},"Elevator: LOWERED -> RAISING",", then ",[1085,2431,2432],{},"Elevator: RAISING -> AT_TOP",[1090,2434,2435,2436,2438,2439,2441],{},"Notice that on loop 3 the raise button is still held, but nothing happens because of it: only the ",[1085,2437,1730],{}," case checks that guard, and the machine isn't in ",[1085,2440,1730],{}," anymore.",[1080,2443,2445],{"id":2444},"recap","Recap",[1561,2447,2448,2453,2459,2465],{},[1564,2449,1618,2450,2452],{},[1085,2451,1087],{}," over the state field runs one case per state: the state's action, then only that state's guards.",[1564,2454,2455,2456,2458],{},"Every transition goes through ",[1085,2457,1586],{},", so each change is logged once, as an entry action.",[1564,2460,2461,2462,2464],{},"The ",[1085,2463,1087],{}," runs every loop as a lowest-priority default command, so any other command can take over the mechanism without losing the current state.",[1564,2466,2467],{},"A transition takes effect on the next loop: this loop acts on the old state, and the next loop acts on the new one.",[1686,2469,1688],{},{"title":1119,"searchDepth":1132,"depth":1132,"links":2471},[2472,2473,2474,2475,2477,2478,2479],{"id":1716,"depth":1132,"text":1717},{"id":1887,"depth":1132,"text":1888},{"id":1927,"depth":1132,"text":1928},{"id":2008,"depth":1132,"text":2476},"Step 3: The Whole update() and enter()",{"id":2231,"depth":1132,"text":2232},{"id":2278,"depth":1132,"text":2279},{"id":2444,"depth":1132,"text":2445},{"outlineRef":1702,"pairsWith":2481,"status":2482},"[`lessons\u002Fch25-command-based-programming\u002F25.5-managing-transitions.md`](..\u002F..\u002Flessons\u002Fch25-command-based-programming\u002F25.5-managing-transitions.md)","new — authored worked example (fully solved, walked step by step — not a problem to attempt); rewritten for Commands v3",{"title":719,"description":1119},"-tlYITc1007vh8vocHE_4VD_67VZ4iXm3Okp5S6-6pI",{"id":2486,"title":1032,"body":2487,"description":1119,"extension":1700,"meta":4845,"navigation":1704,"path":1031,"seo":4847,"stem":1033,"__hash__":4848},"exercises\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.5-managing-transitions.md",{"type":1073,"value":2488,"toc":4840},[2489,2492,2496,2510,2543,2555,2560,2592,2598,2627,2659,2663,2702,2715,2721,2833,2838,2912,2917,3070,3142,3161,3165,3171,3192,3345,3376,3384,3387,3393,3398,3960,3965,3970,3975,3980,3985,3990,3994,4000,4004,4010,4015,4019,4025,4029,4035,4040,4044,4050,4054,4060,4065,4069,4075,4079,4085,4090,4780,4838],[1076,2490,1032],{"id":2491},"managing-transitions-exercises",[1080,2493,2495],{"id":2494},"multiple-choice","Multiple Choice",[1090,2497,2498,2501,2502,2504,2505,2507,2508,1731],{},[1105,2499,2500],{},"Question:"," An intake's state machine runs this arrow-form ",[1085,2503,1087],{}," as the body of its default command. It has no ",[1085,2506,1102],{}," for ",[1085,2509,1436],{},[1114,2511,2513],{"className":1116,"code":2512,"language":1118,"meta":1119,"style":1119},"switch (currentState)\n{\n    case IDLE -> { \u002F* ... *\u002F }\n    case INTAKING -> { \u002F* ... *\u002F }\n    case HOLDING -> { \u002F* ... *\u002F }\n}\n",[1085,2514,2515,2520,2524,2529,2534,2539],{"__ignoreMap":1119},[1123,2516,2517],{"class":1125,"line":1126},[1123,2518,2519],{},"switch (currentState)\n",[1123,2521,2522],{"class":1125,"line":1132},[1123,2523,1135],{},[1123,2525,2526],{"class":1125,"line":1138},[1123,2527,2528],{},"    case IDLE -> { \u002F* ... *\u002F }\n",[1123,2530,2531],{"class":1125,"line":1144},[1123,2532,2533],{},"    case INTAKING -> { \u002F* ... *\u002F }\n",[1123,2535,2536],{"class":1125,"line":1150},[1123,2537,2538],{},"    case HOLDING -> { \u002F* ... *\u002F }\n",[1123,2540,2541],{"class":1125,"line":1156},[1123,2542,1339],{},[1090,2544,2545,2546,2548,2549,2551,2552,2554],{},"Somehow ",[1085,2547,1095],{}," becomes ",[1085,2550,1436],{},". What happens the next time the ",[1085,2553,1087],{}," runs?",[1090,2556,2557],{},[1105,2558,2559],{},"Options:",[1561,2561,2562,2571,2580,2586],{},[1564,2563,2564,2565,2567,2568,2570],{},"A. The ",[1085,2566,1087],{}," throws a runtime exception, because ",[1085,2569,1436],{}," isn't handled.",[1564,2572,2573,2574,2576,2577,2579],{},"B. The ",[1085,2575,1087],{}," does nothing that loop — no case matches, so no state action runs and no guard is checked — and the machine stays in ",[1085,2578,1436],{}," forever.",[1564,2581,2582,2583,2585],{},"C. The code doesn't compile, because the ",[1085,2584,1087],{}," doesn't cover every constant of the enum.",[1564,2587,2588,2589,2591],{},"D. Java automatically runs the ",[1085,2590,1450],{}," case as a fallback.",[1090,2593,2594,2597],{},[1105,2595,2596],{},"Answer:"," B",[1090,2599,2600,1600,2603,2605,2606,2610,2611,2613,2614,2617,2618,2620,2621,2623,2624,2626],{},[1105,2601,2602],{},"Why:",[1085,2604,1087],{}," ",[2607,2608,2609],"em",{},"statement"," (unlike a ",[1085,2612,1087],{}," expression) doesn't have to be exhaustive — ",[1085,2615,2616],{},"default"," is optional, and leaving a case out just means \"do nothing\" is a real outcome for that value (Lesson 5.12). With no case matching ",[1085,2619,1436],{},", the switch body simply runs nothing that loop. Since nothing else assigns ",[1085,2622,1095],{},", the machine sits in ",[1085,2625,1436],{}," for the rest of the match — exactly the \"state with no way out\" pitfall Lesson 25.4 warns about.",[1561,2628,2629,2641,2650],{},[1564,2630,2631,2632,2634,2635,2605,2637,2640],{},"A is wrong — an unmatched value in a ",[1085,2633,1087],{}," statement is not an error; it just means no case runs. (Only a ",[1085,2636,1087],{},[2607,2638,2639],{},"expression"," must always produce a value, and even that's a compile-time requirement, not a runtime exception.)",[1564,2642,2643,2644,2646,2647,2649],{},"C is wrong — exhaustiveness is required for ",[1085,2645,1087],{}," expressions, not ",[1085,2648,1087],{}," statements; that's exactly why this compiles despite missing a state.",[1564,2651,2652,2653,2655,2656,2658],{},"D is wrong — there's no such fallback; only an explicit ",[1085,2654,2616],{}," case would run, and this ",[1085,2657,1087],{}," doesn't have one.",[1080,2660,2662],{"id":2661},"micro-parsons","Micro-Parsons",[1090,2664,2665,2668,2669,2671,2672,2674,2675,2677,2678,2681,2682,2685,2686,2689,2690,2693,2694,2696,2697,2685,2699,1571],{},[1105,2666,2667],{},"Problem:"," This program is a plain-Java stand-in for a shooter's state machine, using the arrow-form ",[1085,2670,1087],{}," from Lesson 25.5: ",[1085,2673,1672],{}," calls ",[1085,2676,1487],{}," three times, standing in for three scheduler loops, and raises ",[1085,2679,2680],{},"flywheelRpm"," to 3200 before the second call. While ",[1085,2683,2684],{},"SPINNING_UP",", it should print ",[1085,2687,2688],{},"Spinning up"," and move to ",[1085,2691,2692],{},"READY"," once ",[1085,2695,2680],{}," is at least 3000; while ",[1085,2698,2692],{},[1085,2700,2701],{},"Ready to fire",[1090,2703,2704,2707,2708,2711,2712,2714],{},[2607,2705,2706],{},"Note on file order:"," like the enum in Lesson 25.4's exercise, this file declares ",[1085,2709,2710],{},"ShooterState"," before the class that uses it — fine on Java 25, but Java 17's single-file launcher would need the class with ",[1085,2713,1672],{}," first.",[1090,2716,2717,2718,2720],{},"Given this enum, class, fields, and ",[1085,2719,1672],{}," method:",[1114,2722,2724],{"className":1116,"code":2723,"language":1118,"meta":1119,"style":1119},"enum ShooterState\n{\n    SPINNING_UP, READY\n}\n\npublic class ShooterStateMachine\n{\n    private ShooterState currentState = ShooterState.SPINNING_UP;\n    private double flywheelRpm = 0.0;\n\n    public void update()\n    {\n        \u002F\u002F your fragments go here\n    }\n\n    public static void main(String[] args)\n    {\n        ShooterStateMachine shooter = new ShooterStateMachine();\n        shooter.update();\n        shooter.flywheelRpm = 3200.0;\n        shooter.update();\n        shooter.update();\n    }\n}\n",[1085,2725,2726,2731,2735,2740,2744,2748,2753,2757,2762,2767,2771,2776,2780,2785,2789,2793,2798,2802,2807,2812,2817,2821,2825,2829],{"__ignoreMap":1119},[1123,2727,2728],{"class":1125,"line":1126},[1123,2729,2730],{},"enum ShooterState\n",[1123,2732,2733],{"class":1125,"line":1132},[1123,2734,1135],{},[1123,2736,2737],{"class":1125,"line":1138},[1123,2738,2739],{},"    SPINNING_UP, READY\n",[1123,2741,2742],{"class":1125,"line":1144},[1123,2743,1339],{},[1123,2745,2746],{"class":1125,"line":1150},[1123,2747,2192],{"emptyLinePlaceholder":1704},[1123,2749,2750],{"class":1125,"line":1156},[1123,2751,2752],{},"public class ShooterStateMachine\n",[1123,2754,2755],{"class":1125,"line":1162},[1123,2756,1135],{},[1123,2758,2759],{"class":1125,"line":1168},[1123,2760,2761],{},"    private ShooterState currentState = ShooterState.SPINNING_UP;\n",[1123,2763,2764],{"class":1125,"line":1174},[1123,2765,2766],{},"    private double flywheelRpm = 0.0;\n",[1123,2768,2769],{"class":1125,"line":1180},[1123,2770,2192],{"emptyLinePlaceholder":1704},[1123,2772,2773],{"class":1125,"line":1186},[1123,2774,2775],{},"    public void update()\n",[1123,2777,2778],{"class":1125,"line":1192},[1123,2779,1147],{},[1123,2781,2782],{"class":1125,"line":1198},[1123,2783,2784],{},"        \u002F\u002F your fragments go here\n",[1123,2786,2787],{"class":1125,"line":1204},[1123,2788,1333],{},[1123,2790,2791],{"class":1125,"line":1209},[1123,2792,2192],{"emptyLinePlaceholder":1704},[1123,2794,2795],{"class":1125,"line":1215},[1123,2796,2797],{},"    public static void main(String[] args)\n",[1123,2799,2800],{"class":1125,"line":1221},[1123,2801,1147],{},[1123,2803,2804],{"class":1125,"line":1226},[1123,2805,2806],{},"        ShooterStateMachine shooter = new ShooterStateMachine();\n",[1123,2808,2809],{"class":1125,"line":1232},[1123,2810,2811],{},"        shooter.update();\n",[1123,2813,2814],{"class":1125,"line":1237},[1123,2815,2816],{},"        shooter.flywheelRpm = 3200.0;\n",[1123,2818,2819],{"class":1125,"line":1242},[1123,2820,2811],{},[1123,2822,2823],{"class":1125,"line":1248},[1123,2824,2811],{},[1123,2826,2827],{"class":1125,"line":1253},[1123,2828,1333],{},[1123,2830,2831],{"class":1125,"line":1259},[1123,2832,1339],{},[1090,2834,2835,2836,1731],{},"Reorder the fragments below into the body of ",[1085,2837,1487],{},[1561,2839,2840,2846,2852,2858,2864,2870,2876,2882,2888,2894,2900,2906],{},[1564,2841,2842,2843],{},"a. ",[1085,2844,2845],{},"        switch (currentState)",[1564,2847,2848,2849],{},"b. ",[1085,2850,2851],{},"        {",[1564,2853,2854,2855],{},"c. ",[1085,2856,2857],{},"            case SPINNING_UP ->",[1564,2859,2860,2861],{},"d. ",[1085,2862,2863],{},"            {",[1564,2865,2866,2867],{},"e. ",[1085,2868,2869],{},"                System.out.println(\"Spinning up\");",[1564,2871,2872,2873],{},"f. ",[1085,2874,2875],{},"                if (flywheelRpm >= 3000)",[1564,2877,2878,2879],{},"g. ",[1085,2880,2881],{},"                {",[1564,2883,2884,2885],{},"h. ",[1085,2886,2887],{},"                    currentState = ShooterState.READY;",[1564,2889,2890,2891],{},"i. ",[1085,2892,2893],{},"                }",[1564,2895,2896,2897],{},"j. ",[1085,2898,2899],{},"            }",[1564,2901,2902,2903],{},"k. ",[1085,2904,2905],{},"            case READY -> System.out.println(\"Ready to fire\");",[1564,2907,2908,2909],{},"l. ",[1085,2910,2911],{},"        }",[1090,2913,2914,2916],{},[1105,2915,2596],{}," a, b, c, d, e, f, g, h, i, j, k, l",[1114,2918,2920],{"className":1116,"code":2919,"language":1118,"meta":1119,"style":1119},"enum ShooterState\n{\n    SPINNING_UP, READY\n}\n\npublic class ShooterStateMachine\n{\n    private ShooterState currentState = ShooterState.SPINNING_UP;\n    private double flywheelRpm = 0.0;\n\n    public void update()\n    {\n        switch (currentState)\n        {\n            case SPINNING_UP ->\n            {\n                System.out.println(\"Spinning up\");\n                if (flywheelRpm >= 3000)\n                {\n                    currentState = ShooterState.READY;\n                }\n            }\n            case READY -> System.out.println(\"Ready to fire\");\n        }\n    }\n\n    public static void main(String[] args)\n    {\n        ShooterStateMachine shooter = new ShooterStateMachine();\n        shooter.update();\n        shooter.flywheelRpm = 3200.0;\n        shooter.update();\n        shooter.update();\n    }\n}\n",[1085,2921,2922,2926,2930,2934,2938,2942,2946,2950,2954,2958,2962,2966,2970,2975,2979,2984,2988,2993,2998,3003,3008,3013,3017,3022,3026,3030,3034,3038,3042,3046,3050,3054,3058,3062,3066],{"__ignoreMap":1119},[1123,2923,2924],{"class":1125,"line":1126},[1123,2925,2730],{},[1123,2927,2928],{"class":1125,"line":1132},[1123,2929,1135],{},[1123,2931,2932],{"class":1125,"line":1138},[1123,2933,2739],{},[1123,2935,2936],{"class":1125,"line":1144},[1123,2937,1339],{},[1123,2939,2940],{"class":1125,"line":1150},[1123,2941,2192],{"emptyLinePlaceholder":1704},[1123,2943,2944],{"class":1125,"line":1156},[1123,2945,2752],{},[1123,2947,2948],{"class":1125,"line":1162},[1123,2949,1135],{},[1123,2951,2952],{"class":1125,"line":1168},[1123,2953,2761],{},[1123,2955,2956],{"class":1125,"line":1174},[1123,2957,2766],{},[1123,2959,2960],{"class":1125,"line":1180},[1123,2961,2192],{"emptyLinePlaceholder":1704},[1123,2963,2964],{"class":1125,"line":1186},[1123,2965,2775],{},[1123,2967,2968],{"class":1125,"line":1192},[1123,2969,1147],{},[1123,2971,2972],{"class":1125,"line":1198},[1123,2973,2974],{},"        switch (currentState)\n",[1123,2976,2977],{"class":1125,"line":1204},[1123,2978,1159],{},[1123,2980,2981],{"class":1125,"line":1209},[1123,2982,2983],{},"            case SPINNING_UP ->\n",[1123,2985,2986],{"class":1125,"line":1215},[1123,2987,1177],{},[1123,2989,2990],{"class":1125,"line":1221},[1123,2991,2992],{},"                System.out.println(\"Spinning up\");\n",[1123,2994,2995],{"class":1125,"line":1226},[1123,2996,2997],{},"                if (flywheelRpm >= 3000)\n",[1123,2999,3000],{"class":1125,"line":1232},[1123,3001,3002],{},"                {\n",[1123,3004,3005],{"class":1125,"line":1237},[1123,3006,3007],{},"                    currentState = ShooterState.READY;\n",[1123,3009,3010],{"class":1125,"line":1242},[1123,3011,3012],{},"                }\n",[1123,3014,3015],{"class":1125,"line":1248},[1123,3016,1189],{},[1123,3018,3019],{"class":1125,"line":1253},[1123,3020,3021],{},"            case READY -> System.out.println(\"Ready to fire\");\n",[1123,3023,3024],{"class":1125,"line":1259},[1123,3025,1195],{},[1123,3027,3028],{"class":1125,"line":1265},[1123,3029,1333],{},[1123,3031,3032],{"class":1125,"line":1270},[1123,3033,2192],{"emptyLinePlaceholder":1704},[1123,3035,3036],{"class":1125,"line":1276},[1123,3037,2797],{},[1123,3039,3040],{"class":1125,"line":1281},[1123,3041,1147],{},[1123,3043,3044],{"class":1125,"line":1286},[1123,3045,2806],{},[1123,3047,3048],{"class":1125,"line":1292},[1123,3049,2811],{},[1123,3051,3052],{"class":1125,"line":1297},[1123,3053,2816],{},[1123,3055,3056],{"class":1125,"line":1303},[1123,3057,2811],{},[1123,3059,3060],{"class":1125,"line":1309},[1123,3061,2811],{},[1123,3063,3064],{"class":1125,"line":1314},[1123,3065,1333],{},[1123,3067,3068],{"class":1125,"line":1320},[1123,3069,1339],{},[1090,3071,3072,3075,3076,3078,3079,3082,3083,3086,3087,3089,3090,3093,3094,3097,3098,3101,3102,1673,3105,3108,3109,1662,3112,1662,3115,3118,3119,3121,3122,3125,3126,1673,3128,3131,3132,3134,3135,3137,3138,3141],{},[1105,3073,3074],{},"Why this order:"," The ",[1085,3077,1087],{}," header (",[1085,3080,3081],{},"a",") and its brace (",[1085,3084,3085],{},"b",") wrap everything. ",[1085,3088,2684],{},"'s arrow case (",[1085,3091,3092],{},"c",") opens a block (",[1085,3095,3096],{},"d",") — it needs one because it runs two statements: the state action (",[1085,3099,3100],{},"e",") and then the guard, ",[1085,3103,3104],{},"if (flywheelRpm >= 3000)",[1085,3106,3107],{},"f","), whose own block (",[1085,3110,3111],{},"g",[1085,3113,3114],{},"h",[1085,3116,3117],{},"i",") makes the transition. ",[1085,3120,2684],{},"'s block closes (",[1085,3123,3124],{},"j","). ",[1085,3127,2692],{},[1085,3129,3130],{},"k",") needs no braces — one statement follows its arrow directly, ending in its own semicolon, which is why arrow-form cases don't need ",[1085,3133,1385],{},". The ",[1085,3136,1087],{},"'s brace closes last (",[1085,3139,3140],{},"l",").",[1090,3143,3144,3145,1662,3147,1662,3149,3151,3152,3154,3155,3157,3158,3160],{},"The program prints ",[1085,3146,2688],{},[1085,3148,2688],{},[1085,3150,2701],{},": on the second call the RPM check passes and the state becomes ",[1085,3153,2692],{},", but ",[1085,3156,2688],{}," was already printed earlier in that same call, before the check ran — so ",[1085,3159,2701],{}," only shows up on the third call.",[1080,3162,3164],{"id":3163},"coding","Coding",[1090,3166,3167,3170],{},[1105,3168,3169],{},"Mode:"," full-program",[1090,3172,3173,2605,3175,3178,3179,3181,3182,3184,3185,3187,3188,3191],{},[1105,3174,2667],{},[1085,3176,3177],{},"Intake"," (below) is the intake state machine from Lesson 25.5. Its inputs, its ",[1085,3180,1095],{}," field\n(starting at ",[1085,3183,1450],{},"), a ",[1085,3186,1353],{},", and a manual ",[1085,3189,3190],{},"ejectCommand()"," are already in place. Write the\nthree missing methods:",[1561,3193,3194,3316,3326],{},[1564,3195,3196,3198,3199,1897,3201,3203,3204,3206,3207,3209,3210,3213,3214,3216,3217],{},[1085,3197,1487],{},": one arrow-form ",[1085,3200,1087],{},[1085,3202,1095],{},", one ",[1085,3205,1102],{}," per state. Each case first runs\nits ",[1105,3208,1107],{}," (set the motor throttle), then checks that state's ",[1105,3211,3212],{},"guard"," and calls\n",[1085,3215,1586],{}," if it holds:",[1774,3218,3219,3235],{},[1777,3220,3221],{},[1780,3222,3223,3226,3229,3232],{},[1783,3224,3225],{},"State",[1783,3227,3228],{},"Throttle",[1783,3230,3231],{},"Moves to",[1783,3233,3234],{},"When",[1793,3236,3237,3256,3277,3296],{},[1780,3238,3239,3243,3247,3251],{},[1798,3240,3241],{},[1085,3242,1450],{},[1798,3244,3245],{},[1085,3246,1856],{},[1798,3248,3249],{},[1085,3250,1465],{},[1798,3252,3253,3255],{},[1085,3254,1364],{}," is pressed",[1780,3257,3258,3262,3267,3272],{},[1798,3259,3260],{},[1085,3261,1465],{},[1798,3263,3264],{},[1085,3265,3266],{},"0.5",[1798,3268,3269],{},[1085,3270,3271],{},"HOLDING",[1798,3273,3274,3276],{},[1085,3275,1357],{}," sees a piece",[1780,3278,3279,3283,3288,3292],{},[1798,3280,3281],{},[1085,3282,3271],{},[1798,3284,3285],{},[1085,3286,3287],{},"0.1",[1798,3289,3290],{},[1085,3291,1436],{},[1798,3293,3294,3255],{},[1085,3295,1368],{},[1780,3297,3298,3302,3307,3311],{},[1798,3299,3300],{},[1085,3301,1436],{},[1798,3303,3304],{},[1085,3305,3306],{},"-0.5",[1798,3308,3309],{},[1085,3310,1450],{},[1798,3312,3313,3315],{},[1085,3314,1357],{}," no longer sees a piece",[1564,3317,3318,3321,3322,3325],{},[1085,3319,3320],{},"enter(next)",": the one place every transition goes through. It prints ",[1085,3323,3324],{},"Intake: \u003Ccurrent> -> \u003Cnext>","\n(the entry action) and then changes the state.",[1564,3327,3328,3331,3332,3334,3335,3337,3338,3341,3342,1571],{},[1085,3329,3330],{},"stateMachineCommand()",": a command that calls ",[1085,3333,1487],{}," once per loop (",[1085,3336,1483],{},"), has the\n",[1105,3339,3340],{},"lowest priority",", requires the intake, and is named ",[1085,3343,3344],{},"\"Intake State Machine\"",[1090,3346,3347,3348,3350,3351,3353,3354,3357,3358,3361,3362,1673,3365,3367,3368,3371,3372,3375],{},"The fixed ",[1085,3349,1672],{}," installs your command as the intake's ",[1105,3352,1479],{}," and runs the ",[1105,3355,3356],{},"real\nscheduler",". It reads a number of loops, then four numbers per loop: the three inputs\n(",[1085,3359,3360],{},"intakeButton pieceSensor scoreButton",") and ",[1085,3363,3364],{},"eject",[1085,3366,2324],{}," schedules the manual eject command that\nloop). It prints the state and motor throttle after each loop. The throttle shown is the one the\n",[2607,3369,3370],{},"state you were in"," set, because the state action runs before the guard moves the machine on. While\neject runs, it owns the intake, so the state machine ",[1105,3373,3374],{},"pauses and keeps its state",". For the input\nbelow:",[1114,3377,3382],{"className":3378,"code":3380,"language":3381,"meta":1119},[3379],"language-text","3\n1 0 0 0\n0 1 0 0\n0 0 0 1\n","text",[1085,3383,3380],{"__ignoreMap":1119},[1090,3385,3386],{},"the output is:",[1114,3388,3391],{"className":3389,"code":3390,"language":3381,"meta":1119},[3379],"Intake State Machine | lowest priority: true | requires intake: true\nIntake: IDLE -> INTAKING\nINTAKING throttle 0.0\nIntake: INTAKING -> HOLDING\nHOLDING throttle 0.5\nHOLDING throttle -1.0 [eject running]\n",[1085,3392,3390],{"__ignoreMap":1119},[1090,3394,3395],{},[1105,3396,3397],{},"Starter:",[1114,3399,3401],{"className":1116,"code":3400,"language":1118,"meta":1119,"style":1119},"import java.util.*;\nimport org.wpilib.command3.Command;\nimport org.wpilib.command3.Mechanism;\nimport org.wpilib.command3.Scheduler;\nimport org.wpilib.command3.TestSupport;\n\npublic class Main\n{\n    \u002F\u002F Don't change main\n    public static void main(String[] args)\n    {\n        TestSupport.init(); \u002F\u002F a fake robot clock and opmode, so the scheduler can run without a robot\n        Scanner in = new Scanner(System.in);\n        int loops = in.nextInt();\n\n        Scheduler scheduler = Scheduler.getDefault();\n        Intake intake = new Intake();\n        Command machine = intake.stateMachineCommand();\n        intake.setDefaultCommand(machine);\n        System.out.println(machine.name() + \" | lowest priority: \" + (machine.priority() == Command.LOWEST_PRIORITY)\n            + \" | requires intake: \" + machine.requires(intake));\n\n        Command eject = intake.ejectCommand();\n        for (int i = 0; i \u003C loops; i++)\n        {\n            intake.setInputs(in.nextInt() == 1, in.nextInt() == 1, in.nextInt() == 1);\n            if (in.nextInt() == 1)\n            {\n                scheduler.schedule(eject);\n            }\n            scheduler.run();\n            System.out.println(intake.getState() + \" throttle \" + intake.getThrottle() + (scheduler.isRunning(eject) ? \" [eject running]\" : \"\"));\n        }\n    }\n}\n\n\u002F\u002F Don't change DriveMotor\nclass DriveMotor\n{\n    private final int channel;\n    private double throttle = 0.0;\n\n    public DriveMotor(int channel)\n    {\n        this.channel = channel;\n    }\n\n    public void setThrottle(double throttle)\n    {\n        this.throttle = throttle;\n    }\n\n    public double getThrottle()\n    {\n        return throttle;\n    }\n}\n\n\u002F\u002F Don't change IntakeState\nenum IntakeState\n{\n    IDLE,\n    INTAKING,\n    HOLDING,\n    SCORING\n}\n\nclass Intake implements Mechanism\n{\n    private final DriveMotor motor = new DriveMotor(5);\n    private IntakeState currentState = IntakeState.IDLE;\n    private boolean intakeButton;\n    private boolean pieceSensor;\n    private boolean scoreButton;\n\n    public void setInputs(boolean intakeButton, boolean pieceSensor, boolean scoreButton)\n    {\n        this.intakeButton = intakeButton;\n        this.pieceSensor = pieceSensor;\n        this.scoreButton = scoreButton;\n    }\n\n    public IntakeState getState()\n    {\n        return currentState;\n    }\n\n    public double getThrottle()\n    {\n        return motor.getThrottle();\n    }\n\n    \u002F\u002F A manual override: runs the rollers backward for two loops, then ends.\n    public Command ejectCommand()\n    {\n        return run(coroutine -> {\n            motor.setThrottle(-1.0);\n            coroutine.yield();\n            coroutine.yield();\n        }).named(\"Eject\");\n    }\n\n    \u002F\u002F TODO: update() - an arrow-form switch over currentState (state action, then that state's guards)\n\n    \u002F\u002F TODO: enter(IntakeState next) - print \"Intake: \u003Ccurrent> -> \u003Cnext>\", then change the state\n\n    \u002F\u002F TODO: stateMachineCommand()\n}\n",[1085,3402,3403,3408,3413,3418,3423,3428,3432,3437,3441,3446,3450,3454,3459,3464,3469,3473,3478,3483,3488,3493,3498,3503,3507,3512,3517,3521,3526,3531,3535,3540,3544,3549,3554,3558,3562,3566,3570,3575,3580,3584,3589,3594,3598,3603,3607,3613,3618,3623,3629,3634,3640,3645,3650,3656,3661,3667,3672,3677,3682,3688,3694,3699,3705,3711,3717,3723,3728,3733,3739,3744,3750,3756,3762,3768,3774,3779,3785,3790,3796,3802,3808,3813,3818,3824,3829,3835,3840,3845,3850,3855,3861,3866,3871,3877,3883,3888,3894,3900,3906,3911,3917,3922,3927,3933,3938,3944,3949,3955],{"__ignoreMap":1119},[1123,3404,3405],{"class":1125,"line":1126},[1123,3406,3407],{},"import java.util.*;\n",[1123,3409,3410],{"class":1125,"line":1132},[1123,3411,3412],{},"import org.wpilib.command3.Command;\n",[1123,3414,3415],{"class":1125,"line":1138},[1123,3416,3417],{},"import org.wpilib.command3.Mechanism;\n",[1123,3419,3420],{"class":1125,"line":1144},[1123,3421,3422],{},"import org.wpilib.command3.Scheduler;\n",[1123,3424,3425],{"class":1125,"line":1150},[1123,3426,3427],{},"import org.wpilib.command3.TestSupport;\n",[1123,3429,3430],{"class":1125,"line":1156},[1123,3431,2192],{"emptyLinePlaceholder":1704},[1123,3433,3434],{"class":1125,"line":1162},[1123,3435,3436],{},"public class Main\n",[1123,3438,3439],{"class":1125,"line":1168},[1123,3440,1135],{},[1123,3442,3443],{"class":1125,"line":1174},[1123,3444,3445],{},"    \u002F\u002F Don't change main\n",[1123,3447,3448],{"class":1125,"line":1180},[1123,3449,2797],{},[1123,3451,3452],{"class":1125,"line":1186},[1123,3453,1147],{},[1123,3455,3456],{"class":1125,"line":1192},[1123,3457,3458],{},"        TestSupport.init(); \u002F\u002F a fake robot clock and opmode, so the scheduler can run without a robot\n",[1123,3460,3461],{"class":1125,"line":1198},[1123,3462,3463],{},"        Scanner in = new Scanner(System.in);\n",[1123,3465,3466],{"class":1125,"line":1204},[1123,3467,3468],{},"        int loops = in.nextInt();\n",[1123,3470,3471],{"class":1125,"line":1209},[1123,3472,2192],{"emptyLinePlaceholder":1704},[1123,3474,3475],{"class":1125,"line":1215},[1123,3476,3477],{},"        Scheduler scheduler = Scheduler.getDefault();\n",[1123,3479,3480],{"class":1125,"line":1221},[1123,3481,3482],{},"        Intake intake = new Intake();\n",[1123,3484,3485],{"class":1125,"line":1226},[1123,3486,3487],{},"        Command machine = intake.stateMachineCommand();\n",[1123,3489,3490],{"class":1125,"line":1232},[1123,3491,3492],{},"        intake.setDefaultCommand(machine);\n",[1123,3494,3495],{"class":1125,"line":1237},[1123,3496,3497],{},"        System.out.println(machine.name() + \" | lowest priority: \" + (machine.priority() == Command.LOWEST_PRIORITY)\n",[1123,3499,3500],{"class":1125,"line":1242},[1123,3501,3502],{},"            + \" | requires intake: \" + machine.requires(intake));\n",[1123,3504,3505],{"class":1125,"line":1248},[1123,3506,2192],{"emptyLinePlaceholder":1704},[1123,3508,3509],{"class":1125,"line":1253},[1123,3510,3511],{},"        Command eject = intake.ejectCommand();\n",[1123,3513,3514],{"class":1125,"line":1259},[1123,3515,3516],{},"        for (int i = 0; i \u003C loops; i++)\n",[1123,3518,3519],{"class":1125,"line":1265},[1123,3520,1159],{},[1123,3522,3523],{"class":1125,"line":1270},[1123,3524,3525],{},"            intake.setInputs(in.nextInt() == 1, in.nextInt() == 1, in.nextInt() == 1);\n",[1123,3527,3528],{"class":1125,"line":1276},[1123,3529,3530],{},"            if (in.nextInt() == 1)\n",[1123,3532,3533],{"class":1125,"line":1281},[1123,3534,1177],{},[1123,3536,3537],{"class":1125,"line":1286},[1123,3538,3539],{},"                scheduler.schedule(eject);\n",[1123,3541,3542],{"class":1125,"line":1292},[1123,3543,1189],{},[1123,3545,3546],{"class":1125,"line":1297},[1123,3547,3548],{},"            scheduler.run();\n",[1123,3550,3551],{"class":1125,"line":1303},[1123,3552,3553],{},"            System.out.println(intake.getState() + \" throttle \" + intake.getThrottle() + (scheduler.isRunning(eject) ? \" [eject running]\" : \"\"));\n",[1123,3555,3556],{"class":1125,"line":1309},[1123,3557,1195],{},[1123,3559,3560],{"class":1125,"line":1314},[1123,3561,1333],{},[1123,3563,3564],{"class":1125,"line":1320},[1123,3565,1339],{},[1123,3567,3568],{"class":1125,"line":1325},[1123,3569,2192],{"emptyLinePlaceholder":1704},[1123,3571,3572],{"class":1125,"line":1330},[1123,3573,3574],{},"\u002F\u002F Don't change DriveMotor\n",[1123,3576,3577],{"class":1125,"line":1336},[1123,3578,3579],{},"class DriveMotor\n",[1123,3581,3582],{"class":1125,"line":2189},[1123,3583,1135],{},[1123,3585,3586],{"class":1125,"line":2195},[1123,3587,3588],{},"    private final int channel;\n",[1123,3590,3591],{"class":1125,"line":2201},[1123,3592,3593],{},"    private double throttle = 0.0;\n",[1123,3595,3596],{"class":1125,"line":2206},[1123,3597,2192],{"emptyLinePlaceholder":1704},[1123,3599,3600],{"class":1125,"line":2212},[1123,3601,3602],{},"    public DriveMotor(int channel)\n",[1123,3604,3605],{"class":1125,"line":2217},[1123,3606,1147],{},[1123,3608,3610],{"class":1125,"line":3609},45,[1123,3611,3612],{},"        this.channel = channel;\n",[1123,3614,3616],{"class":1125,"line":3615},46,[1123,3617,1333],{},[1123,3619,3621],{"class":1125,"line":3620},47,[1123,3622,2192],{"emptyLinePlaceholder":1704},[1123,3624,3626],{"class":1125,"line":3625},48,[1123,3627,3628],{},"    public void setThrottle(double throttle)\n",[1123,3630,3632],{"class":1125,"line":3631},49,[1123,3633,1147],{},[1123,3635,3637],{"class":1125,"line":3636},50,[1123,3638,3639],{},"        this.throttle = throttle;\n",[1123,3641,3643],{"class":1125,"line":3642},51,[1123,3644,1333],{},[1123,3646,3648],{"class":1125,"line":3647},52,[1123,3649,2192],{"emptyLinePlaceholder":1704},[1123,3651,3653],{"class":1125,"line":3652},53,[1123,3654,3655],{},"    public double getThrottle()\n",[1123,3657,3659],{"class":1125,"line":3658},54,[1123,3660,1147],{},[1123,3662,3664],{"class":1125,"line":3663},55,[1123,3665,3666],{},"        return throttle;\n",[1123,3668,3670],{"class":1125,"line":3669},56,[1123,3671,1333],{},[1123,3673,3675],{"class":1125,"line":3674},57,[1123,3676,1339],{},[1123,3678,3680],{"class":1125,"line":3679},58,[1123,3681,2192],{"emptyLinePlaceholder":1704},[1123,3683,3685],{"class":1125,"line":3684},59,[1123,3686,3687],{},"\u002F\u002F Don't change IntakeState\n",[1123,3689,3691],{"class":1125,"line":3690},60,[1123,3692,3693],{},"enum IntakeState\n",[1123,3695,3697],{"class":1125,"line":3696},61,[1123,3698,1135],{},[1123,3700,3702],{"class":1125,"line":3701},62,[1123,3703,3704],{},"    IDLE,\n",[1123,3706,3708],{"class":1125,"line":3707},63,[1123,3709,3710],{},"    INTAKING,\n",[1123,3712,3714],{"class":1125,"line":3713},64,[1123,3715,3716],{},"    HOLDING,\n",[1123,3718,3720],{"class":1125,"line":3719},65,[1123,3721,3722],{},"    SCORING\n",[1123,3724,3726],{"class":1125,"line":3725},66,[1123,3727,1339],{},[1123,3729,3731],{"class":1125,"line":3730},67,[1123,3732,2192],{"emptyLinePlaceholder":1704},[1123,3734,3736],{"class":1125,"line":3735},68,[1123,3737,3738],{},"class Intake implements Mechanism\n",[1123,3740,3742],{"class":1125,"line":3741},69,[1123,3743,1135],{},[1123,3745,3747],{"class":1125,"line":3746},70,[1123,3748,3749],{},"    private final DriveMotor motor = new DriveMotor(5);\n",[1123,3751,3753],{"class":1125,"line":3752},71,[1123,3754,3755],{},"    private IntakeState currentState = IntakeState.IDLE;\n",[1123,3757,3759],{"class":1125,"line":3758},72,[1123,3760,3761],{},"    private boolean intakeButton;\n",[1123,3763,3765],{"class":1125,"line":3764},73,[1123,3766,3767],{},"    private boolean pieceSensor;\n",[1123,3769,3771],{"class":1125,"line":3770},74,[1123,3772,3773],{},"    private boolean scoreButton;\n",[1123,3775,3777],{"class":1125,"line":3776},75,[1123,3778,2192],{"emptyLinePlaceholder":1704},[1123,3780,3782],{"class":1125,"line":3781},76,[1123,3783,3784],{},"    public void setInputs(boolean intakeButton, boolean pieceSensor, boolean scoreButton)\n",[1123,3786,3788],{"class":1125,"line":3787},77,[1123,3789,1147],{},[1123,3791,3793],{"class":1125,"line":3792},78,[1123,3794,3795],{},"        this.intakeButton = intakeButton;\n",[1123,3797,3799],{"class":1125,"line":3798},79,[1123,3800,3801],{},"        this.pieceSensor = pieceSensor;\n",[1123,3803,3805],{"class":1125,"line":3804},80,[1123,3806,3807],{},"        this.scoreButton = scoreButton;\n",[1123,3809,3811],{"class":1125,"line":3810},81,[1123,3812,1333],{},[1123,3814,3816],{"class":1125,"line":3815},82,[1123,3817,2192],{"emptyLinePlaceholder":1704},[1123,3819,3821],{"class":1125,"line":3820},83,[1123,3822,3823],{},"    public IntakeState getState()\n",[1123,3825,3827],{"class":1125,"line":3826},84,[1123,3828,1147],{},[1123,3830,3832],{"class":1125,"line":3831},85,[1123,3833,3834],{},"        return currentState;\n",[1123,3836,3838],{"class":1125,"line":3837},86,[1123,3839,1333],{},[1123,3841,3843],{"class":1125,"line":3842},87,[1123,3844,2192],{"emptyLinePlaceholder":1704},[1123,3846,3848],{"class":1125,"line":3847},88,[1123,3849,3655],{},[1123,3851,3853],{"class":1125,"line":3852},89,[1123,3854,1147],{},[1123,3856,3858],{"class":1125,"line":3857},90,[1123,3859,3860],{},"        return motor.getThrottle();\n",[1123,3862,3864],{"class":1125,"line":3863},91,[1123,3865,1333],{},[1123,3867,3869],{"class":1125,"line":3868},92,[1123,3870,2192],{"emptyLinePlaceholder":1704},[1123,3872,3874],{"class":1125,"line":3873},93,[1123,3875,3876],{},"    \u002F\u002F A manual override: runs the rollers backward for two loops, then ends.\n",[1123,3878,3880],{"class":1125,"line":3879},94,[1123,3881,3882],{},"    public Command ejectCommand()\n",[1123,3884,3886],{"class":1125,"line":3885},95,[1123,3887,1147],{},[1123,3889,3891],{"class":1125,"line":3890},96,[1123,3892,3893],{},"        return run(coroutine -> {\n",[1123,3895,3897],{"class":1125,"line":3896},97,[1123,3898,3899],{},"            motor.setThrottle(-1.0);\n",[1123,3901,3903],{"class":1125,"line":3902},98,[1123,3904,3905],{},"            coroutine.yield();\n",[1123,3907,3909],{"class":1125,"line":3908},99,[1123,3910,3905],{},[1123,3912,3914],{"class":1125,"line":3913},100,[1123,3915,3916],{},"        }).named(\"Eject\");\n",[1123,3918,3920],{"class":1125,"line":3919},101,[1123,3921,1333],{},[1123,3923,3925],{"class":1125,"line":3924},102,[1123,3926,2192],{"emptyLinePlaceholder":1704},[1123,3928,3930],{"class":1125,"line":3929},103,[1123,3931,3932],{},"    \u002F\u002F TODO: update() - an arrow-form switch over currentState (state action, then that state's guards)\n",[1123,3934,3936],{"class":1125,"line":3935},104,[1123,3937,2192],{"emptyLinePlaceholder":1704},[1123,3939,3941],{"class":1125,"line":3940},105,[1123,3942,3943],{},"    \u002F\u002F TODO: enter(IntakeState next) - print \"Intake: \u003Ccurrent> -> \u003Cnext>\", then change the state\n",[1123,3945,3947],{"class":1125,"line":3946},106,[1123,3948,2192],{"emptyLinePlaceholder":1704},[1123,3950,3952],{"class":1125,"line":3951},107,[1123,3953,3954],{},"    \u002F\u002F TODO: stateMachineCommand()\n",[1123,3956,3958],{"class":1125,"line":3957},108,[1123,3959,1339],{},[1090,3961,3962],{},[1105,3963,3964],{},"Scenario 1 (visible):",[1090,3966,3967],{},[1105,3968,3969],{},"Input:",[1114,3971,3973],{"className":3972,"code":3380,"language":3381,"meta":1119},[3379],[1085,3974,3380],{"__ignoreMap":1119},[1090,3976,3977],{},[1105,3978,3979],{},"Expected output:",[1114,3981,3983],{"className":3982,"code":3390,"language":3381,"meta":1119},[3379],[1085,3984,3390],{"__ignoreMap":1119},[1090,3986,3987],{},[1105,3988,3989],{},"Scenario 2 (visible):",[1090,3991,3992],{},[1105,3993,3969],{},[1114,3995,3998],{"className":3996,"code":3997,"language":3381,"meta":1119},[3379],"3\n0 0 0 0\n0 0 0 0\n0 0 0 0\n",[1085,3999,3997],{"__ignoreMap":1119},[1090,4001,4002],{},[1105,4003,3979],{},[1114,4005,4008],{"className":4006,"code":4007,"language":3381,"meta":1119},[3379],"Intake State Machine | lowest priority: true | requires intake: true\nIDLE throttle 0.0\nIDLE throttle 0.0\nIDLE throttle 0.0\n",[1085,4009,4007],{"__ignoreMap":1119},[1090,4011,4012],{},[1105,4013,4014],{},"Scenario 3 (hidden):",[1090,4016,4017],{},[1105,4018,3969],{},[1114,4020,4023],{"className":4021,"code":4022,"language":3381,"meta":1119},[3379],"5\n1 0 0 0\n0 1 0 0\n0 1 1 0\n0 0 0 0\n1 0 0 0\n",[1085,4024,4022],{"__ignoreMap":1119},[1090,4026,4027],{},[1105,4028,3979],{},[1114,4030,4033],{"className":4031,"code":4032,"language":3381,"meta":1119},[3379],"Intake State Machine | lowest priority: true | requires intake: true\nIntake: IDLE -> INTAKING\nINTAKING throttle 0.0\nIntake: INTAKING -> HOLDING\nHOLDING throttle 0.5\nIntake: HOLDING -> SCORING\nSCORING throttle 0.1\nIntake: SCORING -> IDLE\nIDLE throttle -0.5\nIntake: IDLE -> INTAKING\nINTAKING throttle 0.0\n",[1085,4034,4032],{"__ignoreMap":1119},[1090,4036,4037],{},[1105,4038,4039],{},"Scenario 4 (hidden):",[1090,4041,4042],{},[1105,4043,3969],{},[1114,4045,4048],{"className":4046,"code":4047,"language":3381,"meta":1119},[3379],"4\n0 1 1 0\n1 1 1 0\n0 0 1 0\n0 0 0 0\n",[1085,4049,4047],{"__ignoreMap":1119},[1090,4051,4052],{},[1105,4053,3979],{},[1114,4055,4058],{"className":4056,"code":4057,"language":3381,"meta":1119},[3379],"Intake State Machine | lowest priority: true | requires intake: true\nIDLE throttle 0.0\nIntake: IDLE -> INTAKING\nINTAKING throttle 0.0\nINTAKING throttle 0.5\nINTAKING throttle 0.5\n",[1085,4059,4057],{"__ignoreMap":1119},[1090,4061,4062],{},[1105,4063,4064],{},"Scenario 5 (hidden):",[1090,4066,4067],{},[1105,4068,3969],{},[1114,4070,4073],{"className":4071,"code":4072,"language":3381,"meta":1119},[3379],"7\n1 0 0 0\n0 0 0 1\n0 0 0 0\n0 0 0 0\n0 1 0 0\n0 1 0 0\n0 1 0 0\n",[1085,4074,4072],{"__ignoreMap":1119},[1090,4076,4077],{},[1105,4078,3979],{},[1114,4080,4083],{"className":4081,"code":4082,"language":3381,"meta":1119},[3379],"Intake State Machine | lowest priority: true | requires intake: true\nIntake: IDLE -> INTAKING\nINTAKING throttle 0.0\nINTAKING throttle -1.0 [eject running]\nINTAKING throttle -1.0 [eject running]\nINTAKING throttle -1.0\nIntake: INTAKING -> HOLDING\nHOLDING throttle 0.5\nHOLDING throttle 0.1\nHOLDING throttle 0.1\n",[1085,4084,4082],{"__ignoreMap":1119},[1090,4086,4087],{},[1105,4088,4089],{},"Solution:",[1114,4091,4093],{"className":1116,"code":4092,"language":1118,"meta":1119,"style":1119},"import java.util.*;\nimport org.wpilib.command3.Command;\nimport org.wpilib.command3.Mechanism;\nimport org.wpilib.command3.Scheduler;\nimport org.wpilib.command3.TestSupport;\n\npublic class Main\n{\n    \u002F\u002F Don't change main\n    public static void main(String[] args)\n    {\n        TestSupport.init(); \u002F\u002F a fake robot clock and opmode, so the scheduler can run without a robot\n        Scanner in = new Scanner(System.in);\n        int loops = in.nextInt();\n\n        Scheduler scheduler = Scheduler.getDefault();\n        Intake intake = new Intake();\n        Command machine = intake.stateMachineCommand();\n        intake.setDefaultCommand(machine);\n        System.out.println(machine.name() + \" | lowest priority: \" + (machine.priority() == Command.LOWEST_PRIORITY)\n            + \" | requires intake: \" + machine.requires(intake));\n\n        Command eject = intake.ejectCommand();\n        for (int i = 0; i \u003C loops; i++)\n        {\n            intake.setInputs(in.nextInt() == 1, in.nextInt() == 1, in.nextInt() == 1);\n            if (in.nextInt() == 1)\n            {\n                scheduler.schedule(eject);\n            }\n            scheduler.run();\n            System.out.println(intake.getState() + \" throttle \" + intake.getThrottle() + (scheduler.isRunning(eject) ? \" [eject running]\" : \"\"));\n        }\n    }\n}\n\n\u002F\u002F Don't change DriveMotor\nclass DriveMotor\n{\n    private final int channel;\n    private double throttle = 0.0;\n\n    public DriveMotor(int channel)\n    {\n        this.channel = channel;\n    }\n\n    public void setThrottle(double throttle)\n    {\n        this.throttle = throttle;\n    }\n\n    public double getThrottle()\n    {\n        return throttle;\n    }\n}\n\n\u002F\u002F Don't change IntakeState\nenum IntakeState\n{\n    IDLE,\n    INTAKING,\n    HOLDING,\n    SCORING\n}\n\nclass Intake implements Mechanism\n{\n    private final DriveMotor motor = new DriveMotor(5);\n    private IntakeState currentState = IntakeState.IDLE;\n    private boolean intakeButton;\n    private boolean pieceSensor;\n    private boolean scoreButton;\n\n    public void setInputs(boolean intakeButton, boolean pieceSensor, boolean scoreButton)\n    {\n        this.intakeButton = intakeButton;\n        this.pieceSensor = pieceSensor;\n        this.scoreButton = scoreButton;\n    }\n\n    public IntakeState getState()\n    {\n        return currentState;\n    }\n\n    public double getThrottle()\n    {\n        return motor.getThrottle();\n    }\n\n    \u002F\u002F A manual override: runs the rollers backward for two loops, then ends.\n    public Command ejectCommand()\n    {\n        return run(coroutine -> {\n            motor.setThrottle(-1.0);\n            coroutine.yield();\n            coroutine.yield();\n        }).named(\"Eject\");\n    }\n\n    public void update()\n    {\n        switch (currentState)\n        {\n            case IDLE ->\n            {\n                motor.setThrottle(0.0);\n                if (intakeButton)\n                {\n                    enter(IntakeState.INTAKING);\n                }\n            }\n            case INTAKING ->\n            {\n                motor.setThrottle(0.5);\n                if (pieceSensor)\n                {\n                    enter(IntakeState.HOLDING);\n                }\n            }\n            case HOLDING ->\n            {\n                motor.setThrottle(0.1);\n                if (scoreButton)\n                {\n                    enter(IntakeState.SCORING);\n                }\n            }\n            case SCORING ->\n            {\n                motor.setThrottle(-0.5);\n                if (!pieceSensor)\n                {\n                    enter(IntakeState.IDLE);\n                }\n            }\n        }\n    }\n\n    private void enter(IntakeState next)\n    {\n        System.out.println(\"Intake: \" + currentState + \" -> \" + next);\n        currentState = next;\n    }\n\n    public Command stateMachineCommand()\n    {\n        return runRepeatedly(this::update)\n            .withPriority(Command.LOWEST_PRIORITY)\n            .named(\"Intake State Machine\");\n    }\n}\n",[1085,4094,4095,4099,4103,4107,4111,4115,4119,4123,4127,4131,4135,4139,4143,4147,4151,4155,4159,4163,4167,4171,4175,4179,4183,4187,4191,4195,4199,4203,4207,4211,4215,4219,4223,4227,4231,4235,4239,4243,4247,4251,4255,4259,4263,4267,4271,4275,4279,4283,4287,4291,4295,4299,4303,4307,4311,4315,4319,4323,4327,4331,4335,4339,4343,4347,4351,4355,4359,4363,4367,4371,4375,4379,4383,4387,4391,4395,4399,4403,4407,4411,4415,4419,4423,4427,4431,4435,4439,4443,4447,4451,4455,4459,4463,4467,4471,4475,4479,4483,4487,4491,4495,4499,4503,4507,4511,4515,4519,4524,4528,4534,4540,4545,4551,4556,4561,4567,4572,4578,4584,4589,4595,4600,4605,4611,4616,4622,4628,4633,4639,4644,4649,4655,4660,4666,4672,4677,4683,4688,4693,4698,4703,4708,4714,4719,4725,4731,4736,4741,4747,4752,4758,4764,4770,4775],{"__ignoreMap":1119},[1123,4096,4097],{"class":1125,"line":1126},[1123,4098,3407],{},[1123,4100,4101],{"class":1125,"line":1132},[1123,4102,3412],{},[1123,4104,4105],{"class":1125,"line":1138},[1123,4106,3417],{},[1123,4108,4109],{"class":1125,"line":1144},[1123,4110,3422],{},[1123,4112,4113],{"class":1125,"line":1150},[1123,4114,3427],{},[1123,4116,4117],{"class":1125,"line":1156},[1123,4118,2192],{"emptyLinePlaceholder":1704},[1123,4120,4121],{"class":1125,"line":1162},[1123,4122,3436],{},[1123,4124,4125],{"class":1125,"line":1168},[1123,4126,1135],{},[1123,4128,4129],{"class":1125,"line":1174},[1123,4130,3445],{},[1123,4132,4133],{"class":1125,"line":1180},[1123,4134,2797],{},[1123,4136,4137],{"class":1125,"line":1186},[1123,4138,1147],{},[1123,4140,4141],{"class":1125,"line":1192},[1123,4142,3458],{},[1123,4144,4145],{"class":1125,"line":1198},[1123,4146,3463],{},[1123,4148,4149],{"class":1125,"line":1204},[1123,4150,3468],{},[1123,4152,4153],{"class":1125,"line":1209},[1123,4154,2192],{"emptyLinePlaceholder":1704},[1123,4156,4157],{"class":1125,"line":1215},[1123,4158,3477],{},[1123,4160,4161],{"class":1125,"line":1221},[1123,4162,3482],{},[1123,4164,4165],{"class":1125,"line":1226},[1123,4166,3487],{},[1123,4168,4169],{"class":1125,"line":1232},[1123,4170,3492],{},[1123,4172,4173],{"class":1125,"line":1237},[1123,4174,3497],{},[1123,4176,4177],{"class":1125,"line":1242},[1123,4178,3502],{},[1123,4180,4181],{"class":1125,"line":1248},[1123,4182,2192],{"emptyLinePlaceholder":1704},[1123,4184,4185],{"class":1125,"line":1253},[1123,4186,3511],{},[1123,4188,4189],{"class":1125,"line":1259},[1123,4190,3516],{},[1123,4192,4193],{"class":1125,"line":1265},[1123,4194,1159],{},[1123,4196,4197],{"class":1125,"line":1270},[1123,4198,3525],{},[1123,4200,4201],{"class":1125,"line":1276},[1123,4202,3530],{},[1123,4204,4205],{"class":1125,"line":1281},[1123,4206,1177],{},[1123,4208,4209],{"class":1125,"line":1286},[1123,4210,3539],{},[1123,4212,4213],{"class":1125,"line":1292},[1123,4214,1189],{},[1123,4216,4217],{"class":1125,"line":1297},[1123,4218,3548],{},[1123,4220,4221],{"class":1125,"line":1303},[1123,4222,3553],{},[1123,4224,4225],{"class":1125,"line":1309},[1123,4226,1195],{},[1123,4228,4229],{"class":1125,"line":1314},[1123,4230,1333],{},[1123,4232,4233],{"class":1125,"line":1320},[1123,4234,1339],{},[1123,4236,4237],{"class":1125,"line":1325},[1123,4238,2192],{"emptyLinePlaceholder":1704},[1123,4240,4241],{"class":1125,"line":1330},[1123,4242,3574],{},[1123,4244,4245],{"class":1125,"line":1336},[1123,4246,3579],{},[1123,4248,4249],{"class":1125,"line":2189},[1123,4250,1135],{},[1123,4252,4253],{"class":1125,"line":2195},[1123,4254,3588],{},[1123,4256,4257],{"class":1125,"line":2201},[1123,4258,3593],{},[1123,4260,4261],{"class":1125,"line":2206},[1123,4262,2192],{"emptyLinePlaceholder":1704},[1123,4264,4265],{"class":1125,"line":2212},[1123,4266,3602],{},[1123,4268,4269],{"class":1125,"line":2217},[1123,4270,1147],{},[1123,4272,4273],{"class":1125,"line":3609},[1123,4274,3612],{},[1123,4276,4277],{"class":1125,"line":3615},[1123,4278,1333],{},[1123,4280,4281],{"class":1125,"line":3620},[1123,4282,2192],{"emptyLinePlaceholder":1704},[1123,4284,4285],{"class":1125,"line":3625},[1123,4286,3628],{},[1123,4288,4289],{"class":1125,"line":3631},[1123,4290,1147],{},[1123,4292,4293],{"class":1125,"line":3636},[1123,4294,3639],{},[1123,4296,4297],{"class":1125,"line":3642},[1123,4298,1333],{},[1123,4300,4301],{"class":1125,"line":3647},[1123,4302,2192],{"emptyLinePlaceholder":1704},[1123,4304,4305],{"class":1125,"line":3652},[1123,4306,3655],{},[1123,4308,4309],{"class":1125,"line":3658},[1123,4310,1147],{},[1123,4312,4313],{"class":1125,"line":3663},[1123,4314,3666],{},[1123,4316,4317],{"class":1125,"line":3669},[1123,4318,1333],{},[1123,4320,4321],{"class":1125,"line":3674},[1123,4322,1339],{},[1123,4324,4325],{"class":1125,"line":3679},[1123,4326,2192],{"emptyLinePlaceholder":1704},[1123,4328,4329],{"class":1125,"line":3684},[1123,4330,3687],{},[1123,4332,4333],{"class":1125,"line":3690},[1123,4334,3693],{},[1123,4336,4337],{"class":1125,"line":3696},[1123,4338,1135],{},[1123,4340,4341],{"class":1125,"line":3701},[1123,4342,3704],{},[1123,4344,4345],{"class":1125,"line":3707},[1123,4346,3710],{},[1123,4348,4349],{"class":1125,"line":3713},[1123,4350,3716],{},[1123,4352,4353],{"class":1125,"line":3719},[1123,4354,3722],{},[1123,4356,4357],{"class":1125,"line":3725},[1123,4358,1339],{},[1123,4360,4361],{"class":1125,"line":3730},[1123,4362,2192],{"emptyLinePlaceholder":1704},[1123,4364,4365],{"class":1125,"line":3735},[1123,4366,3738],{},[1123,4368,4369],{"class":1125,"line":3741},[1123,4370,1135],{},[1123,4372,4373],{"class":1125,"line":3746},[1123,4374,3749],{},[1123,4376,4377],{"class":1125,"line":3752},[1123,4378,3755],{},[1123,4380,4381],{"class":1125,"line":3758},[1123,4382,3761],{},[1123,4384,4385],{"class":1125,"line":3764},[1123,4386,3767],{},[1123,4388,4389],{"class":1125,"line":3770},[1123,4390,3773],{},[1123,4392,4393],{"class":1125,"line":3776},[1123,4394,2192],{"emptyLinePlaceholder":1704},[1123,4396,4397],{"class":1125,"line":3781},[1123,4398,3784],{},[1123,4400,4401],{"class":1125,"line":3787},[1123,4402,1147],{},[1123,4404,4405],{"class":1125,"line":3792},[1123,4406,3795],{},[1123,4408,4409],{"class":1125,"line":3798},[1123,4410,3801],{},[1123,4412,4413],{"class":1125,"line":3804},[1123,4414,3807],{},[1123,4416,4417],{"class":1125,"line":3810},[1123,4418,1333],{},[1123,4420,4421],{"class":1125,"line":3815},[1123,4422,2192],{"emptyLinePlaceholder":1704},[1123,4424,4425],{"class":1125,"line":3820},[1123,4426,3823],{},[1123,4428,4429],{"class":1125,"line":3826},[1123,4430,1147],{},[1123,4432,4433],{"class":1125,"line":3831},[1123,4434,3834],{},[1123,4436,4437],{"class":1125,"line":3837},[1123,4438,1333],{},[1123,4440,4441],{"class":1125,"line":3842},[1123,4442,2192],{"emptyLinePlaceholder":1704},[1123,4444,4445],{"class":1125,"line":3847},[1123,4446,3655],{},[1123,4448,4449],{"class":1125,"line":3852},[1123,4450,1147],{},[1123,4452,4453],{"class":1125,"line":3857},[1123,4454,3860],{},[1123,4456,4457],{"class":1125,"line":3863},[1123,4458,1333],{},[1123,4460,4461],{"class":1125,"line":3868},[1123,4462,2192],{"emptyLinePlaceholder":1704},[1123,4464,4465],{"class":1125,"line":3873},[1123,4466,3876],{},[1123,4468,4469],{"class":1125,"line":3879},[1123,4470,3882],{},[1123,4472,4473],{"class":1125,"line":3885},[1123,4474,1147],{},[1123,4476,4477],{"class":1125,"line":3890},[1123,4478,3893],{},[1123,4480,4481],{"class":1125,"line":3896},[1123,4482,3899],{},[1123,4484,4485],{"class":1125,"line":3902},[1123,4486,3905],{},[1123,4488,4489],{"class":1125,"line":3908},[1123,4490,3905],{},[1123,4492,4493],{"class":1125,"line":3913},[1123,4494,3916],{},[1123,4496,4497],{"class":1125,"line":3919},[1123,4498,1333],{},[1123,4500,4501],{"class":1125,"line":3924},[1123,4502,2192],{"emptyLinePlaceholder":1704},[1123,4504,4505],{"class":1125,"line":3929},[1123,4506,2775],{},[1123,4508,4509],{"class":1125,"line":3935},[1123,4510,1147],{},[1123,4512,4513],{"class":1125,"line":3940},[1123,4514,2974],{},[1123,4516,4517],{"class":1125,"line":3946},[1123,4518,1159],{},[1123,4520,4521],{"class":1125,"line":3951},[1123,4522,4523],{},"            case IDLE ->\n",[1123,4525,4526],{"class":1125,"line":3957},[1123,4527,1177],{},[1123,4529,4531],{"class":1125,"line":4530},109,[1123,4532,4533],{},"                motor.setThrottle(0.0);\n",[1123,4535,4537],{"class":1125,"line":4536},110,[1123,4538,4539],{},"                if (intakeButton)\n",[1123,4541,4543],{"class":1125,"line":4542},111,[1123,4544,3002],{},[1123,4546,4548],{"class":1125,"line":4547},112,[1123,4549,4550],{},"                    enter(IntakeState.INTAKING);\n",[1123,4552,4554],{"class":1125,"line":4553},113,[1123,4555,3012],{},[1123,4557,4559],{"class":1125,"line":4558},114,[1123,4560,1189],{},[1123,4562,4564],{"class":1125,"line":4563},115,[1123,4565,4566],{},"            case INTAKING ->\n",[1123,4568,4570],{"class":1125,"line":4569},116,[1123,4571,1177],{},[1123,4573,4575],{"class":1125,"line":4574},117,[1123,4576,4577],{},"                motor.setThrottle(0.5);\n",[1123,4579,4581],{"class":1125,"line":4580},118,[1123,4582,4583],{},"                if (pieceSensor)\n",[1123,4585,4587],{"class":1125,"line":4586},119,[1123,4588,3002],{},[1123,4590,4592],{"class":1125,"line":4591},120,[1123,4593,4594],{},"                    enter(IntakeState.HOLDING);\n",[1123,4596,4598],{"class":1125,"line":4597},121,[1123,4599,3012],{},[1123,4601,4603],{"class":1125,"line":4602},122,[1123,4604,1189],{},[1123,4606,4608],{"class":1125,"line":4607},123,[1123,4609,4610],{},"            case HOLDING ->\n",[1123,4612,4614],{"class":1125,"line":4613},124,[1123,4615,1177],{},[1123,4617,4619],{"class":1125,"line":4618},125,[1123,4620,4621],{},"                motor.setThrottle(0.1);\n",[1123,4623,4625],{"class":1125,"line":4624},126,[1123,4626,4627],{},"                if (scoreButton)\n",[1123,4629,4631],{"class":1125,"line":4630},127,[1123,4632,3002],{},[1123,4634,4636],{"class":1125,"line":4635},128,[1123,4637,4638],{},"                    enter(IntakeState.SCORING);\n",[1123,4640,4642],{"class":1125,"line":4641},129,[1123,4643,3012],{},[1123,4645,4647],{"class":1125,"line":4646},130,[1123,4648,1189],{},[1123,4650,4652],{"class":1125,"line":4651},131,[1123,4653,4654],{},"            case SCORING ->\n",[1123,4656,4658],{"class":1125,"line":4657},132,[1123,4659,1177],{},[1123,4661,4663],{"class":1125,"line":4662},133,[1123,4664,4665],{},"                motor.setThrottle(-0.5);\n",[1123,4667,4669],{"class":1125,"line":4668},134,[1123,4670,4671],{},"                if (!pieceSensor)\n",[1123,4673,4675],{"class":1125,"line":4674},135,[1123,4676,3002],{},[1123,4678,4680],{"class":1125,"line":4679},136,[1123,4681,4682],{},"                    enter(IntakeState.IDLE);\n",[1123,4684,4686],{"class":1125,"line":4685},137,[1123,4687,3012],{},[1123,4689,4691],{"class":1125,"line":4690},138,[1123,4692,1189],{},[1123,4694,4696],{"class":1125,"line":4695},139,[1123,4697,1195],{},[1123,4699,4701],{"class":1125,"line":4700},140,[1123,4702,1333],{},[1123,4704,4706],{"class":1125,"line":4705},141,[1123,4707,2192],{"emptyLinePlaceholder":1704},[1123,4709,4711],{"class":1125,"line":4710},142,[1123,4712,4713],{},"    private void enter(IntakeState next)\n",[1123,4715,4717],{"class":1125,"line":4716},143,[1123,4718,1147],{},[1123,4720,4722],{"class":1125,"line":4721},144,[1123,4723,4724],{},"        System.out.println(\"Intake: \" + currentState + \" -> \" + next);\n",[1123,4726,4728],{"class":1125,"line":4727},145,[1123,4729,4730],{},"        currentState = next;\n",[1123,4732,4734],{"class":1125,"line":4733},146,[1123,4735,1333],{},[1123,4737,4739],{"class":1125,"line":4738},147,[1123,4740,2192],{"emptyLinePlaceholder":1704},[1123,4742,4744],{"class":1125,"line":4743},148,[1123,4745,4746],{},"    public Command stateMachineCommand()\n",[1123,4748,4750],{"class":1125,"line":4749},149,[1123,4751,1147],{},[1123,4753,4755],{"class":1125,"line":4754},150,[1123,4756,4757],{},"        return runRepeatedly(this::update)\n",[1123,4759,4761],{"class":1125,"line":4760},151,[1123,4762,4763],{},"            .withPriority(Command.LOWEST_PRIORITY)\n",[1123,4765,4767],{"class":1125,"line":4766},152,[1123,4768,4769],{},"            .named(\"Intake State Machine\");\n",[1123,4771,4773],{"class":1125,"line":4772},153,[1123,4774,1333],{},[1123,4776,4778],{"class":1125,"line":4777},154,[1123,4779,1339],{},[1090,4781,4782,4784,4785,4787,4788,4790,4791,4793,4794,4796,4797,4799,4800,4802,4803,4806,4807,4809,4810,4812,4813,4815,4816,4819,4820,4823,4824,4827,4828,4830,4831,4833,4834,4837],{},[1105,4783,2602],{}," Every row of the table became one ",[1085,4786,1345],{}," inside the ",[1085,4789,1102],{}," for its ",[1105,4792,1785],{}," state, after that case's\nstate action. Because all transitions go through ",[1085,4795,1586],{},", the entry action (the log line) lives\nin exactly one place, and the arrow-form ",[1085,4798,1087],{}," can't fall through, so no ",[1085,4801,1385],{}," is needed. The\nmachine only moves ",[1105,4804,4805],{},"once per loop",": scenario 4's second input row sets all three inputs, but in\n",[1085,4808,1450],{}," only ",[1085,4811,1364],{}," matters, so it moves to ",[1085,4814,1465],{}," and stops there. The command is built\nwith ",[1085,4817,4818],{},"runRepeatedly(this::update)"," so the switch runs once per scheduler loop; ",[1085,4821,4822],{},".withPriority( Command.LOWEST_PRIORITY)"," goes before ",[1085,4825,4826],{},".named(...)",", and it requires the intake because it was built\nwith the intake's own ",[1085,4829,1483],{},". Because it is a low-priority ",[1105,4832,1479],{},", the manual\neject command (default priority) takes the intake from it: in scenario 5 the state stays frozen\nwhile ",[1085,4835,4836],{},"[eject running]"," shows, and once eject ends the default command is queued again on the next\nloop (so the machine skips one loop), then carries on from the state it was in.",[1686,4839,1688],{},{"title":1119,"searchDepth":1132,"depth":1132,"links":4841},[4842,4843,4844],{"id":2494,"depth":1132,"text":2495},{"id":2661,"depth":1132,"text":2662},{"id":3163,"depth":1132,"text":3164},{"outlineRef":1702,"pairsWith":2481,"status":4846},"new — authored exercises (Multiple Choice + Micro-Parsons + Coding); rewritten for the arrow-form switch (Commands v3, Lesson 5.12)",{"title":1032,"description":1119},"zGPFCV5H2thXENQWqVAHpInN3a-xvDfYT_DScuXOTbI",1792718166815]