Skip to content

Instantly share code, notes, and snippets.

@Iboatwright
Last active December 20, 2017 20:01
Show Gist options
  • Select an option

  • Save Iboatwright/7235b6bd467ce83d08d339b5f1586f06 to your computer and use it in GitHub Desktop.

Select an option

Save Iboatwright/7235b6bd467ce83d08d339b5f1586f06 to your computer and use it in GitHub Desktop.

Revisions

  1. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -57,8 +57,8 @@ _Ordered by date introduced_
    ## Lab6 (multipart)
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__
    <p>
    <em><bold>What does Lab6 do?</bold></em>

    <code>main();</code>
    <ol><li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <li>createscreates a thread from a new object -> for each class;</li>
    @@ -86,7 +86,7 @@ __*What does Lab6 do?*__
    "It's possible this will be extended to a different more complicated molecule"<br />
    "Also could decompose a molecule into parts"<br />
    </blockquote>
    </p>


    ## Best Guess Questions
    item) topic -> concept
  2. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -86,7 +86,7 @@ __*What does Lab6 do?*__
    "It's possible this will be extended to a different more complicated molecule"<br />
    "Also could decompose a molecule into parts"<br />
    </blockquote>
    </p>
    </p>

    ## Best Guess Questions
    item) topic -> concept
  3. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -58,6 +58,7 @@ _Ordered by date introduced_
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__
    <p>
    <code>main();</code>
    <ol><li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <li>createscreates a thread from a new object -> for each class;</li>
    @@ -85,6 +86,7 @@ __*What does Lab6 do?*__
    "It's possible this will be extended to a different more complicated molecule"<br />
    "Also could decompose a molecule into parts"<br />
    </blockquote>
    </p>

    ## Best Guess Questions
    item) topic -> concept
  4. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ _Ordered by date introduced_
    ## Lab6 (multipart)
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__<br />
    __*What does Lab6 do?*__
    <code>main();</code>
    <ol><li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <li>createscreates a thread from a new object -> for each class;</li>
  5. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -59,12 +59,11 @@ _Ordered by date introduced_

    __*What does Lab6 do?*__<br />
    <code>main();</code>
    <ol>
    <li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <ol><li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <li>createscreates a thread from a new object -> for each class;</li>
    <li>calls the Thread.start() method on each thread object;</li>
    </ol>
    `bufferClass();`<br />
    <code>bufferClass();<code><br />
    <ol><li>creates counter variables to track what actions each method can perform</li>
    <li>responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
    <ul>
  6. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -58,7 +58,7 @@ _Ordered by date introduced_
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__<br />
    `main();`<br />
    <code>main();</code>
    <ol>
    <li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <li>createscreates a thread from a new object -> for each class;</li>
  7. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -58,13 +58,13 @@ _Ordered by date introduced_
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__<br />
    `main();`<br />
    <ol>
    main();<br />
    <li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <li>createscreates a thread from a new object -> for each class;</li>
    <li>calls the Thread.start() method on each thread object;</li>
    </ol>
    bufferClass();<br />
    `bufferClass();`<br />
    <ol><li>creates counter variables to track what actions each method can perform</li>
    <li>responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
    <ul>
  8. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -58,8 +58,8 @@ _Ordered by date introduced_
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__<br />
    main();<br />
    <ol>
    main();<br />
    <li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <li>createscreates a thread from a new object -> for each class;</li>
    <li>calls the Thread.start() method on each thread object;</li>
  9. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -82,9 +82,10 @@ bufferClass();<br />
    <li>on completion of the loop the run terminates and the thread ends.</li>
    </ul></li>
    </ol>
    > "It's possible this will be extended to a different more complicated molecule"
    > "Also could decompose a molecule into parts"
    <blockquote>
    "It's possible this will be extended to a different more complicated molecule"<br />
    "Also could decompose a molecule into parts"<br />
    </blockquote>

    ## Best Guess Questions
    item) topic -> concept
  10. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -82,8 +82,8 @@ bufferClass();<br />
    <li>on completion of the loop the run terminates and the thread ends.</li>
    </ul></li>
    </ol>
    >"It's possible this will be extended to a different more complicated molecule"
    >"Also could decompose a molecule into parts"
    > "It's possible this will be extended to a different more complicated molecule"
    > "Also could decompose a molecule into parts"

    ## Best Guess Questions
  11. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -82,8 +82,8 @@ bufferClass();<br />
    <li>on completion of the loop the run terminates and the thread ends.</li>
    </ul></li>
    </ol>
    <--[0] "It's possible this will be extended to a different more complicated molecule" -->
    <--[1] "Also could decompose a molecule into parts" -->
    >"It's possible this will be extended to a different more complicated molecule"
    >"Also could decompose a molecule into parts"

    ## Best Guess Questions
  12. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -57,14 +57,14 @@ _Ordered by date introduced_
    ## Lab6 (multipart)
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__  
    *main();*
    1. creates an object that acts like the buffer area; This object has the
    synchronized methods, thus is the synchronized object.
    2. creates a thread from a new object -> for each class;
    3. calls the Thread.start() method on each thread object;
    bufferClass();
    __*What does Lab6 do?*__<br />
    main();<br />
    <ol>
    <li>creates an object that acts like the buffer area; This object has the synchronized methods, thus is the synchronized object.</li>
    <li>createscreates a thread from a new object -> for each class;</li>
    <li>calls the Thread.start() method on each thread object;</li>
    </ol>
    bufferClass();<br />
    <ol><li>creates counter variables to track what actions each method can perform</li>
    <li>responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
    <ul>
  13. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -57,8 +57,8 @@ _Ordered by date introduced_
    ## Lab6 (multipart)
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__
    __main();__
    __*What does Lab6 do?*__  
    *main();*
    1. creates an object that acts like the buffer area; This object has the
    synchronized methods, thus is the synchronized object.
    2. creates a thread from a new object -> for each class;
  14. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -58,7 +58,7 @@ _Ordered by date introduced_
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    __*What does Lab6 do?*__
    main();
    __main();__
    1. creates an object that acts like the buffer area; This object has the
    synchronized methods, thus is the synchronized object.
    2. creates a thread from a new object -> for each class;
  15. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 17 additions and 13 deletions.
    30 changes: 17 additions & 13 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -65,19 +65,23 @@ main();
    3. calls the Thread.start() method on each thread object;

    bufferClass();
    1. creates counter variables to track what actions each method can perform
    2. responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
    <ul> <li>each method triggers wait() on the calling thread based on condition of counters;</li>
    <li> when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;</li></ul>
    3. each thread from main() is created from a seperate class (not always the case, but is so here);
    * each class implements Runnable;
    * each class has a class variable to reference the synchronized buffer object;
    * each class has a single method Override from Runnable -> run();
    * run() loops a set number of times (class dependant);
     * each iteration wraps a try-catch around actions;
    * first action invokes the buffer.method() passing the current iteration (i);
    * next action sleeps this Thread for a set duration to coordinate frequency this object interacts with the buffer. (3 frequency sets: initial slow, rapid, stablized);
     * on completion of the loop the run terminates and the thread ends.
    <ol><li>creates counter variables to track what actions each method can perform</li>
    <li>responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
    <ul>
    <li>each method triggers wait() on the calling thread based on condition of counters;</li>
    <li> when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;</li>
    </ul></li>
    <li>each thread from main() is created from a seperate class (not always the case, but is so here);
    <ul><li>each class implements Runnable;</li>
    <li>each class has a class variable to reference the synchronized buffer object;</li>
    <li>each class has a single method Override from Runnable -> run();</li>
    <li>run() loops a set number of times (class dependant);</li>
    <li>each iteration wraps a try-catch around actions;</li>
    <li>first action invokes the buffer.method() passing the current iteration (i);</li>
    <li>next action sleeps this Thread for a set duration to coordinate frequency this object interacts with the buffer. (3 frequency sets: initial slow, rapid, stablized);</li>
    <li>on completion of the loop the run terminates and the thread ends.</li>
    </ul></li>
    </ol>
    <--[0] "It's possible this will be extended to a different more complicated molecule" -->
    <--[1] "Also could decompose a molecule into parts" -->

  16. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -67,8 +67,8 @@ main();
    bufferClass();
    1. creates counter variables to track what actions each method can perform
    2. responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
    <ul> each method triggers wait() on the calling thread based on condition of counters;</ul>
    <ul> when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;</ul>
    <ul> <li>each method triggers wait() on the calling thread based on condition of counters;</li>
    <li> when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;</li></ul>
    3. each thread from main() is created from a seperate class (not always the case, but is so here);
    * each class implements Runnable;
    * each class has a class variable to reference the synchronized buffer object;
  17. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -67,8 +67,8 @@ main();
    bufferClass();
    1. creates counter variables to track what actions each method can perform
    2. responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
    ** each method triggers wait() on the calling thread based on condition of counters;
    ** when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;
    <ul> each method triggers wait() on the calling thread based on condition of counters;</ul>
    <ul> when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;</ul>
    3. each thread from main() is created from a seperate class (not always the case, but is so here);
    * each class implements Runnable;
    * each class has a class variable to reference the synchronized buffer object;
  18. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -67,8 +67,8 @@ main();
    bufferClass();
    1. creates counter variables to track what actions each method can perform
    2. responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
    * each method triggers wait() on the calling thread based on condition of counters;
    * when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;
    ** each method triggers wait() on the calling thread based on condition of counters;
    ** when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;
    3. each thread from main() is created from a seperate class (not always the case, but is so here);
    * each class implements Runnable;
    * each class has a class variable to reference the synchronized buffer object;
  19. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -67,17 +67,17 @@ main();
    bufferClass();
    1. creates counter variables to track what actions each method can perform
    2. responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
     1. each method triggers wait() on the calling thread based on condition of counters;
     2. when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;
    * each method triggers wait() on the calling thread based on condition of counters;
    * when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;
    3. each thread from main() is created from a seperate class (not always the case, but is so here);
    1. each class implements Runnable;
    2. each class has a class variable to reference the synchronized buffer object;
    3. each class has a single method Override from Runnable -> run();
    4. run() loops a set number of times (class dependant);
     5. each iteration wraps a try-catch around actions;
    6. first action invokes the buffer.method() passing the current iteration (i);
    7. next action sleeps this Thread for a set duration to coordinate frequency this object interacts with the buffer. (3 frequency sets: initial slow, rapid, stablized);
     8. on completion of the loop the run terminates and the thread ends.
    * each class implements Runnable;
    * each class has a class variable to reference the synchronized buffer object;
    * each class has a single method Override from Runnable -> run();
    * run() loops a set number of times (class dependant);
     * each iteration wraps a try-catch around actions;
    * first action invokes the buffer.method() passing the current iteration (i);
    * next action sleeps this Thread for a set duration to coordinate frequency this object interacts with the buffer. (3 frequency sets: initial slow, rapid, stablized);
     * on completion of the loop the run terminates and the thread ends.
    <--[0] "It's possible this will be extended to a different more complicated molecule" -->
    <--[1] "Also could decompose a molecule into parts" -->

  20. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -70,14 +70,14 @@ bufferClass();
     1. each method triggers wait() on the calling thread based on condition of counters;
     2. when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;
    3. each thread from main() is created from a seperate class (not always the case, but is so here);
     1. each class implements Runnable;
     2. each class has a class variable to reference the synchronized buffer object;
     3. each class has a single method Override from Runnable -> run();
     4. run() loops a set number of times (class dependant);
     5. each iteration wraps a try-catch around actions;
     6. first action invokes the buffer.method() passing the current iteration (i);
     7. next action sleeps this Thread for a set duration to coordinate frequency this object interacts with the buffer. (3 frequency sets: initial slow, rapid, stablized);
     8. on completion of the loop the run terminates and the thread ends.
    1. each class implements Runnable;
    2. each class has a class variable to reference the synchronized buffer object;
    3. each class has a single method Override from Runnable -> run();
    4. run() loops a set number of times (class dependant);
     5. each iteration wraps a try-catch around actions;
    6. first action invokes the buffer.method() passing the current iteration (i);
    7. next action sleeps this Thread for a set duration to coordinate frequency this object interacts with the buffer. (3 frequency sets: initial slow, rapid, stablized);
     8. on completion of the loop the run terminates and the thread ends.
    <--[0] "It's possible this will be extended to a different more complicated molecule" -->
    <--[1] "Also could decompose a molecule into parts" -->

  21. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 5 additions and 12 deletions.
    17 changes: 5 additions & 12 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -66,24 +66,17 @@ main();

    bufferClass();
    1. creates counter variables to track what actions each method can perform
    2. responds to the synchronized methods; each method must have synchronized before the
    return type; potential exception (throws InterruptedException);
    1. each method triggers wait() on the calling thread based on condition of     counters;
    2. when the condition is met and a thread returns from waiting, the counter(s)
    are altered, output is printed, and notifyAll() is called to bring the other
    threads out of the wait area and to test their conditions. this thread
    continues to execute the code immediately following the buffer.method call;
    3. each thread from main() is created from a seperate class (not always the case,
    but is so here);
    2. responds to the synchronized methods; each method must have synchronized before the return type; potential exception (throws InterruptedException);
     1. each method triggers wait() on the calling thread based on condition of counters;
     2. when the condition is met and a thread returns from waiting, the counter(s) are altered, output is printed, and notifyAll() is called to bring the other threads out of the wait area and to test their conditions. this thread continues to execute the code immediately following the buffer.method call;
    3. each thread from main() is created from a seperate class (not always the case, but is so here);
     1. each class implements Runnable;
     2. each class has a class variable to reference the synchronized buffer object;
     3. each class has a single method Override from Runnable -> run();
     4. run() loops a set number of times (class dependant);
     5. each iteration wraps a try-catch around actions;
     6. first action invokes the buffer.method() passing the current iteration (i);
     7. next action sleeps this Thread for a set duration to coordinate frequency
    this object interacts with the buffer. (3 frequency sets: initial slow,
    rapid, stablized);
     7. next action sleeps this Thread for a set duration to coordinate frequency this object interacts with the buffer. (3 frequency sets: initial slow, rapid, stablized);
     8. on completion of the loop the run terminates and the thread ends.
    <--[0] "It's possible this will be extended to a different more complicated molecule" -->
    <--[1] "Also could decompose a molecule into parts" -->
  22. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 21 additions and 22 deletions.
    43 changes: 21 additions & 22 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -55,38 +55,36 @@ _Ordered by date introduced_


    ## Lab6 (multipart)
    ### Reactor-> uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    <<probably something to do with the thread call by OS is non-deterministic>>
    ### Reactor uses threads to combine Hydrogen and Oxygen atoms to form water molecules.

    <What does Lab6 do?>
    main();
    a) creates an object that acts like the buffer area; This object has the
    __*What does Lab6 do?*__
    main();
    1. creates an object that acts like the buffer area; This object has the
    synchronized methods, thus is the synchronized object.
    b) creates a thread from a new object -> for each class;
    c) calls the Thread.start() method on each thread object;
    2. creates a thread from a new object -> for each class;
    3. calls the Thread.start() method on each thread object;

    bufferClass();
    a) creates counter variables to track what actions each method can perform
    b) responds to the synchronized methods; each method must have synchronized before the
    bufferClass();
    1. creates counter variables to track what actions each method can perform
    2. responds to the synchronized methods; each method must have synchronized before the
    return type; potential exception (throws InterruptedException);
    i) each method triggers wait() on the calling thread based on condition of counters;
    ii) when the condition is met and a thread returns from waiting, the counter(s)
    1. each method triggers wait() on the calling thread based on condition of     counters;
    2. when the condition is met and a thread returns from waiting, the counter(s)
    are altered, output is printed, and notifyAll() is called to bring the other
    threads out of the wait area and to test their conditions. this thread
    continues to execute the code immediately following the buffer.method call;
    c) each thread from main() is created from a seperate class (not always the case,
    3. each thread from main() is created from a seperate class (not always the case,
    but is so here);
    i) each class implements Runnable;
    ii) each class has a class variable to reference the synchronized buffer object;
    iii) each class has a single method Override from Runnable -> run();
    iv) run() loops a set number of times (class dependant);
    v) each iteration wraps a try-catch around actions;
    vi) first action invokes the buffer.method() passing the current iteration (i);
    vii) next action sleeps this Thread for a set duration to coordinate frequency
     1. each class implements Runnable;
     2. each class has a class variable to reference the synchronized buffer object;
     3. each class has a single method Override from Runnable -> run();
     4. run() loops a set number of times (class dependant);
     5. each iteration wraps a try-catch around actions;
     6. first action invokes the buffer.method() passing the current iteration (i);
     7. next action sleeps this Thread for a set duration to coordinate frequency
    this object interacts with the buffer. (3 frequency sets: initial slow,
    rapid, stablized);
    viii) on completion of the loop the run terminates and the thread ends.
     8. on completion of the loop the run terminates and the thread ends.
    <--[0] "It's possible this will be extended to a different more complicated molecule" -->
    <--[1] "Also could decompose a molecule into parts" -->

    @@ -107,6 +105,7 @@ Arrays.sort(times, (t1,t2)->(t1[0]!=t2[0])?(t1[0]-t2[0]):(t1[1]-t2[1]));
    * Q4 - find and fix errors) He'll probably give a concurrent code example with issues such as
    * missing synchronized label in method declaration
    * using `Thread.sleep(x)` instead of `wait();`
     * something to do with thread calls by OS are non-deterministic

    ## Code samples
    ### TimeComparator
  23. Iboatwright revised this gist Dec 20, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -99,12 +99,14 @@ item) topic -> concept
    JButton button = new JButton("My Button");
    button.addActionListener(e->JOptionPane.showMessageDialog(null, e.getActionCommand()));
    ```
    * Sort a list of 2 int arrays each of which represents {minute, second}
    * Sort a list of 2 int arrays each of which represents {minute, second}
    ```java
    int [][] times = new int[][]{{45, 23},{12, 25},{59, 59},{2, 12}};
    Arrays.sort(times, (t1,t2)->(t1[0]!=t2[0])?(t1[0]-t2[0]):(t1[1]-t2[1]));
    ```

    * Q4 - find and fix errors) He'll probably give a concurrent code example with issues such as
    * missing synchronized label in method declaration
    * using `Thread.sleep(x)` instead of `wait();`

    ## Code samples
    ### TimeComparator
  24. Iboatwright revised this gist Dec 19, 2017. No changes.
  25. Iboatwright revised this gist Dec 19, 2017. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -90,6 +90,22 @@ _Ordered by date introduced_
    <--[0] "It's possible this will be extended to a different more complicated molecule" -->
    <--[1] "Also could decompose a molecule into parts" -->


    ## Best Guess Questions
    item) topic -> concept
    * Q1) either
    * Add to a JButton an ActionListener which pops a JOptionPane that displays the button’s text.
    ```java
    JButton button = new JButton("My Button");
    button.addActionListener(e->JOptionPane.showMessageDialog(null, e.getActionCommand()));
    ```
    * Sort a list of 2 int arrays each of which represents {minute, second}
    ```java
    int [][] times = new int[][]{{45, 23},{12, 25},{59, 59},{2, 12}};
    Arrays.sort(times, (t1,t2)->(t1[0]!=t2[0])?(t1[0]-t2[0]):(t1[1]-t2[1]));
    ```


    ## Code samples
    ### TimeComparator
    ```java
  26. Iboatwright revised this gist Dec 19, 2017. 1 changed file with 40 additions and 7 deletions.
    47 changes: 40 additions & 7 deletions midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    # COP3003 Exam 3 Study Note
    ## Topics covered
    _Ordered by date introduced_
    3. chapter 20: Generic Classes and Methods
    * There is nothing in the study guide directly on generics
    * Likely it will be a part of something else, but not the focus
    1. chapter 16: Collections (Interface Collections, Class Collections)
    * Lists - Ordered by insertion, duplicates allowed
    * Sets - not ordered, only uniques
    @@ -10,11 +14,12 @@
    * see [TimeComparator](#timecomparator) below
    * Class Arrays
    * PriorityQueue
    2. chapter 17:
    *
    3. chapter 20:
    *
    4. chapter 23:
    2. chapter 17: Lambdas and Streams
    * Single Abstract Method Interfaces and Lambda Expressions
    * Streams
    * Lazy evaluation vs Eager evaluation
    * lazy are stateless operations. see [LazyEvalExample](#lazyevalexample)
    4. chapter 23: Concurrency
    *

    ## Types of Questions
    @@ -63,7 +68,7 @@

    bufferClass();
    a) creates counter variables to track what actions each method can perform
    b) has the synchronized methods; each method must have synchronized before the
    b) responds to the synchronized methods; each method must have synchronized before the
    return type; potential exception (throws InterruptedException);
    i) each method triggers wait() on the calling thread based on condition of counters;
    ii) when the condition is met and a thread returns from waiting, the counter(s)
    @@ -86,4 +91,32 @@
    <--[1] "Also could decompose a molecule into parts" -->

    ## Code samples
    ### TimeComparator
    ### TimeComparator
    ```java
    class TimeComparator implements Comparator<Time>{
    public int compare(Time time1, Time time2){
    int hourCompare=time1.getHour()-time2.getHour();
    (hourCompare!=0) ? (return hourCompare);

    int minuteCompare=time1.getMinute()-time2.getMinute();
    (minuteCompare!=0) ? (return minuteCompare);

    int secondCompare=time1.getSecond()-time2.getSecond();
    return secondCompare;
    }
    }
    ```

    ### LazyEvalExample
    ```java
    while(input.hasNextLine()){

    // This is a lazy evaluation. It doesn't do anything to the stream yet.
    Stream<String> processNext = Arrays.stream(input.nextLine()
    .split("\\W+")
    .filter(t->!t.equals(""))
    .map(String::toLowerCase);

    // This is a terminal operation. Most terminal ops are eager (excluding .iterate())
    mySet.addAll(processNest.collect(Collectors.toList()));
    ```
  27. Iboatwright revised this gist Dec 19, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    * Collection Algorithms
    * **NOTE** `Collections.sort` only works on lists
    * reference HW4 for an example of `interface Comparable` and `compareTo`
    * see [TimeComparator](#TimeComparator) below
    * see [TimeComparator](#timecomparator) below
    * Class Arrays
    * PriorityQueue
    2. chapter 17:
  28. Iboatwright revised this gist Dec 19, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    * Collection Algorithms
    * **NOTE** `Collections.sort` only works on lists
    * reference HW4 for an example of `interface Comparable` and `compareTo`
    * see [TimeComparator](##TimeComparator) below
    * see [TimeComparator](#TimeComparator) below
    * Class Arrays
    * PriorityQueue
    2. chapter 17:
  29. Iboatwright revised this gist Dec 19, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    * Collection Algorithms
    * **NOTE** `Collections.sort` only works on lists
    * reference HW4 for an example of `interface Comparable` and `compareTo`
    * see [##TimeComparator] below
    * see [TimeComparator](##TimeComparator) below
    * Class Arrays
    * PriorityQueue
    2. chapter 17:
  30. Iboatwright revised this gist Dec 19, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion midterm_3_prep.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    * Collection Algorithms
    * **NOTE** `Collections.sort` only works on lists
    * reference HW4 for an example of `interface Comparable` and `compareTo`
    * see [TimeComparator] below
    * see [##TimeComparator] below
    * Class Arrays
    * PriorityQueue
    2. chapter 17: