<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://classes.engineering.wustl.edu/cse231/core/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Finn</id>
	<title>CSE231 Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://classes.engineering.wustl.edu/cse231/core/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Finn"/>
	<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Special:Contributions/Finn"/>
	<updated>2026-11-26T21:08:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.4</generator>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Office_hours&amp;diff=1281</id>
		<title>Office hours</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Office_hours&amp;diff=1281"/>
		<updated>2018-02-02T21:03:07Z</updated>

		<summary type="html">&lt;p&gt;Finn: Monday TA hours go until 5:30&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you arrive at office hours but do not find a TA, come to Prof. Cosgrove's office Jolley 412.&lt;br /&gt;
&lt;br /&gt;
If the door is locked you can either come to Prof. Cosgrove's office or see Cheryl Newman in the CS main office: Jolley 304.&lt;br /&gt;
&lt;br /&gt;
==Monday==&lt;br /&gt;
* 1-2pm Jolley 408&lt;br /&gt;
* 4-5:30pm Jolley 408&lt;br /&gt;
&lt;br /&gt;
==Tuesday==&lt;br /&gt;
* 4-5pm Jolley 408&lt;br /&gt;
&lt;br /&gt;
==Wednesday==&lt;br /&gt;
* 11:30am-2pm Jolley 408&lt;br /&gt;
* 5-6pm Jolley 408&lt;br /&gt;
&lt;br /&gt;
==Thursday==&lt;br /&gt;
* 10-11:30am Jolley 408&lt;br /&gt;
* 6-7pm Jolley 408&lt;br /&gt;
&lt;br /&gt;
==Friday==&lt;br /&gt;
* 1-5pm in Urbauer 222&lt;br /&gt;
&lt;br /&gt;
==Saturday==&lt;br /&gt;
* 12noon-1pm in Jolley 408&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Raytrace_Scheduler&amp;diff=697</id>
		<title>Raytrace Scheduler</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Raytrace_Scheduler&amp;diff=697"/>
		<updated>2017-12-04T20:08:01Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Where to Start=&lt;br /&gt;
==Demo==&lt;br /&gt;
SplitFourWayRayTracer&lt;br /&gt;
==Fun==&lt;br /&gt;
===DivideAndConquerRayTracer===&lt;br /&gt;
Recursively divide the given region into 4 tasks for each of the four quadrants until you get below the threshold.&lt;br /&gt;
When you get below the threshold, call the &amp;lt;code&amp;gt;renderSection&amp;lt;/code&amp;gt; method to render the section.&lt;br /&gt;
===WorkStealingRayTracer===&lt;br /&gt;
The &amp;lt;code&amp;gt;renderMyTasksUntilEmptyThenStealWorkFromOthers&amp;lt;/code&amp;gt; method will be called on one of the four quadrants, but it will be given the sections that make up all four quadrants. You can use the &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; to find the particular quadrant being called.&lt;br /&gt;
&lt;br /&gt;
This method should repeatedly draw from the tail of its own double-ended queue to render its own tasks using the &amp;lt;code&amp;gt;Section.render&amp;lt;/code&amp;gt; method. If it finishes all of its tasks, and there are still unfinished tasks in the other quadrants, then it should draw tasks from the head of the other quadrants' deques.&lt;br /&gt;
&lt;br /&gt;
As you can see in the &amp;lt;code&amp;gt;WorkStealingRayTracer.rayTrace&amp;lt;/code&amp;gt; method, the parallelism comes from the fact that the &amp;lt;code&amp;gt;renderMyTasksUntilEmptyThenStealWorkFromOthers&amp;lt;/code&amp;gt; method is called multiple times in parallel. You don't have to worry about spawning new tasks. Also, because ConcurrentLinkedDeque is thread-safe, all operations are atomic, so you you shouldn't need to use isolated. However, you should avoid reading and then writing.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Raytrace_Scheduler&amp;diff=696</id>
		<title>Raytrace Scheduler</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Raytrace_Scheduler&amp;diff=696"/>
		<updated>2017-12-04T19:43:53Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Where to Start=&lt;br /&gt;
==Demo==&lt;br /&gt;
SplitFourWayRayTracer&lt;br /&gt;
==Fun==&lt;br /&gt;
===DivideAndConquerRayTracer===&lt;br /&gt;
Recursively divide the given region into 4 tasks for each of the four quadrants until you get below the threshold.&lt;br /&gt;
When you get below the threshold, call the &amp;lt;code&amp;gt;renderSection&amp;lt;/code&amp;gt; method to render the section.&lt;br /&gt;
===WorkStealingRayTracer===&lt;br /&gt;
The &amp;lt;code&amp;gt;renderMyTasksUntilEmptyThenStealWorkFromOthers&amp;lt;/code&amp;gt; method will be called on one of the four quadrants, but it will be given the sections that make up all four quadrants. You can use the &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; to find the particular quadrant being called.&lt;br /&gt;
&lt;br /&gt;
This method should repeatedly draw from the tail of its own double-ended queue to render its own tasks using the &amp;lt;code&amp;gt;Section.render&amp;lt;/code&amp;gt; method. If it finishes all of its tasks, and there are still unfinished tasks in the other quadrants, then it should draw tasks from the head of the other quadrants' deques.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=AllOrNothingLocks&amp;diff=659</id>
		<title>AllOrNothingLocks</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=AllOrNothingLocks&amp;diff=659"/>
		<updated>2017-11-27T21:04:57Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background=&lt;br /&gt;
Check out the [[Lock_Ordering#Background]] studio.&lt;br /&gt;
&lt;br /&gt;
In Java, locks are a synchronization tool that exists to ensure whatever is protected by the lock is only accessed one thread at a time, as to avoid a possible data race. In this studio we will explore the second type of locks: explicitly created &amp;lt;code&amp;gt;Lock&amp;lt;/code&amp;gt; objects from the &amp;lt;code&amp;gt;java.util.concurrent.locks&amp;lt;/code&amp;gt; package.&lt;br /&gt;
&lt;br /&gt;
Every object has an intrinsic lock associated with the object, but &amp;lt;code&amp;gt;Lock&amp;lt;/code&amp;gt; objects are explicitly defined and instantiated locks which can be called to lock or unlock. Lock objects are acted upon just like any other object, but we are mostly interested in the &amp;lt;code&amp;gt;lock()&amp;lt;/code&amp;gt; method, the &amp;lt;code&amp;gt;tryLock()&amp;lt;/code&amp;gt; method, and the &amp;lt;code&amp;gt;unlock()&amp;lt;/code&amp;gt; method. For this studio, we will specifically use the &amp;lt;code&amp;gt;ReentrantLock&amp;lt;/code&amp;gt; object, a class which implements the general &amp;lt;code&amp;gt;Lock&amp;lt;/code&amp;gt; interface.&lt;br /&gt;
&lt;br /&gt;
To demonstrate how to avoid both data races and deadlock issues, we will create a method designed to transfer money between two bank accounts. Two parties should be able to asynchronously and continuously transfer money between each other without a data race (courtesy of locks) or deadlock (something you will address).&lt;br /&gt;
&lt;br /&gt;
For this approach, we will make use of the &amp;lt;code&amp;gt;tryLock()&amp;lt;/code&amp;gt; method in order to attempt to acquire an object’s lock. If the object’s lock is not available at the time, we will continue to try to acquire the lock until it finally succeeds, after which we can successfully transfer funds from one bank account to another. In this approach, an asynchronous pair of transfers from A to B and B to A will not lead to deadlock as the two processes will give up on acquiring the lock until it becomes available, at which point it will finally acquire the lock. This approach does not make use of ordering, but simply relies on making lock attempts give up if the desired lock is not immediately available (and then try again later).&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
Refer to Oracle's official documentation for more information:&lt;br /&gt;
* [https://docs.oracle.com/javase/tutorial/essential/concurrency/newlocks.html Lock Objects Tutorial] &lt;br /&gt;
* [https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/package-summary.html package java.util.concurrent.locks]&lt;br /&gt;
* [https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/ReentrantLock.html ReentrantLock]&lt;br /&gt;
&lt;br /&gt;
=Where to Start=&lt;br /&gt;
Navigate to the &amp;lt;code&amp;gt;src/main/java&amp;lt;/code&amp;gt; directory to get started.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;locking.core&amp;lt;/code&amp;gt; package we used previously in the in [[Lock_Ordering]] studio is composed of utility and building block classes we created for you. Review these classes to get a better understanding of how to use them for the first part of this studio.&lt;br /&gt;
 &lt;br /&gt;
The classes you will need to modify can be found under the &amp;lt;code&amp;gt;locking.allornothing.studio&amp;lt;/code&amp;gt; package. &lt;br /&gt;
&lt;br /&gt;
==Try Locking==&lt;br /&gt;
&lt;br /&gt;
As mentioned in the background section, this implementation will avoid deadlock by giving up on acquiring a lock if it is not immediately available before coming back to it later (when it might actually be available). This implementation will need to make use of the ReentrantLocks associated with the sender and recipient bank account objects. More specifically, it will have to make use of the &amp;lt;code&amp;gt;tryLock()&amp;lt;/code&amp;gt; method. For an example of how to format a tryLock, look below:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Lock lock = ...&lt;br /&gt;
if (lock.tryLock()) {&lt;br /&gt;
	try {&lt;br /&gt;
		doSomething();&lt;br /&gt;
	} finally {&lt;br /&gt;
		lock.unlock();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===BankAccountTryLocking===&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;BankAccountTryLocking.java&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A couple of notes and common issues:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;tryLock()&amp;lt;/code&amp;gt; will immediately give up and return false if the lock is not available when it is called. Thus, you will need to construct a loop that will continuously run until the desired lock is available. You can exit out of this loop in two ways: with the break keyword or by returning a valid value for the method.&lt;br /&gt;
*&amp;lt;code&amp;gt;tryLock()&amp;lt;/code&amp;gt; will grab the lock if it can. There's no need to call &amp;lt;code&amp;gt;lock()&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;tryLock()&amp;lt;/code&amp;gt;.&lt;br /&gt;
*We recommend you call the &amp;lt;code&amp;gt;AccountUtils.checkBalanceAndTransfer(sender, receiver, amount)&amp;lt;/code&amp;gt; method for the sake of simplicity. This method will check that the sender and recipient are not the same people and that the sender has enough money in her account to send the specified amount to the recipient.&lt;br /&gt;
*Anytime you lock a lock object, you should/must use a &amp;lt;code&amp;gt;try/finally&amp;lt;/code&amp;gt; block to unlock the lock.&lt;br /&gt;
*Your implementation will have to make use of a nested &amp;lt;code&amp;gt;try/finally&amp;lt;/code&amp;gt; block (one &amp;lt;code&amp;gt;try/finally&amp;lt;/code&amp;gt; call within another).&lt;br /&gt;
&lt;br /&gt;
Useful documentation:&lt;br /&gt;
*[https://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html while loops]&lt;br /&gt;
*[https://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html finally]&lt;br /&gt;
*[https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#yield-- Thread yield]&lt;br /&gt;
&lt;br /&gt;
===LockUtils runWithAllLocksOrDontRunAtAll===&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;LockUtils.java&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For this part of the studio you will need to implement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;public static boolean tryLockAll(List&amp;lt;ReentrantLock&amp;gt; locks)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;public static void unlockAllHeldLocks(List&amp;lt;ReentrantLock&amp;gt; locks)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
so that the useful utility (shouldn't they all be useful?) &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;public static boolean runWithAllLocksOrDontRunAtAll(List&amp;lt;ReentrantLock&amp;gt; locks, Runnable body) {&lt;br /&gt;
	boolean hasAllLocks = tryLockAll(locks);&lt;br /&gt;
	if (hasAllLocks) {&lt;br /&gt;
		try {&lt;br /&gt;
			body.run();&lt;br /&gt;
		} finally {&lt;br /&gt;
			unlockAllHeldLocks(locks);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	return hasAllLocks;&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
produces correct thread safe behavior.&lt;br /&gt;
&lt;br /&gt;
Note: in &amp;lt;code&amp;gt;tryLockAll&amp;lt;/code&amp;gt;, you will need to call &amp;lt;code&amp;gt;tryLock&amp;lt;/code&amp;gt; on all of the given locks. However, if one fails, you will need to unlock everything you have currently locked. A lock cannot be unlocked from a thread that doesn't hold the lock. Consider using the [https://docs.oracle.com/javase/8/docs/api/java/util/ListIterator.html ListIterator] interface.&lt;br /&gt;
&lt;br /&gt;
some useful documentation:&lt;br /&gt;
&lt;br /&gt;
* [https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html#tryLock-- Lock tryLock]&lt;br /&gt;
&lt;br /&gt;
* [https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html#unlock--- Lock unlock]&lt;br /&gt;
&lt;br /&gt;
* [https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/ReentrantLock.html#isHeldByCurrentThread--- ReentrantLock isHeldByCurrentThread ]&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=N-Queens/Sudoku_Assignment&amp;diff=596</id>
		<title>N-Queens/Sudoku Assignment</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=N-Queens/Sudoku_Assignment&amp;diff=596"/>
		<updated>2017-10-30T19:05:16Z</updated>

		<summary type="html">&lt;p&gt;Finn: Improved wording and updated changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background=&lt;br /&gt;
&lt;br /&gt;
The n-queens problem is a fundamental coding puzzle which asks: how can N queens be placed on an NxN chessboard so that they cannot attack each other? In chess, a queen can move horizontally, vertically, and diagonally across the board. Thus, to solve the n-queens problem, we must effectively figure out how to place the queens in such a way that no two of them occupy the same row, column, or diagonal.&lt;br /&gt;
&lt;br /&gt;
We will be using a similar algorithm to solve a Sudoku puzzle. A Sudoku puzzle is composed of a 9-by-9 grid of squares. This grid is also divided into 9 large boxes, each of which is a 3-by-3 of the smaller squares. In a completed puzzle, each of the smaller squares contains a single number from 1 to 9 (inclusive). However, if a square contains a given number, that same number cannot be anywhere else in the same row, column, or box. Thus, for Sudoku, we are given an incomplete board and must fill in the remaining squares while meeting these requirements. For more explanation, take a look at [http://norvig.com/sudoku.html Peter Norvig's essay about solving Sudoku].&lt;br /&gt;
&lt;br /&gt;
In this assignment, you will implement solutions to both the n-queens and Sudoku problems.&lt;br /&gt;
&lt;br /&gt;
=Where to Start=&lt;br /&gt;
&lt;br /&gt;
All of the classes you will need to implement can be found under &amp;lt;code&amp;gt;nqueens.assignment&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;sudoku.assignment&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;nqueens.core&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;sudoku.core&amp;lt;/code&amp;gt; packages are utility and building block classes we created for you and the '''viz''' source folder contains visualization apps that might help you understand your code from a visual standpoint. Take a look at these classes to get a better understanding of how to use them for your assignment.&lt;br /&gt;
&lt;br /&gt;
==N-Queens==&lt;br /&gt;
&lt;br /&gt;
There are three classes you will need to modify: &amp;lt;code&amp;gt;DefaultImmutableQueenLocations.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SequentialNQueens.java&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;ParallelNQueens.java&amp;lt;/code&amp;gt;. Start with &amp;lt;code&amp;gt;QueenLocations&amp;lt;/code&amp;gt; and then we recommend moving on to the sequential solution before the parallel one. Take a look at the javadocs to see what everything does and what you will need to implement.&lt;br /&gt;
&lt;br /&gt;
A couple of notes and common issues:&lt;br /&gt;
&lt;br /&gt;
*There is an outdated comment in &amp;lt;code&amp;gt;DefaultImmutableQueenLocations&amp;lt;/code&amp;gt;. There is no &amp;lt;code&amp;gt;NQueensUtils&amp;lt;/code&amp;gt; class; you should look at &amp;lt;code&amp;gt;AbstractQueenLocations&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
*As &amp;lt;code&amp;gt;ImmutableQueenLocations&amp;lt;/code&amp;gt; is immutable, you will need to create a new instance of the object whenever you move on from one row to the next. This is where &amp;lt;code&amp;gt;createNext&amp;lt;/code&amp;gt; comes in, along with the private constructor of this class.&lt;br /&gt;
*The &amp;lt;code&amp;gt;isNextRowThreatFree&amp;lt;/code&amp;gt; method can easily be completed with a method in &amp;lt;code&amp;gt;AbstractQueenLocations&amp;lt;/code&amp;gt;. Refer to that for help.&lt;br /&gt;
*The sequential solution uses &amp;lt;code&amp;gt;MutableQueenLocations&amp;lt;/code&amp;gt; while the parallel solution uses your implementation of &amp;lt;code&amp;gt;ImmutableQueenLocations&amp;lt;/code&amp;gt;. Be careful to use the correct &amp;lt;code&amp;gt;QueenLocations&amp;lt;/code&amp;gt; implementation.&lt;br /&gt;
*As the name suggests, &amp;lt;code&amp;gt;placeQueenInRow&amp;lt;/code&amp;gt; will go through the columns of the given row to check if a queen can fit in that location. If it can, it will set that value in &amp;lt;code&amp;gt;MutableQueenLocations&amp;lt;/code&amp;gt;. If the examined row is that last row of the board, you have found one valid solution to the n-queens problem. Update the correct parameter accordingly. Otherwise, recurse and keep going until you reach the last row.&lt;br /&gt;
*For the parallel implementation of &amp;lt;code&amp;gt;placeQueenInRow&amp;lt;/code&amp;gt;, we are using the &amp;quot;one-finish&amp;quot; pattern. Do not call &amp;lt;code&amp;gt;finish&amp;lt;/code&amp;gt; in the recursive method.&lt;br /&gt;
*The syntax for instantiating a &amp;lt;code&amp;gt;FinishAccumulator&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;Integer&amp;lt;/code&amp;gt; is: &amp;lt;code&amp;gt;FinishAccumulator&amp;lt;Integer&amp;gt; acc = newIntegerFinishAccumulator(NumberReductionOperator.SUM);&amp;lt;/code&amp;gt;&lt;br /&gt;
*The syntax for using a &amp;lt;code&amp;gt;FinishAccumulator&amp;lt;/code&amp;gt; is: &amp;lt;code&amp;gt;finish(register(acc), () -&amp;gt; { //body });&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sudoku==&lt;br /&gt;
&lt;br /&gt;
There are three classes you will need to modify: &amp;lt;code&amp;gt;DefaultImmutableSudokuPuzzle.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SquareSearchAlgorithms.java&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;ParallelSudoku.java&amp;lt;/code&amp;gt; (we would recommend moving through these classes in this order). Take a look at the javadocs to see what everything does and what you will need to implement.&lt;br /&gt;
&lt;br /&gt;
A couple of notes and common issues:&lt;br /&gt;
&lt;br /&gt;
*As the name suggests, &amp;lt;code&amp;gt;ImmutableSudokuPuzzle&amp;lt;/code&amp;gt; is immutable, and you will need to create a new instance of the object whenever you move on from one square to the next. This is analogous to the immutable n-queens board.&lt;br /&gt;
*The &amp;lt;code&amp;gt;getOptions&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;SudokuPuzzle&amp;lt;/code&amp;gt; should find what value the given square could represent by searching the value of its peers (same row, same column, and same box). Starting with &amp;lt;code&amp;gt;ALL_OPTIONS&amp;lt;/code&amp;gt;, the number of options should be removed depending on the peer. If the square is already filled in, it should simply return the correct value.&lt;br /&gt;
*If you have two &amp;lt;code&amp;gt;List&amp;lt;code&amp;gt;s, &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt;, and you set &amp;lt;code&amp;gt;a = b&amp;lt;/code&amp;gt;, then any changes you make to &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; will also be made to &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt;. Both variables reference the same objects; they are not copies.&lt;br /&gt;
*The &amp;lt;code&amp;gt;getValue&amp;lt;/code&amp;gt; method is already done for you, but it might be useful for a later portion of the assignment.&lt;br /&gt;
*Your solvers should be able to handle two different approaches to picking the next square in the puzzle to examine: row major and fewest options first. Row major just means going through the puzzle row by row, while fewest options first means solving the puzzle in the order of which squares has the fewest options.&lt;br /&gt;
**The row major approach is already done for you&lt;br /&gt;
**For fewest options first, go through every square (you can do this by calling &amp;lt;code&amp;gt;Square.values()&amp;lt;/code&amp;gt;) and see how many options are available for each square. Return the square with the minimal number of options. However, check to make sure the puzzle is not already completed or that you are returning already filled squares.&lt;br /&gt;
*Just like n-queens, your &amp;lt;code&amp;gt;solveKernel&amp;lt;/code&amp;gt; is the recursive method that will be called in the solve method. Again, watch where you put your &amp;lt;code&amp;gt;finish&amp;lt;/code&amp;gt;.&lt;br /&gt;
*In your &amp;lt;code&amp;gt;solveKernel&amp;lt;/code&amp;gt; method, you should use your desired search algorithm (row major or fewest options first) to select which square you will fill. After selecting a square, you should recursively call the kernel to check every viable option in the context of the puzzle. If there are no more unfilled squares, you should set the value of the solution to the finished puzzle and exit out of the recursion.&lt;br /&gt;
&lt;br /&gt;
=Rubric=&lt;br /&gt;
&lt;br /&gt;
As always, please make sure to cite your work appropriately.&lt;br /&gt;
&lt;br /&gt;
Total points: 100&lt;br /&gt;
&lt;br /&gt;
N-Queens subtotal: 40&lt;br /&gt;
* Correct ImmutableQueenLocations (10)&lt;br /&gt;
* Correct sequential implementation (10)&lt;br /&gt;
* Correct parallel implementation (20)&lt;br /&gt;
&lt;br /&gt;
Sudoku subtotal: 50&lt;br /&gt;
* Correct ImmutableSudokuPuzzle (10)&lt;br /&gt;
* Correct SquareSearchAlgorithm (15)&lt;br /&gt;
* Correct ParallelSudoku (25)&lt;br /&gt;
&lt;br /&gt;
Whole project:&lt;br /&gt;
* Clarity and efficiency (10)&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=N-Queens/Sudoku_Assignment&amp;diff=595</id>
		<title>N-Queens/Sudoku Assignment</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=N-Queens/Sudoku_Assignment&amp;diff=595"/>
		<updated>2017-10-30T18:37:02Z</updated>

		<summary type="html">&lt;p&gt;Finn: Improved wording and updated changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background=&lt;br /&gt;
&lt;br /&gt;
The n-queens problem is a fundamental coding puzzle which asks: how can N queens be placed on an NxN chessboard so that they cannot attack each other? In chess, a queen can move horizontally, vertically, and diagonally across the board. Thus, to solve the n-queens problem, we must effectively figure out how to place the queens in such a way that no two of them occupy the same row, column, or diagonal.&lt;br /&gt;
&lt;br /&gt;
We will be using a similar algorithm to solve a Sudoku puzzle. A Sudoku puzzle is composed of a 9-by-9 grid of squares. This grid is divided into 9 large boxes, each of which is a 3-by-3 of the smaller squares. In a completed puzzle, each of the smaller squares contains a single number from 1 to 9 (inclusive). However, if a square contains a given number, that same number cannot be anywhere else in the same row, column, or box. Thus, for Sudoku, we are given an incomplete board and must fill in the remaining squares while meeting these requirements. For more explanation, take a look at [http://norvig.com/sudoku.html Peter Norvig's essay about solving Sudoku].&lt;br /&gt;
&lt;br /&gt;
In this assignment, you will implement solutions to both the n-queens and Sudoku problems.&lt;br /&gt;
&lt;br /&gt;
=Where to Start=&lt;br /&gt;
&lt;br /&gt;
All of the classes you will need to implement can be found under &amp;lt;code&amp;gt;nqueens.assignment&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;sudoku.assignment&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;nqueens.core&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;sudoku.core&amp;lt;/code&amp;gt; packages are utility and building block classes we created for you and the '''viz''' source folder contains visualization apps that might help you understand your code from a visual standpoint. Take a look at these classes to get a better understanding of how to use them for your assignment.&lt;br /&gt;
&lt;br /&gt;
==N-Queens==&lt;br /&gt;
&lt;br /&gt;
There are three classes you will need to modify: &amp;lt;code&amp;gt;DefaultImmutableQueenLocations.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SequentialNQueens.java&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;ParallelNQueens.java&amp;lt;/code&amp;gt;. Start with QueenLocations and then we recommend moving on to the sequential solution before the parallel one. Take a look at the javadocs to see what everything does and what you will need to implement.&lt;br /&gt;
&lt;br /&gt;
A couple of notes and common issues:&lt;br /&gt;
&lt;br /&gt;
*As QueenLocations is immutable, you will need to create a new instance of the object whenever you move on from one row to the next. This is where createNext comes in, along with the private constructor of this class.&lt;br /&gt;
*The isNextRowThreatFree method can easily be completed with a method in AbstractQueenLocations. Refer to that for help.&lt;br /&gt;
*The sequential solution uses MutableQueenLocations while the parallel solution uses your implementation of ImmutableQueenLocations. Be careful to use the correct QueenLocations class.&lt;br /&gt;
*As the name suggests, placeQueenInRow will go through the columns of the given row to check if a queen can fit in that location. If it can, it will set that value in QueenLocations. If the examined row is that last row of the board, you have found one valid solution to the n-queens problem! Update the correct parameter accordingly. Otherwise, recurse and keep going until you reach the last row.&lt;br /&gt;
*For the parallel implementation of placeQueenInRow, remember to place the async in an appropriate location. As the method is recursive, you do not want to wrap the async in a finish tightly. Rather, you want to wrap each call to the recursive method in a finish. In other words, the finish should go in the countSolutions method.&lt;br /&gt;
*The syntax for instantiating a FinishAccumulator of Integer is: &amp;lt;code&amp;gt;FinishAccumulator&amp;lt;Integer&amp;gt; acc = newIntegerFinishAccumulator(NumberReductionOperator.SUM);&amp;lt;/code&amp;gt;&lt;br /&gt;
*The syntax for using a FinishAccumulator is: &amp;lt;code&amp;gt;finish(register(acc), () -&amp;gt; { //body });&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sudoku==&lt;br /&gt;
&lt;br /&gt;
There are three classes you will need to modify: &amp;lt;code&amp;gt;DefaultImmutableSudokuPuzzle.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SquareSearchAlgorithms.java&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;ParallelSudoku.java&amp;lt;/code&amp;gt; (we would recommend moving through these classes in this order). Take a look at the javadocs to see what everything does and what you will need to implement.&lt;br /&gt;
&lt;br /&gt;
A couple of notes and common issues:&lt;br /&gt;
&lt;br /&gt;
*As the SudokuPuzzle is immutable, you will need to create a new instance of the object whenever you move on from one square to the next. This is where createNext comes in, along with the private constructor of this class.&lt;br /&gt;
*The getOptions method in SudokuPuzzle should find what value the given square could represent by searching the value of its peers (same row, same column, and same larger square). Starting with ALL_OPTIONS, the number of options should be removed depending on the peer. If the square is already filled in, it should simply return the correct value.&lt;br /&gt;
*The getValue method is already done for you, but it might come in useful for a later portion of the assignment.&lt;br /&gt;
*Your solvers should be able to handle two different approaches to solving the puzzle: row major and fewest options first. Row major just means brute forcing your way through the puzzle row by row, while fewest options first means solving the puzzle in the order of which squares has the fewest options.&lt;br /&gt;
**The row major approach is already done for you&lt;br /&gt;
**For fewest options first, go through every square (you can do this by calling &amp;lt;code&amp;gt;Square.values()&amp;lt;/code&amp;gt;) and see how many options are available for each square. Return the square with the minimal number of options. However, check to make sure the puzzle is not already completed or that you are returning already filled squares.&lt;br /&gt;
*Just like n-queens, your solveKernel is the recursive method that will be called in the solve method. Again, watch where you put your asyncs and finishes.&lt;br /&gt;
*In your solveKernel method, you should use your desired search algorithm (row major or fewest options first) to select which square you will fill. After selecting a square, you should recursively call the kernel to check every viable option in the context of the puzzle. If there are no more unfilled squares, you should set the value of the solution to the finished puzzle and exit out of the recursion.&lt;br /&gt;
&lt;br /&gt;
=Rubric=&lt;br /&gt;
&lt;br /&gt;
As always, please make sure to cite your work appropriately.&lt;br /&gt;
&lt;br /&gt;
Total points: 100&lt;br /&gt;
&lt;br /&gt;
N-Queens subtotal: 40&lt;br /&gt;
* Correct ImmutableQueenLocations (10)&lt;br /&gt;
* Correct sequential implementation (10)&lt;br /&gt;
* Correct parallel implementation (20)&lt;br /&gt;
&lt;br /&gt;
Sudoku subtotal: 50&lt;br /&gt;
* Correct ImmutableSudokuPuzzle (10)&lt;br /&gt;
* Correct SquareSearchAlgorithm (15)&lt;br /&gt;
* Correct ParallelSudoku (25)&lt;br /&gt;
&lt;br /&gt;
Whole project:&lt;br /&gt;
* Clarity and efficiency (10)&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Iterator,_Collection,_and_Map&amp;diff=293</id>
		<title>Iterator, Collection, and Map</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Iterator,_Collection,_and_Map&amp;diff=293"/>
		<updated>2017-09-11T13:23:33Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background=&lt;br /&gt;
&lt;br /&gt;
In the following assignment, you will use your knowledge of Java to create your own implementation of a '''SinglyLinkedList''' and an '''ArrayOfBucketsHashMap'''.  As a warm up exercise for the '''ArrayOfBucketsHashMap''' you are encouraged to build a '''LoneListMap'''. If you are not sure what a list or a map is, please refer to the relevant documentation to familiarize yourself with these data structures. As a good visualization, check out VisuAlgo's interactive demo for a [https://visualgo.net/en/list linked list] and [https://visualgo.net/en/hashtable hash table]. This assignment is designed to make sure you have a firm grasp on Java’s data structures.&lt;br /&gt;
&lt;br /&gt;
=Where to Start=&lt;br /&gt;
&lt;br /&gt;
Navigate to the '''src/main/java''' directory. Go into the '''list.core''' and '''map.core''' packages and take a look at &amp;lt;code&amp;gt;SimpleList.java&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;SimpleMap.java&amp;lt;/code&amp;gt;, repectively. These are the interfaces you must implement in &amp;lt;code&amp;gt;SinglyLinkedList.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LoneListMap.java&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;ArrayOfBucketsHashMap.java&amp;lt;/code&amp;gt;. SinglyLinkedList, as the name suggests, will be your implementation of a singly linked list. LoneListMap will be your implementation of a very simple map, while ArrayOfBucketsHashMap will use an entry’s key to place an entry into one of several buckets. If you have not taken CSE 247, this might not make as much sense. In short, these buckets exist to cut down the runtime of searching for entries within the map, as it is much quicker to search 1/total number of buckets than one large bucket which contains every entry.&lt;br /&gt;
&lt;br /&gt;
Throughout the process, refer to the associated tests to check your progress. Feel free to run tests individually depending on which method you are working on or run the test suite in order to run every test in the associated package.&lt;br /&gt;
&lt;br /&gt;
==SinglyLinkedList==&lt;br /&gt;
&lt;br /&gt;
You must finish SinglyLinkedList before moving on to either of the two maps as the maps will use your list. The only class you have to modify is &amp;lt;code&amp;gt;SinglyLinkedList.java&amp;lt;/code&amp;gt;, but we recommend looking at the other classes in the package as all of them will be incorporated in this class. Refer to the associated SimpleList interface in order to see descriptions of what each method should do and then get started! Alternatively, you can hover your mouse over the name of the method and the javadocs should pop up for you. All of this should look extremely familiar if you took CSE 131.&lt;br /&gt;
&lt;br /&gt;
A couple of notes and common issues:&lt;br /&gt;
&lt;br /&gt;
*Remember to update your next reference and size when inserting and deleting.&lt;br /&gt;
*The “head” is a sentinel node, meaning its sole purpose is to point its next reference to the true first node of the list. It should always maintain a value of null and you should never change its value.&lt;br /&gt;
*While you do not have to use LinkedListIterator to correctly implement all of the methods, feel free to do so as it might make your life easier. If you are not familiar with iterators, we recommend at least attempting this in order to familiarize yourself with them.&lt;br /&gt;
*For the get method, remember to account for when the user attempts to feed an index value that is less than zero or greater than size. Refer to the javadocs for more detail, but it should return null and not throw an exception for such a scenario.&lt;br /&gt;
*You must implement the addFirst method before any of the others if you want your tests to work.&lt;br /&gt;
&lt;br /&gt;
==LoneListMap==&lt;br /&gt;
&lt;br /&gt;
You must finish SinglyLinkedList before moving on to this class as both maps uses your implementation of a singly linked list. If you are already familiar with buckets and maps and wish to skip this implementation, then feel free to go straight to ArrayOfBucketsHashMap. Otherwise, there is a warm up task of implementing &amp;lt;code&amp;gt;LoneListMap.java&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A couple of notes and common issues:&lt;br /&gt;
&lt;br /&gt;
*You must implement the put method before any of the others if you want your tests to work.&lt;br /&gt;
*In this implementation, the size of the list is equivalent to the size of the map.&lt;br /&gt;
*Be careful to return the correct value, check the javadocs or the interface to ensure your return statements are correct.&lt;br /&gt;
*For the compute method, a BiFunction is simply Java’s '''functional interface''' for something that takes in two input parameters and spits out a result. &amp;lt;code&amp;gt;? super K&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;? super V&amp;lt;/code&amp;gt; indicates a class K or V extends ('''superclass'''), while &amp;lt;code&amp;gt;? extends V&amp;lt;/code&amp;gt; indicates a class that extends V ('''subclass'''). The &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; is referred to as a '''wildcard generic'''. Follow the links below for Oracle’s documentation on the topic.&lt;br /&gt;
**[https://docs.oracle.com/javase/tutorial/java/generics/wildcardGuidelines.html Wildcard Guidelines]&lt;br /&gt;
**[https://docs.oracle.com/javase/tutorial/extra/generics/wildcards.html Wildcards]&lt;br /&gt;
*When writing the compute method, check the entries to see if the given key exists. If it does, use remappingFunction’s apply method to generate a new value and set it as the new value for the entry. The method should return this new value. Otherwise, if the key was not found, it should return null.&lt;br /&gt;
*Lambda expressions come in handy when using the compute method, but you will not use lambda expressions to author the method.&lt;br /&gt;
*The tests for this package test both LoneListMap and ArrayOfBucketsHashMap, so do not worry if you are failing the tests if you haven’t both maps, yet.&lt;br /&gt;
&lt;br /&gt;
==ArrayOfBucketsHashMap==&lt;br /&gt;
&lt;br /&gt;
You must finish SinglyLinkedList before moving on to this class as the map uses your implementation of a singly linked list. In this class, you will use the entry’s key’s hashcode to determine which of 1024 buckets it should fall into. The reasoning for why we do this is explained under “Where to Start.” In order to calculate the index of the bucket that the entry belongs in, we will make use of the hash function, which in turn uses Math.floorMod to calculate a modulo (remainder or % in Java) based on the number of buckets and the key’s hashcode. We will also make use of the getListFor method, which utilizes the hash method in order to return a '''pointer''' to the correct bucket.&lt;br /&gt;
&lt;br /&gt;
A couple of notes and common issues:&lt;br /&gt;
&lt;br /&gt;
*You must implement the put method before any of the others if you want your tests to work.&lt;br /&gt;
*In this implementation, the size of the map is equal to the size of the sum of the 1024 buckets, with each bucket containing one list.&lt;br /&gt;
*Be careful to return the correct value, check the javadocs or the interface to ensure your return statements are correct.&lt;br /&gt;
*For the compute method, a BiFunction is simply Java’s '''functional interface''' for something that takes in two input parameters and spits out a result. &amp;lt;code&amp;gt;? super K&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;? super V&amp;lt;/code&amp;gt; indicates a class K or V extends ('''superclass'''), while &amp;lt;code&amp;gt;? extends V&amp;lt;/code&amp;gt; indicates a class that extends V ('''subclass'''). The &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; is referred to as a '''wildcard generic'''. Follow the links below for Oracle’s documentation on the topic.&lt;br /&gt;
**[https://docs.oracle.com/javase/tutorial/java/generics/wildcardGuidelines.html Wildcard Guidelines]&lt;br /&gt;
**[https://docs.oracle.com/javase/tutorial/extra/generics/wildcards.html Wildcards]&lt;br /&gt;
*When writing the compute method, check the entries to see if the given key exists. If it does, use remappingFunction’s apply method to generate a new value and set it as the new value for the entry. The method should return this new value. Otherwise, if the key was not found, it should return null.&lt;br /&gt;
*Lambda expressions come in handy when using the compute method, but you will not use lambda expressions to create the method.&lt;br /&gt;
*The tests for this package test both LoneListMap and ArrayOfBucketsHashMap, so do not worry if you are failing the tests if you haven’t implemented both maps, yet.&lt;br /&gt;
&lt;br /&gt;
=Rubric=&lt;br /&gt;
&lt;br /&gt;
As always, please make sure to cite your work appropriately.&lt;br /&gt;
&lt;br /&gt;
Total points: 100&lt;br /&gt;
&lt;br /&gt;
SinglyLinkedList subtotal: 40&lt;br /&gt;
* Correct size (2.5)&lt;br /&gt;
* Correct isEmpty (2.5)&lt;br /&gt;
* Correct putAtFront (7.5)&lt;br /&gt;
* Correct remove (7.5)&lt;br /&gt;
* Correct getValueAt (10)&lt;br /&gt;
* Correct getIndexOf (10)&lt;br /&gt;
&lt;br /&gt;
ArrayOfBucketsHashMap subtotal: 50&lt;br /&gt;
* Correct size (2.5)&lt;br /&gt;
* Correct isEmpty (2.5)&lt;br /&gt;
* Correct put (10)&lt;br /&gt;
* Correct remove (10)&lt;br /&gt;
* Correct get (10)&lt;br /&gt;
* Correct compute (15)&lt;br /&gt;
&lt;br /&gt;
Whole project:&lt;br /&gt;
* Clarity and efficiency (10)&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=K_Mer_Counting_Assignment&amp;diff=163</id>
		<title>K Mer Counting Assignment</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=K_Mer_Counting_Assignment&amp;diff=163"/>
		<updated>2017-04-17T18:41:59Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Tests==&lt;br /&gt;
For this assignment, tests are not located with the assignment files. They are located in your src/test/java folder, not your hw6-src folder.&lt;br /&gt;
&lt;br /&gt;
==Files==&lt;br /&gt;
===Studio (in hw6-src)===&lt;br /&gt;
* &amp;lt;code&amp;gt;student.assignment.kmer.studio.StringHashMapKMerCounter&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.studio.AStringHashMapTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;student.assignment.kmer.studio.StringConcurrentHashMapKMerCounter&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.studio.BStringConcurrentHashMapTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;student.assignment.kmer.studio.SequenceSliceConcurrentHashMapKMerCounter&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.studio.CSequenceSliceConcurrentHashMapTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===Required Homework===&lt;br /&gt;
* &amp;lt;code&amp;gt;student.assignment.kmer.required.SequenceSlices&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.required.DSequenceSlicesTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;student.assignment.kmer.required.LongConcurrentHashMapKMerCounter&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.required.ELongConcurrentHashMapTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;student.assignment.kmer.required.IntArrayKMerCounter&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.required.FIntArrayTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;student.assignment.kmer.required.AtomicIntegerArrayKMerCounter&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.required.GAtomicIntegerArrayTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===Optional (not extra credit)===&lt;br /&gt;
&amp;lt;code&amp;gt;student.assignment.kmer.fun.LongMatrixMapReducesqueKMerCounter&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.fun.HLongMatrixMapReducesqueTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===Extra Credit===&lt;br /&gt;
&amp;lt;code&amp;gt;student.assignment.kmer.extracredit.OpenEndedKMerCounter&amp;lt;/code&amp;gt; (Test with &amp;lt;code&amp;gt;student.assignment.kmer.extracredit.IOpenEndedTest&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
==research==&lt;br /&gt;
[https://en.wikipedia.org/wiki/K-mer wikipedia article on k-mers]&lt;br /&gt;
&lt;br /&gt;
paper: [https://academic.oup.com/bioinformatics/article-lookup/doi/10.1093/bioinformatics/btr011 A fast, lock-free approach for efficient parallel counting of occurrences of k-mers] (Jellyfish)&lt;br /&gt;
&lt;br /&gt;
paper: [https://peerj.com/articles/cs-94/ Multiple comparative metagenomics using multiset k-mer counting]&lt;br /&gt;
&lt;br /&gt;
[http://homolog.us/Tutorials/index.php?p=3.7&amp;amp;s=2 Collection of approaches to k-mer counting]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform Burrows–Wheeler transform]&lt;br /&gt;
&lt;br /&gt;
[http://biology.stackexchange.com/questions/45016/what-is-the-biological-significance-of-k-mer-counting Significance of k-mer Counting]&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Chocolatey&amp;diff=153</id>
		<title>Chocolatey</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Chocolatey&amp;diff=153"/>
		<updated>2017-03-29T18:55:05Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''You should use these instructions only if the Java file does not work for downloading OpenCV. The file is named &amp;quot;DownloadOpenCVNativeLib&amp;quot;.'''&lt;br /&gt;
&lt;br /&gt;
==install power shell [https://msdn.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell]==&lt;br /&gt;
&lt;br /&gt;
==install chololatey [https://chocolatey.org/install]==&lt;br /&gt;
&lt;br /&gt;
run powershell as administrator [http://www.thewindowsclub.com/how-to-open-an-elevated-powershell-prompt-in-windows-10]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;choco upgrade chocolatey&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;choco install opencv&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==lines repeated for copying to clipboard==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;clippy show=&amp;quot;true&amp;quot;&amp;gt;iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex&amp;lt;/clippy&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;clippy show=&amp;quot;true&amp;quot;&amp;gt;choco upgrade chocolatey&amp;lt;/clippy&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;clippy show=&amp;quot;true&amp;quot;&amp;gt;choco install opencv&amp;lt;/clippy&amp;gt;&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Eclipse_Tips&amp;diff=63</id>
		<title>Eclipse Tips</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Eclipse_Tips&amp;diff=63"/>
		<updated>2017-02-10T20:43:04Z</updated>

		<summary type="html">&lt;p&gt;Finn: Created page with &amp;quot;Eclipse is a very powerful IDE for Java development. You can download it from [https://eclipse.org/downloads/ eclipse.org/downloads]. This page will contain tips for using Ecl...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Eclipse is a very powerful IDE for Java development. You can download it from [https://eclipse.org/downloads/ eclipse.org/downloads]. This page will contain tips for using Eclipse more efficiently in this class.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Lambdas&amp;diff=27</id>
		<title>Lambdas</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Lambdas&amp;diff=27"/>
		<updated>2017-02-03T16:38:04Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lambdas are one of the most recently-added features in Java, essentially allowing one to pass a function as an parameter to a method. The functionality provided by lambdas has always been available, but lambdas allow the syntax to be significantly more succinct. This page will discuss alternatives to lambdas in order to better explain what lambdas are doing behind the scenes. It is based on the [https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html Java Tutorials], but has been adapted for the code used more frequently in CSE 231. If you are unfamiliar with [[interfaces]], you should probably read about them before this page.&lt;br /&gt;
&lt;br /&gt;
== The Problem ==&lt;br /&gt;
&lt;br /&gt;
In Habanero-Java, the async() method is used to spawn a task that will run asynchronously to the rest of your program. Ideally, the async() method would take a function as a parameter. The async() method could then call this function in parallel with the rest of your code. In Java, however, functions cannot be passed as parameters to methods. Only objects (and primitive types) can be passed in.&lt;br /&gt;
&lt;br /&gt;
To solve this problem, the async() method takes an HjSuspendable as a parameter. HjSuspendable is an interface which contains a single method: run(). You can read more about interfaces on the [[Interfaces]] page. The async() method requires you to pass in an instance of a class that implements HjSuspendable--thus guaranteeing that it has a run() method--and the async() method will call the run() method of your object asynchronously.&lt;br /&gt;
&lt;br /&gt;
== Named Classes ==&lt;br /&gt;
&lt;br /&gt;
A straightforward solution is to write your own class that implements HjSuspendable. Let's say, for example, that you want to print &amp;quot;Hello, World!&amp;quot; asynchronously. The pseudocode for this would be something like this:&lt;br /&gt;
&lt;br /&gt;
 async {&lt;br /&gt;
   print &amp;quot;Hello, World!&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We could create a class called PrintHelloWorld that implements HjSuspendable. It would look something like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;public class PrintHelloWorld implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    @Override&lt;br /&gt;
    public void run() throws SuspendableException {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, World!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instance of this class could then be passed into the async() method. For example:&lt;br /&gt;
&lt;br /&gt;
 HabaneroClassic.async(new PrintHelloWorld());&lt;br /&gt;
&lt;br /&gt;
This code would perform the way we would expect from the pseudocode.&lt;br /&gt;
&lt;br /&gt;
Now let's try a more complex example. Let's try to recreate the ArraySum program using this method. The pseudocode for this program would look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;finish {&lt;br /&gt;
&lt;br /&gt;
    async {&lt;br /&gt;
        leftSum = 0&lt;br /&gt;
        for j in [0, midpoint) {&lt;br /&gt;
            leftSum += array[j]&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    rightSum = 0;&lt;br /&gt;
    for j in [midpoint, array.length) {&lt;br /&gt;
        rightSum += array[j]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
print leftTotal + rightTotal&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this program, we'd need to write two classes: one for the HjSuspendable object passed to the finish() method, and one for the HjSuspendable object passed to the async() method. There is an issue, however. Several variables need to be accessed both inside and outside of the async. The array, instantiated outside of the finish, must be accessible within both the finish and the async. The leftTotal and rightTotal variables, instantiated inside of the finish, need to be accessible outside of it. Because we're creating a new class, this can easily be accomplished by creating instance variables within our new classes. The code would look something like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;class SumLeftHalf implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    int[] array;&lt;br /&gt;
    int midpoint;&lt;br /&gt;
&lt;br /&gt;
    int leftSum;&lt;br /&gt;
&lt;br /&gt;
    public SumLeftHalf(int[] array) {&lt;br /&gt;
        this.array = array;&lt;br /&gt;
        midpoint = array.length / 2;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void run() {&lt;br /&gt;
        for (int i = 0; i &amp;lt; midpoint; i++)&lt;br /&gt;
            leftSum += array[i];&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    int getLeftSum() {&lt;br /&gt;
        return leftSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;class AsyncArraySum implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    int[] array;&lt;br /&gt;
    int midpoint;&lt;br /&gt;
&lt;br /&gt;
    SumLeftHalf sumLeftHalf;&lt;br /&gt;
    int rightSum;&lt;br /&gt;
&lt;br /&gt;
    AsyncArraySum(int[] array) {&lt;br /&gt;
        this.array = array;&lt;br /&gt;
        midpoint = array.length / 2;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void run() {&lt;br /&gt;
&lt;br /&gt;
        sumLeftHalf = new SumLeftHalf(array);&lt;br /&gt;
        async(sumLeftHalf);&lt;br /&gt;
&lt;br /&gt;
        for (int j = midpoint; j &amp;lt; array.length; j++)&lt;br /&gt;
            rightSum += array[j];&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    int getSum() {&lt;br /&gt;
        int leftSum = sumLeftHalf.getLeftSum();&lt;br /&gt;
        return leftSum + rightSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;AsyncArraySum arraySum = new AsyncArraySum(array);&lt;br /&gt;
finish(arraySum);&lt;br /&gt;
System.out.println(arraySum.getSum());&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the incredible bulkiness of this code. This code is significantly longer than the pseudocode, and part of this stems from the fact that we are writing entire classes to contain methods. The other issue is that a method in one class does not have access to the local variables in another class. This fact requires us to create methods and fields to store and access these variables, making the code a lot less readable.&lt;br /&gt;
&lt;br /&gt;
=== Nested Classes ===&lt;br /&gt;
&lt;br /&gt;
One way to organize this code a bit better would be to make the AsyncArraySum and SumLeftHalf classes nested inside the original class. This would make the code a bit more readable and would also provide more access to local variables. You can read more about nested classes from the [https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html Java Tutorials].&lt;br /&gt;
&lt;br /&gt;
== Anonymous Classes ==&lt;br /&gt;
&lt;br /&gt;
Anonymous classes have existed in Java since Java 1.1, and they've been the best solution to this problem up until Java 8. Anonymous classes allow you to simplify your code by declaring an unnamed class within the method of another class. Anonymous classes are good for short, one-time-use-only classes, exactly what we're looking for here. You can read more about anonymous classes from the [https://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html Java Tutorials]. Here is some example syntax for our code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;int mid = array.length / 2;&lt;br /&gt;
int[] subSums = new int[2];&lt;br /&gt;
&lt;br /&gt;
finish(new HjSuspendable() {&lt;br /&gt;
&lt;br /&gt;
    public void run() {&lt;br /&gt;
&lt;br /&gt;
        async(new HjSuspendable() {&lt;br /&gt;
&lt;br /&gt;
            public void run() {&lt;br /&gt;
                for (int i = 0; i &amp;lt; mid; i++) {&lt;br /&gt;
                    subSums[0] += array[i];&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
        for (int j = mid; j &amp;lt; array.length; j++) {&lt;br /&gt;
            subSums[1] += array[j];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
System.out.println(subSums[0] + subSums[1]);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the array and subSums variables can be accessed within and outside of the anonymous class. This is a key feature that anonymous inner classes have that regular classes don't. Java allows us to access variables in an entirely different scope, '''so long as they are final or effectively final'''. What it is doing behind the scenes is functionally similar to our named classes example. It passes a reference to the subSums array, and it doesn't allow you to change the reference in the enclosing class because it would be too complicated to then change it in the anonymous class instance. This is a key limitation to anonymous classes, and it leads to some annoying issues in HW1.&lt;br /&gt;
&lt;br /&gt;
== Lambdas ==&lt;br /&gt;
&lt;br /&gt;
Lambdas, added in Java 8, make the syntax for anonymous classes significantly simpler. They are allowed only when an interface has a single method. In this case, the HjSuspendable class has only one method: run(). The syntax using lambdas would look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;int mid = array.length / 2;&lt;br /&gt;
int[] subSums = new int[2];&lt;br /&gt;
&lt;br /&gt;
finish(() -&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
    async(() -&amp;gt; {&lt;br /&gt;
        for (int i = 0; i &amp;lt; mid; i++) {&lt;br /&gt;
            subSums[0] += array[i];&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
    for (int i = mid; i &amp;lt; array.length; i++) {&lt;br /&gt;
        subSums[1] += array[i];&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
System.out.println(subSums[0] + subSums[1]);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lambdas act very similar to anonymous classes, but the syntax is significantly clearer. Our code is easier to read and it makes sense what it's doing on a high level--passing a method as a parameter to another method.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Main_Page&amp;diff=16</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Main_Page&amp;diff=16"/>
		<updated>2017-02-03T16:36:51Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the wiki for CSE 231 Introduction to Parallel and Concurrent Programming at Washington University in St. Louis. This wiki is currently under construction, but you can check out some of the pages we have so far:&lt;br /&gt;
&lt;br /&gt;
* [[Interfaces]]&lt;br /&gt;
* [[Lambdas]]&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Lambdas&amp;diff=26</id>
		<title>Lambdas</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Lambdas&amp;diff=26"/>
		<updated>2017-02-01T04:18:12Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lambdas are one of the most recently-added features in Java, essentially allowing one to pass a function as an parameter to a method. The functionality provided by lambdas has always been available, but lambdas allow the syntax to be significantly more succinct. This page will discuss alternatives to lambdas in order to better explain what lambdas are doing behind the scenes. It is based on the [https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html Java Tutorials], but has been adapted for the code used more frequently in CSE 231.&lt;br /&gt;
&lt;br /&gt;
== The Problem ==&lt;br /&gt;
&lt;br /&gt;
In Habanero-Java, the async() method is used to spawn a task that will run asynchronously to the rest of your program. Ideally, the async() method would take a function as a parameter. The async() method could then call this function in parallel with the rest of your code. In Java, however, functions cannot be passed as parameters to methods. Only objects (and primitive types) can be passed in.&lt;br /&gt;
&lt;br /&gt;
To solve this problem, the async() method takes an HjSuspendable as a parameter. HjSuspendable is an interface which contains a single method: run(). You can read more about interfaces on the [[Interfaces]] page. The async() method requires you to pass in an instance of a class that implements HjSuspendable--thus guaranteeing that it has a run() method--and the async() method will call the run() method of your object asynchronously.&lt;br /&gt;
&lt;br /&gt;
== Named Classes ==&lt;br /&gt;
&lt;br /&gt;
A straightforward solution is to write your own class that implements HjSuspendable. Let's say, for example, that you want to print &amp;quot;Hello, World!&amp;quot; asynchronously. The pseudocode for this would be something like this:&lt;br /&gt;
&lt;br /&gt;
 async {&lt;br /&gt;
   print &amp;quot;Hello, World!&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We could create a class called PrintHelloWorld that implements HjSuspendable. It would look something like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;public class PrintHelloWorld implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    @Override&lt;br /&gt;
    public void run() throws SuspendableException {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, World!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instance of this class could then be passed into the async() method. For example:&lt;br /&gt;
&lt;br /&gt;
 HabaneroClassic.async(new PrintHelloWorld());&lt;br /&gt;
&lt;br /&gt;
This code would perform the way we would expect from the pseudocode.&lt;br /&gt;
&lt;br /&gt;
Now let's try a more complex example. Let's try to recreate the ArraySum program using this method. The pseudocode for this program would look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;finish {&lt;br /&gt;
&lt;br /&gt;
    async {&lt;br /&gt;
        leftSum = 0&lt;br /&gt;
        for j in [0, midpoint) {&lt;br /&gt;
            leftSum += array[j]&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    rightSum = 0;&lt;br /&gt;
    for j in [midpoint, array.length) {&lt;br /&gt;
        rightSum += array[j]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
print leftTotal + rightTotal&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this program, we'd need to write two classes: one for the HjSuspendable object passed to the finish() method, and one for the HjSuspendable object passed to the async() method. There is an issue, however. Several variables need to be accessed both inside and outside of the async. The array, instantiated outside of the finish, must be accessible within both the finish and the async. The leftTotal and rightTotal variables, instantiated inside of the finish, need to be accessible outside of it. Because we're creating a new class, this can easily be accomplished by creating instance variables within our new classes. The code would look something like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;class SumLeftHalf implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    int[] array;&lt;br /&gt;
    int midpoint;&lt;br /&gt;
&lt;br /&gt;
    int leftSum;&lt;br /&gt;
&lt;br /&gt;
    public SumLeftHalf(int[] array) {&lt;br /&gt;
        this.array = array;&lt;br /&gt;
        midpoint = array.length / 2;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void run() {&lt;br /&gt;
        for (int i = 0; i &amp;lt; midpoint; i++)&lt;br /&gt;
            leftSum += array[i];&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    int getLeftSum() {&lt;br /&gt;
        return leftSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;class AsyncArraySum implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    int[] array;&lt;br /&gt;
    int midpoint;&lt;br /&gt;
&lt;br /&gt;
    SumLeftHalf sumLeftHalf;&lt;br /&gt;
    int rightSum;&lt;br /&gt;
&lt;br /&gt;
    AsyncArraySum(int[] array) {&lt;br /&gt;
        this.array = array;&lt;br /&gt;
        midpoint = array.length / 2;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public void run() {&lt;br /&gt;
&lt;br /&gt;
        sumLeftHalf = new SumLeftHalf(array);&lt;br /&gt;
        async(sumLeftHalf);&lt;br /&gt;
&lt;br /&gt;
        for (int j = midpoint; j &amp;lt; array.length; j++)&lt;br /&gt;
            rightSum += array[j];&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    int getSum() {&lt;br /&gt;
        int leftSum = sumLeftHalf.getLeftSum();&lt;br /&gt;
        return leftSum + rightSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;AsyncArraySum arraySum = new AsyncArraySum(array);&lt;br /&gt;
finish(arraySum);&lt;br /&gt;
System.out.println(arraySum.getSum());&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the incredible bulkiness of this code. This code is significantly longer than the pseudocode, and part of this stems from the fact that we are writing entire classes to contain methods. The other issue is that a method in one class does not have access to the local variables in another class. This fact requires us to create methods and fields to store and access these variables, making the code a lot less readable.&lt;br /&gt;
&lt;br /&gt;
=== Nested Classes ===&lt;br /&gt;
&lt;br /&gt;
One way to organize this code a bit better would be to make the AsyncArraySum and SumLeftHalf classes nested inside the original class. This would make the code a bit more readable and would also provide more access to local variables. You can read more about nested classes from the [https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html Java Tutorials].&lt;br /&gt;
&lt;br /&gt;
== Anonymous Classes ==&lt;br /&gt;
&lt;br /&gt;
Anonymous classes have existed in Java since Java 1.1, and they've been the best solution to this problem up until Java 8. Anonymous classes allow you to simplify your code by declaring an unnamed class within the method of another class. Anonymous classes are good for short, one-time-use-only classes, exactly what we're looking for here. You can read more about anonymous classes from the [https://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html Java Tutorials]. Here is some example syntax for our code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;int mid = array.length / 2;&lt;br /&gt;
int[] subSums = new int[2];&lt;br /&gt;
&lt;br /&gt;
finish(new HjSuspendable() {&lt;br /&gt;
&lt;br /&gt;
    public void run() {&lt;br /&gt;
&lt;br /&gt;
        async(new HjSuspendable() {&lt;br /&gt;
&lt;br /&gt;
            public void run() {&lt;br /&gt;
                for (int i = 0; i &amp;lt; mid; i++) {&lt;br /&gt;
                    subSums[0] += array[i];&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
        for (int j = mid; j &amp;lt; array.length; j++) {&lt;br /&gt;
            subSums[1] += array[j];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
System.out.println(subSums[0] + subSums[1]);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the array and subSums variables can be accessed within and outside of the anonymous class. This is a key feature that anonymous inner classes have that regular classes don't. Java allows us to access variables in an entirely different scope, '''so long as they are final or effectively final'''. What it is doing behind the scenes is functionally similar to our named classes example. It passes a reference to the subSums array, and it doesn't allow you to change the reference in the enclosing class because it would be too complicated to then change it in the anonymous class instance. This is a key limitation to anonymous classes, and it leads to some annoying issues in HW1.&lt;br /&gt;
&lt;br /&gt;
== Lambdas ==&lt;br /&gt;
&lt;br /&gt;
Lambdas, added in Java 8, make the syntax for anonymous classes significantly simpler. They are allowed only when an interface has a single method. In this case, the HjSuspendable class has only one method: run(). The syntax using lambdas would look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;int mid = array.length / 2;&lt;br /&gt;
int[] subSums = new int[2];&lt;br /&gt;
&lt;br /&gt;
finish(() -&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
    async(() -&amp;gt; {&lt;br /&gt;
        for (int i = 0; i &amp;lt; mid; i++) {&lt;br /&gt;
            subSums[0] += array[i];&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
    for (int i = mid; i &amp;lt; array.length; i++) {&lt;br /&gt;
        subSums[1] += array[i];&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
System.out.println(subSums[0] + subSums[1]);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lambdas act very similar to anonymous classes, but the syntax is significantly clearer. Our code is easier to read and it makes sense what it's doing on a high level--passing a method as a parameter to another method.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Lambdas&amp;diff=25</id>
		<title>Lambdas</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Lambdas&amp;diff=25"/>
		<updated>2017-02-01T03:21:15Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lambdas are one of the most recently-added features in Java, essentially allowing one to pass a function as an parameter to a method. The functionality provided by lambdas has always been available, but lambdas allow the syntax to be significantly more succinct. This page will discuss alternatives to lambdas in order to better explain what lambdas are doing behind the scenes. It is based on the [https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html Java Tutorials], but has been adapted for the code used more frequently in CSE 231.&lt;br /&gt;
&lt;br /&gt;
== The Problem ==&lt;br /&gt;
&lt;br /&gt;
In Habanero-Java, the async() method is used to spawn a task that will run asynchronously to the rest of your program. Ideally, the async() method would take a function as a parameter. The async() method could then call this function in parallel with the rest of your code. In Java, however, functions cannot be passed as parameters to methods. Only objects (and primitive types) can be passed in.&lt;br /&gt;
&lt;br /&gt;
To solve this problem, the async() method takes an HjSuspendable as a parameter. HjSuspendable is an interface which contains a single method: run(). You have to pass in an instance of a class that implements HjSuspendable--thus guaranteeing that it has a run() method--and the async() method will call the run() method of your object asynchronously.&lt;br /&gt;
&lt;br /&gt;
== Separate Classes ==&lt;br /&gt;
&lt;br /&gt;
A straightforward solution is to write your own class that implements HjSuspendable. Let's say, for example, that you want to print &amp;quot;Hello, World!&amp;quot; asynchronously. The pseudocode for this would be something like this:&lt;br /&gt;
&lt;br /&gt;
 async {&lt;br /&gt;
   print &amp;quot;Hello, World!&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We could create a class called PrintHelloWorld that implements HjSuspendable. It would look something like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;public class PrintHelloWorld implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    @Override&lt;br /&gt;
    public void run() throws SuspendableException {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, World!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instance of this class could then be passed into the async() method. For example:&lt;br /&gt;
&lt;br /&gt;
 HabaneroClassic.async(new PrintHelloWorld());&lt;br /&gt;
&lt;br /&gt;
This code would perform the way we would expect from the pseudocode.&lt;br /&gt;
&lt;br /&gt;
Now let's try a more complex example. Let's try to recreate the ArraySum program using this method. The pseudocode for this program would look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;finish {&lt;br /&gt;
&lt;br /&gt;
    async {&lt;br /&gt;
        leftSum = 0&lt;br /&gt;
        for j in [0, midpoint) {&lt;br /&gt;
            leftSum += array[j]&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    rightSum = 0;&lt;br /&gt;
    for j in [midpoint, array.length) {&lt;br /&gt;
        rightSum += array[j]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
print leftTotal + rightTotal&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this program, we'd need to write two classes: one for the HjSuspendable object passed to the finish() method, and one for the HjSuspendable object passed to the async() method. There is an issue, however. Several variables need to be accessed both inside and outside of the async. The array, instantiated outside of the finish, must be accessible within both the finish and the async. The leftTotal and rightTotal variables, instantiated inside of the finish, need to be accessible outside of it. Because we're creating a new class, this can easily be accomplished by creating instance variables within our new classes. The code would look something like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;class SumLeftHalf implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    int[] array;&lt;br /&gt;
    int midpoint;&lt;br /&gt;
&lt;br /&gt;
    int leftSum;&lt;br /&gt;
&lt;br /&gt;
    public SumLeftHalf(int[] array) {&lt;br /&gt;
        this.array = array;&lt;br /&gt;
        midpoint = array.length / 2;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    @Override&lt;br /&gt;
    public void run() {&lt;br /&gt;
        for (int i = 0; i &amp;lt; midpoint; i++)&lt;br /&gt;
            leftSum += array[i];&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    int getLeftSum() {&lt;br /&gt;
        return leftSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;class AsyncArraySum implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    int[] array;&lt;br /&gt;
    int midpoint;&lt;br /&gt;
&lt;br /&gt;
    SumLeftHalf sumLeftHalf;&lt;br /&gt;
    int rightSum;&lt;br /&gt;
&lt;br /&gt;
    AsyncArraySum(int[] array) {&lt;br /&gt;
        this.array = array;&lt;br /&gt;
        midpoint = array.length / 2;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    @Override&lt;br /&gt;
    public void run() {&lt;br /&gt;
&lt;br /&gt;
        sumLeftHalf = new SumLeftHalf(array);&lt;br /&gt;
        HabaneroClassic.async(sumLeftHalf);&lt;br /&gt;
&lt;br /&gt;
        for (int j = midpoint; j &amp;lt; array.length; j++)&lt;br /&gt;
            rightSum += array[j];&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    int getSum() {&lt;br /&gt;
        int leftSum = sumLeftHalf.getLeftSum();&lt;br /&gt;
        return leftSum + rightSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;AsyncArraySum arraySum = new AsyncArraySum(array);&lt;br /&gt;
HabaneroClassic.finish(arraySum);&lt;br /&gt;
System.out.println(arraySum.getSum());&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the incredible bulkiness of this code. This code is significantly longer than the pseudocode, and part of this stems from the fact that we are writing entire classes to contain methods. The other issue is that a method in one class does not have access to the local variables in another class. This fact requires us to create methods and fields to store and access these variables, making the code a lot less readable.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Lambdas&amp;diff=24</id>
		<title>Lambdas</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Lambdas&amp;diff=24"/>
		<updated>2017-01-31T06:02:08Z</updated>

		<summary type="html">&lt;p&gt;Finn: Created page with &amp;quot;Lambdas are one of the most recently-added features in Java, essentially allowing one to pass a function as an parameter to a method. The functionality provided by lambdas has...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lambdas are one of the most recently-added features in Java, essentially allowing one to pass a function as an parameter to a method. The functionality provided by lambdas has always been available, but lambdas allow the syntax to be significantly more succinct. This page will discuss alternatives to lambdas in order to better explain what lambdas are doing behind the scenes. It is based on the [https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html Java Tutorials], but has been adapted for the code used more frequently in CSE 231.&lt;br /&gt;
&lt;br /&gt;
== The Problem ==&lt;br /&gt;
&lt;br /&gt;
In Habanero-Java, the async() method is used to spawn a task that will run asynchronously to the rest of your program. Ideally, the async() method would take a function as a parameter. The async() method could then call this function in parallel with the rest of your code. In Java, however, functions cannot be passed as parameters to methods. Only objects (and primitive types) can be passed in.&lt;br /&gt;
&lt;br /&gt;
To solve this problem, the async() method takes an HjSuspendable as a parameter. HjSuspendable is an interface which contains a single method: run(). You have to pass in an instance of a class that implements HjSuspendable--thus guaranteeing that it has a run() method--and the async() method will call the run() method of your object asynchronously.&lt;br /&gt;
&lt;br /&gt;
== Separate Classes ==&lt;br /&gt;
&lt;br /&gt;
A straightforward solution is to write your own class that implements HjSuspendable. Let's say, for example, that you want to print &amp;quot;Hello, World!&amp;quot; asynchronously. The pseudocode for this would be something like this:&lt;br /&gt;
&lt;br /&gt;
 async {&lt;br /&gt;
   print &amp;quot;Hello, World!&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We could create a class called PrintHelloWorld that implements HjSuspendable. It would look something like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;public class PrintHelloWorld implements HjSuspendable {&lt;br /&gt;
&lt;br /&gt;
    @Override&lt;br /&gt;
    public void run() throws SuspendableException {&lt;br /&gt;
        System.out.println(&amp;quot;Hello, World!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instance of this class could then be passed into the async() method. For example:&lt;br /&gt;
&lt;br /&gt;
 HabaneroClassic.async(new PrintHelloWorld());&lt;br /&gt;
&lt;br /&gt;
This code would perform the way we would expect from the pseudocode.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=23</id>
		<title>Interfaces</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=23"/>
		<updated>2017-01-31T05:16:48Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Interfaces in Java can be a powerful tool, allowing you to abstract away implementation details. For CSE 231, you will never be required to write your own interfaces for any of our assignments; however, whenever you use lambdas, you are implementing an existing interface, and it can be useful to understand exactly what an interface is and what lambdas are doing behind the scenes.&lt;br /&gt;
&lt;br /&gt;
== Terminology ==&lt;br /&gt;
&lt;br /&gt;
An ''interface'' is, most simply, a group of related methods with empty bodies. An interface is used to describe methods that a class should have, without actually giving the details on exactly what the class does internally. In the same way that a class is a blueprint for an object, an interface is a blueprint for a class.&lt;br /&gt;
&lt;br /&gt;
To ''implement'' a method is to write the code that describes what it does internally. An ''umimplemented'' or ''abstract'' method is one that has no method body. All of the methods in an interface are abstract.&lt;br /&gt;
&lt;br /&gt;
An ''implementation'' or ''implementing class'' is a normal Java class that implements the methods in the interface. In other words, the interface describes what the methods are, and the implementation describes what those methods do internally. All of the methods defined in an interface must be implemented in the implemented class (unless the class is abstract). The power of an interface comes from the fact that multiple classes can implement the same interface.&lt;br /&gt;
&lt;br /&gt;
A lambda is a special case of implementing class for an interface with only one method. Lambdas are discussed more extensively on the [[Lambdas]] page.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
[https://docs.oracle.com/javase/tutorial/java/concepts/interface.html The Java Tutorials] has a simple example of a Bicycle interface and a ACMEBicycle implementing class. Notice how the methods in the Bicycle interface don't have bodies. In this example, the interface isn't particularly useful; if an interface only has one implementing class, you may as well just have the implementing class.&lt;br /&gt;
&lt;br /&gt;
[https://www.tutorialspoint.com/java/java_interfaces.htm TutorialsPoint] has a more in-depth explanation of how interfaces work in Java. It's recommended that you read through this if you don't understand how interfaces work.&lt;br /&gt;
&lt;br /&gt;
However, these examples are still rather contrived. For a real example of a Java interface, take a look at the [https://docs.oracle.com/javase/8/docs/api/java/util/List.html List] interface. If you look at [http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/List.java the source], you will notice that none of the methods have bodies; they're simply definitions of methods that a list should have. The Java Development Kit has several implementations of the List interface, most notably [https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html ArrayList] and [https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html LinkedList]. Internally, these classes store data very differently. ArrayList has an array that stores elements, while LinkedList has a chain of list &amp;quot;nodes.&amp;quot; Because both of these classes implement the List interface however, either one could be passed into a method that takes a List as a parameter.&lt;br /&gt;
&lt;br /&gt;
=== An Added Benefit ===&lt;br /&gt;
&lt;br /&gt;
A key feature of interfaces is that the implementing classes don't have to be from the same package or library as the interface. In other words, you could create your own List implementation, so long as it implemented all of the methods in the List interface. The benefit to this is that a method can simply require a List as a parameter, and any class that implements List will be accepted. If you created your own List implementation that stores data in a unique way, you could still call the [https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#sort(java.util.List) Collections.sort()] method on it. This powerful construct is what allows lambdas to function.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=22</id>
		<title>Interfaces</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=22"/>
		<updated>2017-01-31T05:15:52Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Interfaces in Java can be a powerful tool, allowing you to abstract away implementation details. For CSE 231, you will never be required to write your own interfaces for any of our assignments; however, whenever you use lambdas, you are implementing an existing interface, and it can be useful to understand exactly what an interface is and what lambdas are doing behind the scenes.&lt;br /&gt;
&lt;br /&gt;
== Terminology ==&lt;br /&gt;
&lt;br /&gt;
An ''interface'' is, most simply, a group of related methods with empty bodies. An interface is used to describe methods that a class should have, without actually giving the details on exactly what the class does internally. In the same way that a class is a blueprint for an object, an interface is a blueprint for a class.&lt;br /&gt;
&lt;br /&gt;
To ''implement'' a method is to write the code that describes what it does internally. An ''umimplemented'' or ''abstract'' method is one that has no method body. All of the methods in an interface are abstract.&lt;br /&gt;
&lt;br /&gt;
An ''implementation'' or ''implementing class'' is a normal Java class that implements the methods in the interface. In other words, the interface describes what the methods are, and the implementation describes what those methods do internally. All of the methods defined in an interface must be implemented in the implemented class (unless the class is abstract). The power of an interface comes from the fact that multiple classes can implement the same interface.&lt;br /&gt;
&lt;br /&gt;
A [https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html lambda] is a special case of implementing class for an interface with only one method. Lambdas are discussed more extensively on the Lambdas page.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
[https://docs.oracle.com/javase/tutorial/java/concepts/interface.html The Java Tutorials] has a simple example of a Bicycle interface and a ACMEBicycle implementing class. Notice how the methods in the Bicycle interface don't have bodies. In this example, the interface isn't particularly useful; if an interface only has one implementing class, you may as well just have the implementing class.&lt;br /&gt;
&lt;br /&gt;
[https://www.tutorialspoint.com/java/java_interfaces.htm TutorialsPoint] has a more in-depth explanation of how interfaces work in Java. It's recommended that you read through this if you don't understand how interfaces work.&lt;br /&gt;
&lt;br /&gt;
However, these examples are still rather contrived. For a real example of a Java interface, take a look at the [https://docs.oracle.com/javase/8/docs/api/java/util/List.html List] interface. If you look at [http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/List.java the source], you will notice that none of the methods have bodies; they're simply definitions of methods that a list should have. The Java Development Kit has several implementations of the List interface, most notably [https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html ArrayList] and [https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html LinkedList]. Internally, these classes store data very differently. ArrayList has an array that stores elements, while LinkedList has a chain of list &amp;quot;nodes.&amp;quot; Because both of these classes implement the List interface however, either one could be passed into a method that takes a List as a parameter.&lt;br /&gt;
&lt;br /&gt;
=== An Added Benefit ===&lt;br /&gt;
&lt;br /&gt;
A key feature of interfaces is that the implementing classes don't have to be from the same package or library as the interface. In other words, you could create your own List implementation, so long as it implemented all of the methods in the List interface. The benefit to this is that a method can simply require a List as a parameter, and any class that implements List will be accepted. If you created your own List implementation that stores data in a unique way, you could still call the [https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#sort(java.util.List) Collections.sort()] method on it. This powerful construct is what allows lambdas to function.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=21</id>
		<title>Interfaces</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=21"/>
		<updated>2017-01-28T19:12:10Z</updated>

		<summary type="html">&lt;p&gt;Finn: Created page with &amp;quot;Interfaces in Java can be a powerful tool, allowing you to abstract away implementation details. For CSE 231, you will never be required to write your own interfaces for any o...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Interfaces in Java can be a powerful tool, allowing you to abstract away implementation details. For CSE 231, you will never be required to write your own interfaces for any of our assignments; however, whenever you use lambdas, you are implementing an existing interface, and it can be useful to understand exactly what an interface is and what lambdas are doing behind the scenes.&lt;br /&gt;
&lt;br /&gt;
== Terminology ==&lt;br /&gt;
&lt;br /&gt;
An ''interface'' is, most simply, a group of related methods with empty bodies. An interface is used to describe methods that a class should have, without actually giving the details on exactly what the class does internally. In the same way that a class is a blueprint for an object, an interface is a blueprint for a class.&lt;br /&gt;
&lt;br /&gt;
To ''implement'' a method is to write the code that describes what it does internally. An ''umimplemented'' or ''abstract'' method is one that has no method body. All of the methods in an interface are abstract.&lt;br /&gt;
&lt;br /&gt;
An ''implementation'' or ''implementing class'' is a normal Java class that implements the methods in the interface. In other words, the interface describes what the methods are, and the implementation describes what those methods do internally. All of the methods defined in an interface must be implemented in the implemented class (unless the class is abstract). The power of an interface comes from the fact that multiple classes can implement the same interface.&lt;br /&gt;
&lt;br /&gt;
A [https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html lambda] is a special case of implementing class for an interface with only one method. Lambdas are discussed more extensively on the Lambdas page.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
[https://docs.oracle.com/javase/tutorial/java/concepts/interface.html The Java Tutorials] has a simple example of a Bicycle interface and a ACMEBicycle implementing class. Notice how the methods in the Bicycle interface don't have bodies. In this example, the interface isn't particularly useful; if an interface only has one implementing class, you may as well just have the implementing class.&lt;br /&gt;
&lt;br /&gt;
[https://www.tutorialspoint.com/java/java_interfaces.htm TutorialsPoint] has a more in-depth explanation of how interfaces work in Java. It's recommended that you read through this if you don't understand how interfaces work.&lt;br /&gt;
&lt;br /&gt;
However, these examples are still rather contrived. For a real example of a Java interface, take a look at the [https://docs.oracle.com/javase/8/docs/api/java/util/List.html List] interface. If you look at [http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/List.java the source], you will notice that none of the methods have bodies; they're simply definitions of methods that a list should have. The Java Development Kit has several implementations of the List interface, most notably [https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html ArrayList] and [https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html LinkedList]. Internally, these classes store data very differently. ArrayList has an array that stores elements, while LinkedList has a chain of list &amp;quot;nodes.&amp;quot; Because both of these classes implement the List interface however, either one could be passed into a method that takes a List as a parameter.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Main_Page&amp;diff=15</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Main_Page&amp;diff=15"/>
		<updated>2017-01-27T23:02:34Z</updated>

		<summary type="html">&lt;p&gt;Finn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;strong&amp;gt;MediaWiki has been successfully installed.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consult the [//meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.&lt;br /&gt;
&lt;br /&gt;
== Getting started: ==&lt;br /&gt;
* [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Configuration settings list]&lt;br /&gt;
* [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list]&lt;br /&gt;
* [//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Localise MediaWiki for your language]&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
</feed>