Full Code of ldfaiztt/CSE331 for AI

master 922fead23b9a cached
345 files
16.3 MB
1.6M tokens
1151 symbols
1 requests
Download .txt
Showing preview only (6,593K chars total). Download the full file or copy to clipboard to get everything.
Repository: ldfaiztt/CSE331
Branch: master
Commit: 922fead23b9a
Files: 345
Total size: 16.3 MB

Directory structure:
gitextract_cke7msu3/

├── HW/
│   ├── hw0/
│   │   ├── Adder.java
│   │   ├── Ball.java
│   │   ├── BallContainer.java
│   │   ├── Box.java
│   │   ├── Fibonacci.java
│   │   ├── HelloWorld.java
│   │   ├── HolaWorld.java
│   │   ├── RandomHello.java
│   │   ├── answers/
│   │   │   ├── problem6.txt
│   │   │   └── problem7.txt
│   │   ├── build.xml
│   │   ├── hw0-comments.txt
│   │   ├── optional/
│   │   │   ├── Card.java
│   │   │   ├── CardSuit.java
│   │   │   ├── CardValue.java
│   │   │   ├── FinancialCalc.java
│   │   │   ├── MyHand.java
│   │   │   ├── Point.java
│   │   │   ├── Primes.java
│   │   │   └── StringScrambler.java
│   │   ├── required.properties
│   │   └── test/
│   │       ├── BallContainerTest.java
│   │       ├── BallTest.java
│   │       ├── BoxTest.java
│   │       ├── FibonacciTest.java
│   │       ├── HolaWorldTest.java
│   │       ├── ImplementationTests.java
│   │       ├── RandomHelloTest.java
│   │       └── SpecificationTests.java
│   ├── hw2/
│   │   ├── hw2_answers.txt
│   │   └── hw3_problem0.txt
│   ├── hw3/
│   │   ├── CalculatorFrame.java
│   │   ├── HW3_comment_key.txt
│   │   ├── PolyGraph.java
│   │   ├── RatNum.java
│   │   ├── RatPoly.java
│   │   ├── RatPolyStack.java
│   │   ├── RatTerm.java
│   │   ├── answers/
│   │   │   ├── problem1.txt
│   │   │   ├── problem2.txt
│   │   │   ├── problem5.txt
│   │   │   └── problem6.txt
│   │   ├── build.xml
│   │   ├── daikon-RatNumSmallTest.inv.txt
│   │   ├── daikon-RatNumTest.inv.txt
│   │   ├── required.properties
│   │   └── test/
│   │       ├── ImplementationTests.java
│   │       ├── RatNumSmallTest.java
│   │       ├── RatNumTest.java
│   │       ├── RatPolyStackTest.java
│   │       ├── RatPolyTest.java
│   │       ├── RatTermTest.java
│   │       └── SpecificationTests.java
│   ├── hw4/
│   │   ├── DGraph.java
│   │   ├── LabeledEdge.java
│   │   ├── answers/
│   │   │   ├── problem1.txt
│   │   │   ├── problem2.txt
│   │   │   ├── problem3.txt
│   │   │   └── problem4.txt
│   │   ├── build.xml
│   │   ├── hw4-grading-key.txt
│   │   ├── nullness/
│   │   │   ├── NullnessExample.java
│   │   │   └── NullnessExampleWithWarnings.java
│   │   ├── problem1/
│   │   │   ├── IntQueue1.java
│   │   │   └── IntQueue2.java
│   │   ├── required.properties
│   │   └── test/
│   │       ├── DGraphTest.java
│   │       ├── HW4TestDriver.java
│   │       ├── ImplementationTests.java
│   │       ├── LabeledEdgeTest.java
│   │       ├── ScriptFileTests.java
│   │       ├── SpecificationTests.java
│   │       ├── emptyGraph.expected
│   │       ├── emptyGraph.test
│   │       ├── exampleTestVariousCases1.expected
│   │       ├── exampleTestVariousCases1.test
│   │       ├── oneNodeGraph.expected
│   │       ├── oneNodeGraph.test
│   │       ├── oneNodeReflexiveEdgeGraph.expected
│   │       ├── oneNodeReflexiveEdgeGraph.test
│   │       ├── twoNodesCompleteGraph.expected
│   │       ├── twoNodesCompleteGraph.test
│   │       ├── twoNodesGraph.expected
│   │       ├── twoNodesGraph.test
│   │       ├── twoNodesGraphAlphabetical.expected
│   │       ├── twoNodesGraphAlphabetical.test
│   │       ├── twoNodesMultipleEdgesGraph.expected
│   │       ├── twoNodesMultipleEdgesGraph.test
│   │       ├── twoNodesMutipleEdgesGraphAlphabetical.expected
│   │       ├── twoNodesMutipleEdgesGraphAlphabetical.test
│   │       ├── twoNodesTwoEdgesGraph1.expected
│   │       ├── twoNodesTwoEdgesGraph1.test
│   │       ├── twoNodesTwoEdgesGraph2.expected
│   │       └── twoNodesTwoEdgesGraph2.test
│   ├── hw5/
│   │   ├── MarvelParser.java
│   │   ├── MarvelPaths.java
│   │   ├── build.xml
│   │   ├── changes.txt
│   │   ├── data/
│   │   │   ├── empty.tsv
│   │   │   ├── marvel.tsv
│   │   │   ├── oneNodeGraph.tsv
│   │   │   ├── sports.tsv
│   │   │   ├── staffSuperheroes.tsv
│   │   │   ├── threeNodesWithReflexiveEdge.tsv
│   │   │   ├── twoNodesGraph.tsv
│   │   │   └── zoos.tsv
│   │   ├── hw5-comment-key.txt
│   │   ├── required.properties
│   │   └── test/
│   │       ├── HW5TestDriver.java
│   │       ├── ImplementationTests.java
│   │       ├── ScriptFileTests.java
│   │       ├── SpecificationTests.java
│   │       ├── TestMarvelPaths.java
│   │       ├── exampleTestMarvelOneHop.expected
│   │       ├── exampleTestMarvelOneHop.test
│   │       ├── exampleTestParserSmallishGraph.expected
│   │       ├── exampleTestParserSmallishGraph.test
│   │       ├── exampleTestSimpleBFSTwoHops.expected
│   │       ├── exampleTestSimpleBFSTwoHops.test
│   │       ├── testAddingReflexiveEdge.expected
│   │       ├── testAddingReflexiveEdge.test
│   │       ├── testFindPathSportsGraph.expected
│   │       ├── testFindPathSportsGraph.test
│   │       ├── testFindPathZooGraph.expected
│   │       ├── testFindPathZooGraph.test
│   │       ├── testParserAndBFSEmptyGraph.expected
│   │       ├── testParserAndBFSEmptyGraph.test
│   │       ├── testParserAndBFSOneNodeGraph.expected
│   │       ├── testParserAndBFSOneNodeGraph.test
│   │       ├── testParserAndBFSTwoNodesGraph.expected
│   │       ├── testParserAndBFSTwoNodesGraph.test
│   │       ├── testParserSportsGraph.expected
│   │       ├── testParserSportsGraph.test
│   │       ├── testParserZooGraph.expected
│   │       └── testParserZooGraph.test
│   ├── hw6/
│   │   ├── MarvelParser2.java
│   │   ├── MarvelPaths2.java
│   │   ├── build.xml
│   │   ├── data/
│   │   │   ├── empty.tsv
│   │   │   ├── marvel.tsv
│   │   │   ├── oneNodeGraph.tsv
│   │   │   ├── sports.tsv
│   │   │   └── threeNodesTwoEdgesGraph.tsv
│   │   ├── required.properties
│   │   └── test/
│   │       ├── HW6TestDriver.java
│   │       ├── ImplementationTests.java
│   │       ├── ScriptFileTests.java
│   │       ├── SpecificationTests.java
│   │       ├── TestMarvelPaths2.java
│   │       ├── emptyGraph.expected
│   │       ├── emptyGraph.test
│   │       ├── emptyGraphFindPath.expected
│   │       ├── emptyGraphFindPath.test
│   │       ├── exampleFindOnlyPossiblePath.expected
│   │       ├── exampleFindOnlyPossiblePath.test
│   │       ├── exampleMarvelBasicSearch.expected
│   │       ├── exampleMarvelBasicSearch.test
│   │       ├── oneNodeGraph.expected
│   │       ├── oneNodeGraph.test
│   │       ├── oneNodeGraphFindPathOnNonExistingNode.expected
│   │       ├── oneNodeGraphFindPathOnNonExistingNode.test
│   │       ├── oneNodeGraphFindPathOnOnlyNode.expected
│   │       ├── oneNodeGraphFindPathOnOnlyNode.test
│   │       ├── sportsGraphFindPath.expected
│   │       ├── sportsGraphFindPath.test
│   │       ├── threeNodesTwoEdgesGraph.expected
│   │       ├── threeNodesTwoEdgesGraph.test
│   │       ├── threeNodesTwoEdgesGraphFindExistingPath.expected
│   │       ├── threeNodesTwoEdgesGraphFindExistingPath.test
│   │       ├── threeNodesTwoEdgesGraphFindNonExistingPath.expected
│   │       ├── threeNodesTwoEdgesGraphFindNonExistingPath.test
│   │       ├── twoNodesTwoEdgesGraphFindPath.expected
│   │       └── twoNodesTwoEdgesGraphFindPath.test
│   ├── hw7/
│   │   ├── CampusDataParser.java
│   │   ├── CampusRouteFindingModel.java
│   │   ├── CampusRouteFindingTool.java
│   │   ├── Coordinates.java
│   │   ├── build.xml
│   │   ├── mvc.txt
│   │   ├── required.properties
│   │   ├── sample_output.txt
│   │   └── test/
│   │       ├── CampusDataParserTest.java
│   │       ├── CampusRouteFindingModelTest.java
│   │       ├── CoordinatesTest.java
│   │       ├── HW7TestDriver.java
│   │       ├── ImplementationTests.java
│   │       ├── ScriptFileTests.java
│   │       ├── SpecificationTests.java
│   │       ├── campusBuildings.expected
│   │       ├── campusBuildings.test
│   │       ├── echoEmptyLineAndComments.expected
│   │       ├── echoEmptyLineAndComments.test
│   │       ├── exampleBasicFindPath.expected
│   │       ├── exampleBasicFindPath.test
│   │       ├── findRouteWithTwoUnknownBuildings.expected
│   │       ├── findRouteWithTwoUnknownBuildings.test
│   │       ├── findRouteWithUnknownEndingBuilding.expected
│   │       ├── findRouteWithUnknownEndingBuilding.test
│   │       ├── findRouteWithUnknownStartingBuilding.expected
│   │       ├── findRouteWithUnknownStartingBuilding.test
│   │       ├── menuCommand.expected
│   │       ├── menuCommand.test
│   │       ├── quitCommand.expected
│   │       ├── quitCommand.test
│   │       ├── unknownCommands.expected
│   │       └── unknownCommands.test
│   └── hw8/
│       ├── CampusPathsMain.java
│       ├── CampusRouteFindingGUI.java
│       ├── CampusRouteFindingGUIController.java
│       ├── CampusRouteFindingMapView.java
│       ├── answers/
│       │   ├── extra.txt
│       │   └── model-changes.txt
│       ├── build.xml
│       └── required.properties
├── README.md
├── Week 03/
│   └── Section/
│       ├── Circle1.java
│       ├── Circle2.java
│       ├── Circle3.java
│       ├── IntMapUncommented.java
│       ├── IntTreeMapCommented.java
│       └── IntTreeMapUncommented.java
├── Week 07/
│   └── Section/
│       └── generics/
│           ├── ArrayList.java
│           ├── GenericsTest.java
│           ├── SetUtils.java
│           └── TypeBreaker.java
├── Week 09/
│   ├── Section/
│   │   └── section9-src/
│   │       ├── .metadata/
│   │       │   ├── .mylyn/
│   │       │   │   └── .taskListIndex/
│   │       │   │       ├── segments.gen
│   │       │   │       └── segments_1
│   │       │   ├── .plugins/
│   │       │   │   ├── org.eclipse.core.resources/
│   │       │   │   │   ├── .history/
│   │       │   │   │   │   ├── 1b/
│   │       │   │   │   │   │   └── d0b7a658d0c800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 23/
│   │       │   │   │   │   │   └── e08e32b9cfc800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 2f/
│   │       │   │   │   │   │   └── 4083655ed0c800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 4a/
│   │       │   │   │   │   │   └── e0c80c18d0c800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 63/
│   │       │   │   │   │   │   └── e080bc50d0c800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 76/
│   │       │   │   │   │   │   └── 200dca82e2c8001213e1ea49183f8040
│   │       │   │   │   │   ├── 79/
│   │       │   │   │   │   │   └── d02f6190cfc800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 88/
│   │       │   │   │   │   │   └── 203a54fccfc800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 91/
│   │       │   │   │   │   │   └── d0c84cf3cec800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── a3/
│   │       │   │   │   │   │   └── e0c7cda8cfc800121e7fa2deb6ad53cb
│   │       │   │   │   │   └── f9/
│   │       │   │   │   │       └── 607f222ccfc800121e7fa2deb6ad53cb
│   │       │   │   │   ├── .projects/
│   │       │   │   │   │   ├── WeatherReportSolution/
│   │       │   │   │   │   │   ├── .indexes/
│   │       │   │   │   │   │   │   ├── af/
│   │       │   │   │   │   │   │   │   └── history.index
│   │       │   │   │   │   │   │   └── e4/
│   │       │   │   │   │   │   │       └── history.index
│   │       │   │   │   │   │   └── .markers
│   │       │   │   │   │   └── WeatherReportStarter/
│   │       │   │   │   │       ├── .indexes/
│   │       │   │   │   │       │   ├── af/
│   │       │   │   │   │       │   │   └── history.index
│   │       │   │   │   │       │   └── e4/
│   │       │   │   │   │       │       └── history.index
│   │       │   │   │   │       └── .markers
│   │       │   │   │   ├── .root/
│   │       │   │   │   │   ├── .indexes/
│   │       │   │   │   │   │   ├── history.version
│   │       │   │   │   │   │   ├── properties.index
│   │       │   │   │   │   │   └── properties.version
│   │       │   │   │   │   └── 4.tree
│   │       │   │   │   └── .safetable/
│   │       │   │   │       └── org.eclipse.core.resources
│   │       │   │   ├── org.eclipse.core.runtime/
│   │       │   │   │   └── .settings/
│   │       │   │   │       ├── com.collabnet.subversion.merge.prefs
│   │       │   │   │       ├── org.eclipse.core.resources.prefs
│   │       │   │   │       ├── org.eclipse.debug.ui.prefs
│   │       │   │   │       ├── org.eclipse.jdt.core.prefs
│   │       │   │   │       ├── org.eclipse.jdt.debug.ui.prefs
│   │       │   │   │       ├── org.eclipse.jdt.launching.prefs
│   │       │   │   │       ├── org.eclipse.jdt.ui.prefs
│   │       │   │   │       ├── org.eclipse.m2e.discovery.prefs
│   │       │   │   │       ├── org.eclipse.mylyn.context.core.prefs
│   │       │   │   │       ├── org.eclipse.mylyn.monitor.ui.prefs
│   │       │   │   │       ├── org.eclipse.team.cvs.ui.prefs
│   │       │   │   │       ├── org.eclipse.team.ui.prefs
│   │       │   │   │       ├── org.eclipse.ui.editors.prefs
│   │       │   │   │       ├── org.eclipse.ui.ide.prefs
│   │       │   │   │       ├── org.eclipse.ui.prefs
│   │       │   │   │       ├── org.eclipse.ui.workbench.prefs
│   │       │   │   │       ├── org.tigris.subversion.subclipse.tools.usage.prefs
│   │       │   │   │       └── org.tigris.subversion.subclipse.ui.prefs
│   │       │   │   ├── org.eclipse.debug.core/
│   │       │   │   │   └── .launches/
│   │       │   │   │       ├── WeatherReportMain (1).launch
│   │       │   │   │       └── WeatherReportMain.launch
│   │       │   │   ├── org.eclipse.debug.ui/
│   │       │   │   │   ├── dialog_settings.xml
│   │       │   │   │   └── launchConfigurationHistory.xml
│   │       │   │   ├── org.eclipse.e4.workbench/
│   │       │   │   │   └── workbench.xmi
│   │       │   │   ├── org.eclipse.jdt.core/
│   │       │   │   │   ├── 1115467115.index
│   │       │   │   │   ├── 1299022128.index
│   │       │   │   │   ├── 1498219845.index
│   │       │   │   │   ├── 163172794.index
│   │       │   │   │   ├── 1686896964.index
│   │       │   │   │   ├── 1697886153.index
│   │       │   │   │   ├── 1995173708.index
│   │       │   │   │   ├── 2496411864.index
│   │       │   │   │   ├── 305854171.index
│   │       │   │   │   ├── 3065916431.index
│   │       │   │   │   ├── 30765161.index
│   │       │   │   │   ├── 3133528496.index
│   │       │   │   │   ├── 3974580528.index
│   │       │   │   │   ├── 4041092966.index
│   │       │   │   │   ├── 4108727661.index
│   │       │   │   │   ├── 4155206848.index
│   │       │   │   │   ├── externalLibsTimeStamps
│   │       │   │   │   ├── invalidArchivesCache
│   │       │   │   │   ├── javaLikeNames.txt
│   │       │   │   │   ├── nonChainingJarsCache
│   │       │   │   │   └── savedIndexNames.txt
│   │       │   │   ├── org.eclipse.jdt.launching/
│   │       │   │   │   ├── .install.xml
│   │       │   │   │   └── libraryInfos.xml
│   │       │   │   ├── org.eclipse.jdt.ui/
│   │       │   │   │   ├── OpenTypeHistory.xml
│   │       │   │   │   ├── QualifiedTypeNameHistory.xml
│   │       │   │   │   └── dialog_settings.xml
│   │       │   │   ├── org.eclipse.m2e.logback.configuration/
│   │       │   │   │   ├── 0.log
│   │       │   │   │   └── logback.1.2.0.20120903-1050.xml
│   │       │   │   ├── org.eclipse.pde.core/
│   │       │   │   │   └── .cache/
│   │       │   │   │       └── clean-cache.properties
│   │       │   │   ├── org.eclipse.ui.ide/
│   │       │   │   │   └── dialog_settings.xml
│   │       │   │   ├── org.eclipse.ui.intro/
│   │       │   │   │   └── dialog_settings.xml
│   │       │   │   ├── org.eclipse.ui.workbench/
│   │       │   │   │   ├── dialog_settings.xml
│   │       │   │   │   ├── workbench.xml
│   │       │   │   │   └── workingsets.xml
│   │       │   │   └── org.eclipse.wb.discovery.core/
│   │       │   │       └── toolkits.xml
│   │       │   └── version.ini
│   │       ├── WeatherReportSolution/
│   │       │   ├── .classpath
│   │       │   ├── .project
│   │       │   ├── .settings/
│   │       │   │   └── org.eclipse.jdt.core.prefs
│   │       │   └── src/
│   │       │       ├── Thermometer.java
│   │       │       ├── WeatherIcon.java
│   │       │       ├── WeatherPanel.java
│   │       │       ├── WeatherReportGUI.java
│   │       │       ├── WeatherReportMain.java
│   │       │       └── WeatherReportModel.java
│   │       ├── WeatherReportStarter/
│   │       │   ├── .classpath
│   │       │   ├── .project
│   │       │   ├── .settings/
│   │       │   │   └── org.eclipse.jdt.core.prefs
│   │       │   └── src/
│   │       │       ├── Thermometer.java
│   │       │       ├── WeatherIcon.java
│   │       │       ├── WeatherPanel.java
│   │       │       ├── WeatherReportGUI.java
│   │       │       ├── WeatherReportMain.java
│   │       │       └── WeatherReportModel.java
│   │       └── images/
│   │           ├── license.txt
│   │           └── license.txt~
│   ├── lect23-graphics-code/
│   │   ├── .htaccess
│   │   ├── Face.java
│   │   ├── FaceMain.java
│   │   ├── SimpleFrameMain.java
│   │   ├── SimpleLayoutMain.java
│   │   └── SimplePaintMain.java
│   └── lect24-events-code/
│       ├── .htaccess
│       ├── ButtonDemo1.java
│       ├── ButtonDemo2.java
│       └── ballsim/
│           ├── Ball.java
│           ├── BallGraphicsView.java
│           ├── BallSimControl.java
│           ├── BallSimMain.java
│           ├── SimModel.java
│           ├── SimThing.java
│           └── SimView.java
└── lecture3-Abstraction_by_Specification.ppt

================================================
FILE CONTENTS
================================================

================================================
FILE: HW/hw0/Adder.java
================================================
package hw0;

import java.util.Scanner;

/**
 * Adder asks the user for two ints and computes their sum.
 * 
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
public class Adder {

    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        System.out.print("Enter first number: ");
        int x = console.nextInt();
        System.out.print("Enter second number: ");
        int y = console.nextInt();
        int sum = computeSum(x, y);
        System.out.println(x + " + " + y + " = " + sum);
    }

    /**
     * 
     * @param x First number to sum.
     * @param y Second number to sum.
     * @return sum of x and y.
     */
    public static int computeSum(int x, int y) {
        return x - y;
    }
}


================================================
FILE: HW/hw0/Ball.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0;

/**
 * This is a simple object that has a volume.
 * 
 * @author Chun-Wei Chen
 * @version 04/01/13
 */
// You may not make Ball implement the Comparable interface.
public class Ball {

    private double volume;

    /**
     * Constructor that creates a new ball object with the specified volume.
     * @param volume Volume of the new object.
     */
    public Ball(double volume) {
        this.volume = volume;
    }

    /**
     * Returns the volume of the Ball.
     * @return the volume of the Ball.
     */
    public double getVolume() {
        return volume;
    }

}


================================================
FILE: HW/hw0/BallContainer.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0;

import java.lang.Iterable;
import java.util.Set;
import java.util.LinkedHashSet;
import java.util.Iterator;
import java.util.Collections;

/**
 * This is a container can be used to contain Balls.
 * A given Ball may only appear in a BallContainer once.
 * 
 * @author Chun-Wei Chen
 * @version 04/05/13
 */
public class BallContainer implements Iterable<Ball> {

    // Contents of the BallContainer.
    private Set<Ball> contents;
    private double totatVolume;  // Total volume of balls in the BallContainer.
    private int size;  // Number of balls in the BallContainer.

    /**
     * Constructor that creates a new ballcontainer.
     */
    public BallContainer() {
        contents = new LinkedHashSet<Ball>();
        totatVolume = 0;
        size = 0;
    }

    /**
     * Implements the Iterable interface for this container.
     * @return an Iterator over the Ball objects contained
     * in this container.
     */
    public Iterator<Ball> iterator() {
        // If we just returned the iterator of "contents", a client
        // could call the remove() method on the iterator and modify
        // it behind our backs.  Instead, we wrap contents in an
        // "unmodifiable set"; calling remove() on this iterator
        // throws an exception.  This is an example of avoiding
        // "representation exposure."  You will learn more about this
        // concept later in the course.
        return Collections.unmodifiableSet(contents).iterator();
    }

    /**
     * Adds a ball to the container. This method returns <tt>true</tt>
     * if ball was successfully added to the container, i.e. ball is
     * not already in the container. Of course, you are allowed to put
     * a Ball into a container only once. Hence, this method returns
     * <tt>false</tt>, if ball is already in the container.
     * @param b Ball to be added.
     * @return true if ball was successfully added to the container,
     * i.e. ball is not already in the container. Returns false, if ball is
     * already in the container.
     */
    public boolean add(Ball b) {
    	if (contents.contains(b)) {
    		return false;
    	} else {
    		totatVolume += b.getVolume();
    		size++;
    		return contents.add(b);
    	}
    }

    /**
     * Removes a ball from the container. This method returns
     * <tt>true</tt> if ball was successfully removed from the
     * container, i.e. ball is actually in the container. You cannot
     * remove a Ball if it is not already in the container and so this
     * method will return <tt>false</tt>, otherwise.
     * @param b Ball to be removed.
     * @return true if ball was successfully removed from the container,
     * i.e. ball is actually in the container. Returns false, if ball is not
     * in the container.
     */
    public boolean remove(Ball b) {
    	if (!contents.contains(b)) {
    		return false;
    	} else {
    		totatVolume -= b.getVolume();
    		size--;
    		return contents.remove(b);
    	}
    }

    /**
     * Each Ball has a volume. This method returns the total volume of
     * all the Balls in the container.
     * @return the volume of the contents of the container.
     */
    public double getVolume() {
    	return totatVolume;
    }

    /**
     * Returns the number of Balls in this container.
     * @return the number of Balls in this container.
     */
    public int size() {
        return size;
    }

    /**
     * Empties the container, i.e. removes all its contents.
     */
    public void clear() {
    	contents.clear();
    	totatVolume = 0;
    	size = 0;
    }

    /**
     * This method returns <tt>true</tt> if this container contains
     * the specified Ball. It will return <tt>false</tt> otherwise.
     * @param b Ball to be checked if its in container
     * @return true if this container contains the specified Ball. Returns
     * false, otherwise.
     */
    public boolean contains(Ball b) {
    	Iterator<Ball> it = contents.iterator();
    	while (it.hasNext()) {
    		Ball temp = it.next();
    		if (temp.equals(b)) 
    			return true;
    	}
    	return false;
    }

}


================================================
FILE: HW/hw0/Box.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0;

import java.lang.Iterable;
import java.util.Comparator;
import java.util.Iterator;
import java.util.TreeSet;

/**
 * This is a container can be used to contain Balls. The key
 * difference between a BallContainer and a Box is that a Box has a
 * finite volume. Once a box is full, a client cannot put in more Balls.
 * 
 * @author Chun-Wei Chen
 * @version 04/02/13
 */
public class Box implements Iterable<Ball> {

    /**
     * ballContainer is used to internally store balls for this Box
     */
    private BallContainer ballContainer;
    /**
     * Total volume of balls that this box can contain
     */
    private double maxVolume;

    /**
     * Constructor that creates a new box.
     * @param maxVolume Total volume of balls that this box can contain.
     */
    public Box(double maxVolume) {
    	ballContainer = new BallContainer();
    	this.maxVolume = maxVolume;
    }

    /**
     * Implements the Iterable interface for this box.
     * @return an Iterator over the Ball objects contained
     * in this box.
     */
    public Iterator<Ball> iterator() {
        return ballContainer.iterator();
    }


    /**
     * This method is used to add Ball objects to this box of
     * finite volume.  The method returns true if a ball is
     * successfully added to the box, i.e., ball is not already in the
     * box and if the box is not already full; and it returns false,
     * if ball is already in the box or if the box is too full to
     * contain the new ball.
     * @param b Ball to be added.
     * @return true if ball was successfully added to the box,
     * i.e. ball is not already in the box and if the box is not
     * already full. Returns false, if ball is already in the box or
     * if the box is too full to contain the new ball.
     */
    public boolean add(Ball b) {
    	if (getVolume() + b.getVolume() > maxVolume || contains(b)) {
    		return false;
    	} else {
    		return ballContainer.add(b);
    	}
    }

    /**
     * This method returns an iterator that returns all the balls in
     * this box in ascending size, i.e., return the smallest Ball
     * first, followed by Balls of increasing size.
     * @return an iterator that returns all the balls in this box in
     * ascending size.
     */
    public Iterator<Ball> getBallsFromSmallest() {
        TreeSet<Ball> t = new TreeSet<Ball>(new ballComparator());
        Iterator<Ball> it = iterator();
        while (it.hasNext())
        	t.add(it.next());
        return t.iterator();
    }

    /**
     * Removes a ball from the box. This method returns
     * <tt>true</tt> if ball was successfully removed from the
     * container, i.e. ball is actually in the box. You cannot
     * remove a Ball if it is not already in the box and so ths
     * method will return <tt>false</tt>, otherwise.
     * @param b Ball to be removed.
     * @return true if ball was successfully removed from the box,
     * i.e. ball is actually in the box. Returns false, if ball is not
     * in the box.
     */
    public boolean remove(Ball b) {
        return ballContainer.remove(b);
    }

    /**
     * Each Ball has a volume. This method returns the total volume of
     * all the Balls in the box.
     * @return the volume of the contents of the box.
     */
    public double getVolume() {
       return ballContainer.getVolume();
    }

    /**
     * Returns the number of Balls in this box.
     * @return the number of Balls in this box.
     */
    public int size() {
        return ballContainer.size();
    }

    /**
     * Empties the box, i.e. removes all its contents.
     */
    public void clear() {
        ballContainer.clear();
    }

    /**
     * This method returns <tt>true</tt> if this box contains
     * the specified Ball. It will return <tt>false</tt> otherwise.
     * @param b Ball to be checked if its in box
     * @return true if this box contains the specified Ball. Returns
     * false, otherwise.
     */
    public boolean contains(Ball b) {
        return ballContainer.contains(b);
    }
    
    /**
     * Inner ballComparator class to compare two balls 
     * and make them in ascending order based on their volumes.
     */
    public class ballComparator implements Comparator<Ball> {
		/**
		 * Compares two ball's volumes for order. 
		 * Returns a negative integer, zero, or 
		 * a positive integer as the first argument 
		 * is less than, equal to, or greater than the second.
		 * 
		 * @param b1 first ball
		 * @param b2 second ball
		 * @return negative integer zero, or a positive integer as the 
		 * first argument is less than, equal to, or greater than the second.
		 */
		public int compare(Ball b1, Ball b2) {
			return Double.compare(b1.getVolume(), b2.getVolume());
		}
    }

}


================================================
FILE: HW/hw0/Fibonacci.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0;

/**
 * Fibonacci calculates the <var>n</var>th term in the Fibonacci sequence.
 *
 * The first two terms of the Fibonacci sequence are both 1,
 * and each subsequent term is the sum of the previous two terms.
 *
 * @author Chun-Wei Chen
 * @version 04/01/13
 */
public class Fibonacci {

    /**
     * Calculates the desired term in the Fibonacci sequence.
     *
     * @param n the index of the desired term; the first index of the sequence is 0
     * @return the <var>n</var>th term in the Fibonacci sequence
     * @throws IllegalArgumentException if <code>n</code> is not a nonnegative number
     */
    public int getFibTerm(int n) {
        if (n < 0) {
            throw new IllegalArgumentException(n + " is negative");
        } else if (n < 2) {
            return 1;
        } else {
            return getFibTerm(n - 1) + getFibTerm(n - 2);
        }
    }

}


================================================
FILE: HW/hw0/HelloWorld.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0;

/**
 * HelloWorld is an implementation of the token
 * introductory "Hello World" program.
 *
 * HelloWorld is also the superclass for other classes in this package.
 */
public class HelloWorld {

    /** the greeting to display when this getGreeting() is invoked */
    public static final String GREETING = "Hello World!";

    /**
     * @effects prints the string "Hello World!" to the console
     */
    public static void main(String[] args) {
        HelloWorld myFirstHW = new HelloWorld();
        System.out.println(myFirstHW.getGreeting());
    }

    /**
     @return Returns a greeting (in English).
     */
    public String getGreeting() {
        return GREETING;
    }

}


================================================
FILE: HW/hw0/HolaWorld.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0;

/**
 * HolaWorld is like HelloWorld except it can say hello in Spanish!
 * 
 * @author Chun-Wei Chen
 * @version 04/01/13
 */
public class HolaWorld extends HelloWorld {

    /** Greeting in Spanish */
    public static final String SPANISH_GREETING = "Hola Mundo!";

    /**
     * Shows what happens when the getGreeting() method
     * of both HelloWorld and HolaWorld are invoked
     */
    public static void main(String[] argv) {

        // Create the Hello World objects.
        HelloWorld myFirstHW = new HelloWorld();
        HolaWorld world = new HolaWorld();

        // Print out greetings
        System.out.println(myFirstHW.getGreeting());
        System.out.println(world.getGreeting());
    }

    /**
     @return Returns a greeting (in Spanish).
     */
    public String getGreeting() {
        return SPANISH_GREETING;
    }

}


================================================
FILE: HW/hw0/RandomHello.java
================================================
package hw0;
/** 
 * Import the class Random.
 */
import java.util.Random;

/**
 * RandomHello selects a random greeting to display to the user.
 * 
 * @author Chun-Wei Chen
 * @version 04/01/13
 */
public class RandomHello {

	/**
     * Uses a RandomHello object to print
     * a random greeting to the console.
     */
	public static void main(String[] args) {
		RandomHello randomHello = new RandomHello();
        System.out.println(randomHello.getGreeting());
	}

	/**
     * @return a random greeting from a list of five different greetings.
     */
    public String getGreeting() {
    	Random randomGenerator = new Random();
    	String[] greetings = new String[5];
    	greetings[0] = "Hello World";
    	greetings[1] = "Hola Mundo";
    	greetings[2] = "Ciao Mondo";
    	greetings[3] = "Bonjour Monde";
    	greetings[4] = "Hallo Welt";
    	return greetings[randomGenerator.nextInt(5)];
    }
}


================================================
FILE: HW/hw0/answers/problem6.txt
================================================
Chun-Wei Chen
CSE 331
04/01/13

1. Input 0 to getFibTerm method is expected to return 1, but it throws exception. I changed the condition for the if block to "n < 0" and also changed the condition for the else if block to "n < 2" to fix the problem.
2. Same as the problem in question 1. Input 0 to getFibTerm method is expected to return 1, but it throws exception.
3. The expected Fibonacci term for input 2 is 2, but the actual output for input 2 is 0. I changed the the return statement in the else block to "getFibTerm(n - 1) + getFibTerm(n - 2)" to fix it.

================================================
FILE: HW/hw0/answers/problem7.txt
================================================
Chun-Wei Chen
CSE 331
04/02/13

a. In the constructor, it assign the formal parameter (volume) to the formal parameter itself instead of assigning the formal parameter passed in to the instance variable. I changed the statement in the constructor into "this.volume = volume;" to fix it. Another problem is that the instance variable volume is never used and the getVolume returns 0 instead of returning the value stored in the instance variable; therefore, I changed the return statement in getVolume method into "return volume;"
b. Keeping track of the total volume of the Balls in BallContainer is better since the program doesn't need to go through every element in the BallContainer in order to get the total volume. For instance, if the BallContainer contains 100000 balls, keeping track of the total volume can return the volume instantly when calling getVolume while the other approach needs to go through all the 100000 balls in the BallContainer to get the answer.
c. 
	1. I used TreeSet with additional comparator for ball to implement getBallsFromSmallest since TreeSet in Java library has iterator method that returns an iterator over the elements in this set in ascending order based on the comparator provided to the TreeSet. Another way I come up with is to use a TreeSet as an instance variable to hold the balls along with the BallContainer; in other words, add method adds a ball into both BallContainer and TreeSet, remove method removes a ball from both BallContainer and TreeSet, and clear method removes all the balls from both BallContainer and TreeSet. This approach allows getBallsFromSmallest to return an iterator directly instead of add all the balls into a TreeSet and then return the iterator. 
	2. getBallsFromSmallest is probably not called as often as other method that modifies the BallContainer and using another collection to hold balls cost space twice as only using BallContainer to store balls; therefore, I think the first approach I mentioned above is better.

================================================
FILE: HW/hw0/build.xml
================================================
<!--Minimal ant build file that needs to be created per pset.  You
 mostly just have to use this as an example, and modify the project
 name, and the also.compile property to be a comma-separated list of
 other psets to compile in the shown fashion. -->

<project name = "hw0" basedir = "../">
  <property name = "hwname" value = "${ant.project.name}"/>
  <property name = "hw" location = "${hwname}"/>
  <property name = "checker.force" value = "false"/>
  <!-- disable nullness checker -->
  <property name = "checker.disabled" value="true"/>
  <import file="${basedir}/common.xml"/>
</project>


================================================
FILE: HW/hw0/hw0-comments.txt
================================================
====================================
A note about efficiency
====================================

When we ask about different implementations, don't only think of computation 
time (aka runtime efficiency), also think about human time. Often, one 
implementation may be faster but it is not worth implementing because it 
will take longer and be harder to maintain and debug. Computers double in speed every 18 months, humans don't.

So a general rule of thumb for this class is to never make a design decision which makes your code significantly more complicated or redundant for the sole purpose of improving run-time performance.


====================================
General Style
====================================

FOR
Favor for-each loops over for loops or iterator while loops; they make your 
code cleaner and more readable.

TODO
You should remove placeholder comments like // TODO: implement from the 
code you turn in. 

BOOL_ZEN
Consider the following if statement:

if (ballContainer.contains(b)){
   return true;
} else {
   return false;
}

This should be simplified, using boolean zen, to:

return ballContainer.contains(b);

DECL
Declare objects with their interface type e.g.:

List<String> foo = new ArrayList<String>();


====================================
Problem 4
====================================

CONST
In RandomHello, if you used an array or list to store your greetings, it is
redundant to call r.nextInt(5). Instead, call r.nextInt(greetingList.size()).
This way, if the size of the list changes your code will continue to work.


====================================
Problem 6
====================================

FIB_BUGS
testThrowsIllegalArgumentException and testBaseCase both fail due to the 
same bug (on line 24). testInductiveCase fails due to two bugs (line 26 and 
29).


====================================
Problem 7a
====================================

THIS
Some students solved the volume naming collision by changing the
name of the parameter. We gave full credit for this, but it is better style
to prefix the field with this i.e. this.volume = volume;.


====================================
Problem 7c
====================================

D_CTOR
Many students implemented a Ball Comparator that used multiple if branches 
to determine what to return. A better implementation uses the Double 
Comparator provided by Java:

public int Compare(Ball b1, Ball b2) {
   return Double.compare
}

IMPL_DIFF
The assignment asked you to come up with two different implementations that 
differed in their implementation of Box. As the assignment says, specifying 
two different ways to sort the Balls does not satisfy this requirement.

Putting multiple Balls into a data structure such as a PriorityQueue and 
then removing them is actually just another type of sort called a heap sort.

An example of a correct answer on this question would be:

1. Use an auxilliary collection to sort the balls as soon as they are added to the Box.
2. Sort the balls when getBallsFromSmallest() is called.

IMPL_BEST
Part of the assignment was to explain which implementation approach to 
Box.getBallsFromSmallest() you thought was better and why.  Ideally, we were 
looking for a discussion of runtime and/or space performance, but an 
acceptable answer was one that made it obvious you thought about the trade 
offs between your two proposed approaches.

HEAPSORT
Adding items to a priority queue and then removing them is actually another 
type of sort called a heapsort.

TREE
Be very careful when using Comparable or Comparator with TreeSet (or 
TreeMap). To sort Balls in getBallsFromSmallest(), many students usded an 
implementation of Comparator<Ball> in conjunction with TreeSet<Ball>. The 
problem with this is that TreeSet, like Set, does not allow the same element 
to be inserted more than once. Furthermore, TreeSets use the 
Comparator.compare() method provided to them to decide if two elements are 
in fact the same (instead of using equals()); if Comparator.compare() 
returns 0, then the elements are considered the same. Therefore, if you 
attempt to place two different Balls of the SAME volume in a TreeSet, only 
one will be added because CompareBalls.compare() returns 0 for same-sized 
balls.

COMP
A comparator should (almost) always return 0 when given two equal values. 
The implementation of Comparable<Ball> used by Box does not satisfy the 
specification for Comparable, and is used to break the set property of a 
TreeSet (by allowing the insertion of duplicates). You might consider using 
a List and Collections.sort instead, or otherwise keeping track of the 
number of duplicated Balls that have been inserted into the TreeSet.

TRUNC
Remember that doubles get truncated when cast to ints. This caused a subtle 
bug in a number of students' BallComparator where there was a line like:

    return (int) (b1.getVolume() - b2.getVolume());

If the difference is between -1 and 1, it is cast to 0. This causes the 
Comparator to incorrectly claim that two Balls with volumes of, say, 1.4 and 
1.5 have equal volume. A few resourceful students implemented compare() 
correctly in one short, beautiful line using a static method in Double. Try 
to find it in for yourself in the Java API (linked above).

SORT_LIST
A number of students opted to use a Collection of Balls in addition to 
BallContainer in their Box implementation. Although this is duplicating 
information (because you have to manage two sets of the same Ball 
information), we accepted the rationale that this approach improves 
efficiency. However, in order to see the efficiency benefits of this method, 
Box must sort the Collection immediately when a new Ball is added. If the 
auxilliary Ball Collection is sorted during getBallsFromSmallest() anyway, 
you are left with duplicate data that does not provide any speedup.


================================================
FILE: HW/hw0/optional/Card.java
================================================
package hw0.optional;

/**
 * Card is a class representing single playing card consisting of a value and a
 * suit (e.g. [Ace,Spades],[10,Clubs]). Cards are immutable; once a Card has
 * been created with a given value and suit, that value and suit cannot be
 * changed.
 */
public class Card implements Comparable<Card> {

    // AF(c) = c represents a playing card with value of c.value and a
    // suit of c.suit (e.g. Ace of Spades, 10 of Clubs)

    // RI(c) = c.value != null && c.suit != null

    //
    // MEMBER VARIABLES
    //

    // the member variables are declared to be final because this class
    // is immutable.

    /**
     * The value of this card.
     */
    private final CardValue value;

    /**
     * The suit of this card.
     */
    private final CardSuit suit;

    //
    // METHODS
    //

    // -------------------------------------------
    /**
     * Creates a new playing card.
     *
     * @param aValue
     *            the value of this card
     * @param aSuit
     *            the suit of this card
     *
     * @modifies this
     * @effects creates a new <code>Card</code> object
     */
    public Card(CardValue aValue, CardSuit aSuit) {
        this.value = aValue;
        this.suit = aSuit;
    }

    // -------------------------------------------
    /**
     * @effects returns the <code>CardSuit</code> associated with this card
     */
    public CardSuit getSuit() {
        return this.suit;
    }

    // -------------------------------------------
    /**
     * @effects returns the <code>CardValue</code> associated with this card
     */
    public CardValue getValue() {
        return this.value;
    }

    // -------------------------------------------
    /**
     * Compares this card with the specified card for order. The purpose of
     * being able to compare cards is to be able to sort a hand of cards.
     * <p>
     * Cards are ranked primarily by number, secondarily by suit. That means
     * that this card is ranked lower than another card if one of these
     * conditions is met:
     * <ul>
     * <li>This card's face value is less than the other card's face value; or
     * <li>Both cards' face values are equal, but this card's suit is ranked
     * lower than the other card's suit.
     * </ul>
     *
     * EXAMPLE: [Ace,Clubs] is ranked higher than [10,Spades] because face value
     * is higher, but is ranked lower than [Ace,Spades] because its suit is
     * ranked lower.
     *
     * @param c
     *            the Card to be compared
     * @exception ClassCastException
     *                if the specified object's type is not Card
     * @exception NullPointerException
     *                if the specified object is null
     *
     * @effects
     * <ul>
     * <li>If <code>o</code> is not an instance of Card, throws a
     * <code>ClassCastException</code></li>
     * <li>If <code>o</code> is null, throws a
     * <code>NullPointerException</code></li>
     * <li>Returns a negative integer, zero, or a positive integer if this
     * <code>Card</code> is less than, equal to, or greater than the specified
     * <code>Card</code>, respectively</li>
     * </ul>
     */
    public int compareTo(Card c) {
        if (c == null) {
            throw new NullPointerException();
        }
        // cast the Object o to a Card now that we've check to make sure it
        // is one!

        if (this.value.equals(c.value)) {
            return this.suit.compareTo(c.suit);
        } else {
            return this.value.compareTo(c.value);
        }
    }

    // -------------------------------------------
    /**
     * Returns true if this card is equal to the other card. Two cards are equal
     * if both their values and suits are identical.
     *
     * @param otherCardObject
     *            the other card
     *
     * @effects returns true if both cards are equal; in all other cases,
     *          returns false
     */
    public boolean equals(/*@Nullable*/ Object otherCardObject) {
        if (!(otherCardObject instanceof Card)) {
            return false;
        }
        return hashCode() == ((Card) otherCardObject).hashCode();
    }

    // -------------------------------------------
    /**
     * Returns a hashcode for this object. This hashcode is the same for all
     * Cards equal to this one (as indicated by the equals method). Note that it
     * is good practice to override the hashCode method when redefining the
     * equals method.
     *
     * @effects returns a hashcode for this object; invoking this methods on two
     *          equal Cards results in the same hashcode
     */
    public int hashCode() {
        int suitMultiplier = suit.ordinal();
        int valueInt = value.ordinal() + 1;
        return ((suitMultiplier * 13) + valueInt);
    }

    // -------------------------------------------
    /**
     * @effects returns a description of this card
     */
    public String toString() {
        return (value.toString() + " of " + suit.toString());
    }

}


================================================
FILE: HW/hw0/optional/CardSuit.java
================================================
package hw0.optional;


/**
 * Represents one of the four suits (Hearts, Spades, Diamonds, Clubs) that appear
 * on a playing card.  This class is immutable.
 */
public enum CardSuit {

    // The 4 acceptable card suits, in ascending order.

    /**
     * The suit of clubs.
     */
    CLUBS,

    /**
     * The suit of diamonds.
     */
    DIAMONDS,


    /**
     * The suit of hearts.
     */
    HEARTS,

    /**
     * The suit of spades.
     */
    SPADES;

}


================================================
FILE: HW/hw0/optional/CardValue.java
================================================
package hw0.optional;


/**
 * Represents one of 13 values (2-10, Jack, Queen, King, Ace) that appear
 * on a playing card. This class is immutable.
 */
public enum CardValue  {

    //
    // CONSTANTS
    //

    // The 13 acceptable card values.

    /**
     * The card value representing 2.
     */
    TWO("two", "2"),

    /**
     * The card value representing 3.
     */
    THREE("three", "3"),

    /**
     * The card value representing 4.
     */
    FOUR("four", "4"),

    /**
     * The card value representing 5.
     */
    FIVE ("five", "5"),

    /**
     * The card value representing 6.
     */
    SIX ("six", "6"),

    /**
     * The card value representing 7.
     */
    SEVEN ("seven", "7"),

    /**
     * The card value representing 8.
     */
    EIGHT ("eight", "8"),

    /**
     * The card value representing 9.
     */
    NINE("nine", "9"),

    /**
     * The card value representing 10.
     */
    TEN ("ten", "10"),

    /**
     * The card value representing a Jack.
     */
    JACK ("Jack", "J"),

    /**
     * The card value representing a Queen.
     */
    QUEEN("Queen", "Q"),

    /**
     * The card value representing a King.
     */
    KING ("King", "K"),

    /**
     * The card value representing an Ace.
     */
    ACE ("Ace", "A");

    //
    // MEMBER VARIABLES
    //

    /**
     * The name of this card value.
     */
    private String name;

    /**
     * The symbol representing this card value that appears on a playing card.  For
     * the values 2-10, this symbol is simply the digits themselves; for JACK, QUEEN,
     * KING, and ACE values, the symbols are "J", "Q", "K", and "A" respectively.
     */
    private String letterOnCard;

    //
    // METHODS
    //

    //-------------------------------------------
    /**
     * Creates a new card value.
     *
     * @param valueName  the name of this value
     * @param letter     the symbol representing this card value that appears
     *                   on a playing card
     *
     *
     *
     * @modifies this
     * @effects  creates a new <code>CardValue</code> object
     */
    CardValue(String valueName, String letter) {
        name = valueName;
        letterOnCard = letter;
    }

    //-------------------------------------------
    /**
     * Returns the name of this value.
     * <p>
     * The value names can be either "2", "3", ..., "10", "Jack", "Queen", "King", or "Ace".
     *
     *
     * @effects  returns the name of this value
     */
    public String getName() {
        return name;
    }

    //-------------------------------------------
    /**
     * Returns the symbol representing this card value.
     * <p>
     * For the values 2-10, this symbol is simply the digits themselves; for JACK, QUEEN,
     * KING, and ACE values, the symbols are "J", "Q", "K", and "A" respectively.
     *
     *
     * @effects  returns the symbol representing this card value
     */
    public String getLetterOnCard() {
        return letterOnCard;
    }


    //-------------------------------------------
    /**
     * Returns a description of this value.
     *
     *
     * @effects  returns a description of this value
     */
    public String toString() {
        return getName();
    }

}


================================================
FILE: HW/hw0/optional/FinancialCalc.java
================================================
package hw0.optional;

public class FinancialCalc {

    public static void main(String[] args) {
        double principal = 1000.00;    // $1000 initial investment
        double interestRate = 0.035;   // 3.5% interest rate
        int numOfYears = 7;            // investment length is 7 years

        double value = 0.0;
        value = principal * Math.pow((1 + interestRate), numOfYears);

        System.out.println("Investing $" + principal +
                " at an interest rate of " + (interestRate*100) + "%" +
                " for " + numOfYears + " years" +
                " will have a final worth of $" + value);
    }

}


================================================
FILE: HW/hw0/optional/MyHand.java
================================================
package hw0.optional;

import java.util.Collection;
import java.util.LinkedList;

public class MyHand {
    LinkedList<Card> hand;

    MyHand() {
        hand = new LinkedList<Card>();

        hand.add(new Card(CardValue.EIGHT, CardSuit.CLUBS));
        hand.add(new Card(CardValue.TWO, CardSuit.CLUBS));
        hand.add(new Card(CardValue.QUEEN, CardSuit.CLUBS));
        hand.add(new Card(CardValue.NINE, CardSuit.SPADES));
        hand.add(new Card(CardValue.KING, CardSuit.HEARTS));
        hand.add(new Card(CardValue.QUEEN, CardSuit.HEARTS));
        hand.add(new Card(CardValue.SEVEN, CardSuit.HEARTS));
    }

    public static void main(String[] args) {
        MyHand myhand = new MyHand();
        myhand.printHand();
        myhand.sortSmallestToLargest();
        System.out.println("\nAfter sorting from smallest to largest:");
        myhand.printHand();
        myhand.sortLargesttoSmallest();
        System.out.println("\nAfter sorting from largest to smallest:");
        myhand.printHand();
        System.out.println("\nHearts in hand:");
        myhand.printHand_OnlyHearts();
        System.out.println("\nHand after removing faces:");
        myhand.printHand_RemoveFaceCards();
    }

    /**
     * Print the contents of a hand of cards to the screen. [Note:
     * one can also System.out.println to print the contents of
     * arrays]
     */
    public void printHand() {
        // Your code here.
    }

    /**
     * Sorts the cards so that any subsequent calls to printHand
     * will print the Hand from the smallest to the largest.
     */
    public void sortSmallestToLargest() {
        // Your code here.
    }

    /**
     * Sorts the cards so that any subsequent calls to printHand
     * will print the Hand from the largest to the smallest.
     */
    public void sortLargesttoSmallest() {
        // Your code here.
    }

    /**
     * Print only the cards in hand that are hearts
     */
    public void printHand_OnlyHearts() {
        // Your code here.
    }

    /**
     * Print only the cards in hand that are number cards AND remove face cards
     * from hand
     */
    public void printHand_RemoveFaceCards() {
        // Your code here.
    }

}


================================================
FILE: HW/hw0/optional/Point.java
================================================
package hw0.optional;

class Point {

    double x;
    double y;


    // Create a point from coordinates
    Point(double xVal, double yVal) {
        x = xVal;
        y = yVal;
    }

}


================================================
FILE: HW/hw0/optional/Primes.java
================================================
package hw0.optional;

public class Primes {

    private static void findPrimes(int nValues) {
        boolean isPrime = true;

        for (int i = 2; i <= nValues; i++) {
            isPrime = true;

            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime) {
                System.out.println(i);
            }
        }
    }


    private static void findPrimesFaster(int nValues) {
        // PLACE YOUR IMPLEMENTATION HERE
        System.out.println("The method findPrimesFaster has not been implemented");
    }


    private static void findPrimesEvenFaster(int nValues) {
        // PLACE YOUR IMPLEMENTATION HERE
        System.out.println("The method findPrimesEvenFaster has not been implemented");
    }



    public static void main(String[] args) {

        // Find and print all primes between 0 and 50.

        System.out.println("Running method findPrimes:");
        findPrimes(50);

        System.out.println("\nRunning method findPrimesFaster:");
        findPrimesFaster(50);

        System.out.println("\nRunning method findPrimesEvenFaster:");
        findPrimesEvenFaster(50);



        // Time how long it takes to find primes.

        long startTime = 0;
        long endTime = 0;


        System.out.print("\n\nTiming method findPrimes:");
        startTime = System.currentTimeMillis();
        findPrimes(20000);
        endTime = System.currentTimeMillis();
        System.out.println("  " + (endTime-startTime) + " milliseconds");

        System.out.print("\nTiming method findPrimesFaster:");
        startTime = System.currentTimeMillis();
        findPrimesFaster(20000);
        endTime = System.currentTimeMillis();
        System.out.println("  " + (endTime-startTime) + " milliseconds");

        System.out.print("\nTiming method findPrimesEvenFaster:");
        startTime = System.currentTimeMillis();
        findPrimesEvenFaster(20000);
        endTime = System.currentTimeMillis();
        System.out.println("  " + (endTime-startTime) + " milliseconds");


        System.out.print("\n\nTiming method findPrimes:");
        startTime = System.currentTimeMillis();
        findPrimes(50000);
        endTime = System.currentTimeMillis();
        System.out.println("  " + (endTime-startTime) + " milliseconds");

        System.out.print("\nTiming method findPrimesFaster:");
        startTime = System.currentTimeMillis();
        findPrimesFaster(50000);
        endTime = System.currentTimeMillis();
        System.out.println("  " + (endTime-startTime) + " milliseconds");

        System.out.print("\nTiming method findPrimesEvenFaster:");
        startTime = System.currentTimeMillis();
        findPrimesEvenFaster(50000);
        endTime = System.currentTimeMillis();
        System.out.println("  " + (endTime-startTime) + " milliseconds");
    }

}


================================================
FILE: HW/hw0/optional/StringScrambler.java
================================================
package hw0.optional;

public class StringScrambler {

    public String reverseWordOrder(String input) {

        // PLACE YOUR IMPLEMENTATION HERE

        // this line added so skeleton class compiles; remove it.
        return "";
    }


    public static void main(String args[]) {
        StringScrambler scrambler = new StringScrambler();
        String input;
        String output;

        input = "To be or not to be, that is the question.";
        output = scrambler.reverseWordOrder(input);
        System.out.println(output);

        input = "Stressed spelled backwards is Desserts";
        output = scrambler.reverseWordOrder(input);
        System.out.println("\n\n" + output);
    }

}


================================================
FILE: HW/hw0/required.properties
================================================
required.files = HolaWorld.java,RandomHello.java,Fibonacci.java,Ball.java,BallContainer.java,Box.java,answers/problem6.txt,answers/problem7.txt

================================================
FILE: HW/hw0/test/BallContainerTest.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0.test;
import hw0.*;

import java.util.Set;
import java.util.HashSet;

import org.junit.Test;
import org.junit.BeforeClass;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.greaterThan;

/**
 * BallContainerTest is a glassbox test of the BallContainer class.
 *
 * Recall that the BallContainer is a container for Balls. However, you can only
 * put a Ball into a BallContainer once. After you put the Ball into the BallContainer,
 * further attempts to do so will fail, since the Ball is already in
 * the BallContainer! Similarly, you cannot expect to remove a Ball from a BallContainer
 * if it is not inside the BallContainer.
 *
 * @see hw0.Ball
 * @see hw0.BallContainer
 */
public class BallContainerTest {

    private static BallContainer ballcontainer = null;
    private static Ball[] b = null;

    private static final int NUM_BALLS_TO_TEST = 3;
    private static final double BALL_UNIT_VOLUME = 20.0;
    private static final double JUNIT_DOUBLE_DELTA = 0.0001;

    @BeforeClass
    public static void setupForTests() throws Exception {
        assertThat("Test case error, you must test at least 1 Ball!!", NUM_BALLS_TO_TEST, greaterThan(0));
        ballcontainer = new BallContainer();

        // Let's create the balls we need.
        b = new Ball[NUM_BALLS_TO_TEST];
        for (int i=0; i<NUM_BALLS_TO_TEST; i++) {
            b[i] = new Ball((i+1)*BALL_UNIT_VOLUME);
        }
    }


    /** Test to check that BallContainer.add(Ball) is implemented correctly */
    @Test
    public void testAdd() {
        double containerVolume;
        ballcontainer.clear();
        for (int i=0; i<NUM_BALLS_TO_TEST; i++) {
            assertTrue("BallContainer.add(Ball) failed to add a new Ball!", ballcontainer.add(b[i]));
            containerVolume = ballcontainer.getVolume();
            assertFalse("BallContainer.add(Ball) seems to allow the same Ball to be added twice!", ballcontainer.add(b[i]));
            assertEquals("BallContainer's volume has changed, but its contents have not!",
                         containerVolume, ballcontainer.getVolume(),
                         JUNIT_DOUBLE_DELTA);
            assertTrue("BallContainer does not contain a ball after it is supposed to have been added!",
                       ballcontainer.contains(b[i]));
        }
    }

    /** Test to check that BallContainer.remove(Ball) is implemented correctly */
    @Test
    public void testRemove() {
        ballcontainer.clear();
        double containerVolume;
        assertFalse("BallContainer.remove(Ball) should fail because ballcontainer is empty, but it didn't!", ballcontainer.remove(b[0]));
        for (int i=0; i<NUM_BALLS_TO_TEST; i++) {
            ballcontainer.clear();
            for (int j=0; j<i; j++) {
                ballcontainer.add(b[j]);
            }
            for (int j=0; j<i; j++) {
                assertTrue("BallContainer.remove(Ball) failed to remove a Ball that is supposed to be inside",
                           ballcontainer.remove(b[j]));
                containerVolume = ballcontainer.getVolume();
                assertFalse("BallContainer still contains a ball after it is supposed to have been removed!",
                            ballcontainer.contains(b[j]));
                assertEquals("BallContainer's volume has changed, but its contents have not!",
                             containerVolume, ballcontainer.getVolume(),
                             JUNIT_DOUBLE_DELTA);
            }
            for (int j=i; j<NUM_BALLS_TO_TEST; j++) {
                assertFalse("BallContainer.remove(Ball) did not fail for a Ball that is not inside", ballcontainer.remove(b[j]));
            }
        }
    }

    /**
     * Test to check that BallContainer.iterator() is implemented
     * correctly.
     */
    @Test
    public void testIterator() {
        Set<Ball> allBalls = new HashSet<Ball>();
        Set<Ball> seenBalls = new HashSet<Ball>();
        ballcontainer.clear();
        assertEquals("BallContainer is not empty after being cleared!",
                     0, ballcontainer.size());
        for (Ball aBall: b) {
            ballcontainer.add(aBall);
            allBalls.add(aBall);
        }
        int i=0;
        for (Ball aBall: ballcontainer) {
            assertTrue("Iterator returned a ball that isn't in the container: " + aBall,
                       allBalls.contains(aBall));
            assertFalse("Iterator returned the same ball twice: " + aBall,
                        seenBalls.contains(aBall));
            seenBalls.add(aBall);
            i++;
        }
        assertEquals("BallContainer iterator did not return enough items!",
                     i, b.length);
    }

    /**
     * Test that BallContainer.clear() is implemented correctly.
     */
    @Test
    public void testClear() {
        ballcontainer.clear();
        assertEquals("BallContainer is not empty after being cleared!",
                     0, ballcontainer.size());
        ballcontainer.add(b[0]);
        ballcontainer.clear();
        assertEquals("BallContainer is not empty after being cleared!",
                     0, ballcontainer.size());
    }

    /** Test that we can put a Ball into a BallContainer */
    @Test
    public void testVolume() {
        ballcontainer.clear();
        assertEquals("Volume of empty BallContainer is not zero!",
                     0, ballcontainer.getVolume(), JUNIT_DOUBLE_DELTA);
        for (int i=0; i<NUM_BALLS_TO_TEST; i++) {
            ballcontainer.add(b[i]);
            assertEquals("Volume of BallContainer with "+(i+1)+" ball(s)",
                         (i+1)*(i+2)*BALL_UNIT_VOLUME/2,
                         ballcontainer.getVolume(),
                         JUNIT_DOUBLE_DELTA);
        }

    }

    /** Test that size() returns the correct number. */
    @Test
    public void testSize() {
        ballcontainer.clear();
        assertEquals("size() of empty BallContainer is not zero!",
                     0, ballcontainer.size());
        for (int i=0; i<NUM_BALLS_TO_TEST; i++) {
            ballcontainer.add(b[i]);
            assertEquals("size() of BallContainer with "+(i+1)+" ball(s)",
                         i+1, ballcontainer.size());
        }
    }

    /** Test that size() returns the correct number. */
    @Test
    public void testContains() {
        ballcontainer.clear();
        for (int i=0; i<NUM_BALLS_TO_TEST; i++) {
            assertFalse("Empty BallContainer seems to contain a ball!", ballcontainer.contains(b[i]));
        }
        for (int i=0; i<NUM_BALLS_TO_TEST; i++) {
            ballcontainer.add(b[i]);
            assertTrue("BallContainer does not contain a Ball that is supposed to be inside!", ballcontainer.contains(b[i]));
            for (int j=i+1; j<NUM_BALLS_TO_TEST; j++) {
                assertFalse("BallContainer seems to contain a Ball that is not inside!", ballcontainer.contains(b[j]));
            }
        }
    }

    /** Test that clear removes all balls. **/
    @Test
    public void testVolumeAfterClear() {
        ballcontainer.add(b[0]);
        ballcontainer.clear();
        assertEquals("The volume of BallContainer after being cleared is not reset to 0!",
                     0, ballcontainer.getVolume(), JUNIT_DOUBLE_DELTA);
    }

}


================================================
FILE: HW/hw0/test/BallTest.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0.test;
import hw0.*;

import org.junit.Test;
import org.junit.BeforeClass;
import static org.junit.Assert.*;

/**
 * BallTest is a simple glassbox test of the Ball class.
 *
 * @see hw0.Ball
 */
public class BallTest {

    private static Ball b = null;

    private static final double BALL_VOLUME = 20.0;
    private static final double JUNIT_DOUBLE_DELTA = 0.0001;

    @BeforeClass 
    public static void setupBeforeTests() throws Exception {
        b = new Ball(BALL_VOLUME);
    }

    /** Test to see that Ball returns the correct volume when queried. */
    @Test
    public void testVolume() {
        assertEquals("b.getVolume()",
                     BALL_VOLUME, b.getVolume(), JUNIT_DOUBLE_DELTA);
    }

}


================================================
FILE: HW/hw0/test/BoxTest.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0.test;
import hw0.*;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.Random;
import java.util.Set;
import java.util.HashSet;

import org.junit.Test;
import org.junit.BeforeClass;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.greaterThan;

/**
 * BoxTest is a glassbox test of the Box class.
 *
 * Recall that like a BallContainer, the Box is a container for Balls and you
 * can only put a Ball into a Box once. After you put the Ball into
 * the Box, further attempts to do so will fail, since the Ball is
 * already in the Box! Similarly, you cannot expect to remove a Ball
 * from a Box if it is not inside the Box.
 *
 * In addition, a Box differs from a ballcontainer because it only has a finite
 * volume. As Balls get put into a Box, it gets filled up. Once a Box
 * is full, further attempts to put Balls into the Box will also fail.
 *
 * @see hw0.Ball
 * @see hw0.BallContainer
 * @see hw0.Box
 */
public class BoxTest {

    private static Box box = null;
    private static Ball[] b = null;

    private static final int NUM_BALLS_TO_TEST = 5;
    private static final int BOX_CAPACITY = NUM_BALLS_TO_TEST - 1;
    private static final double BALL_UNIT_VOLUME = 10.0;
    private static final double JUNIT_DOUBLE_DELTA = 0.0001;
    private static final int TRIES_FOR_BALLS_TEST = 3;

    @BeforeClass
    public static void setupBeforeTests() throws Exception {
        assertThat("Test case error, you must test at least 1 Ball!!",
                   NUM_BALLS_TO_TEST, greaterThan(0));
        assertThat("This test case is set up assuming that the box cannot contain all the balls, please check and change parameters!",
                   NUM_BALLS_TO_TEST, greaterThan(BOX_CAPACITY));

        double box_volume = 0;

        // Let's create the balls we need.
        b = new Ball[NUM_BALLS_TO_TEST];
        for (int i=0; i<NUM_BALLS_TO_TEST; i++) {
            if (i<BOX_CAPACITY) {
                box_volume += (i+1)*BALL_UNIT_VOLUME;
            }
            b[i] = new Ball((i+1)*BALL_UNIT_VOLUME);
        }

        // Now, we create the box once we figure out how big a box we
        // need.
        box = new Box(box_volume);

    }

    /** Test to check that Box.add(Ball) is implemented correctly */
    @Test
    public void testAdd() {
        box.clear();
        for (int i=0; i<BOX_CAPACITY; i++) {
            assertTrue("Box.add(Ball) failed to add a new Ball!",
                       box.add(b[i]));
            assertFalse("Box.add(Ball) seems to allow the same Ball to be added twice!",
                        box.add(b[i]));
            assertTrue("Box does not contain a ball after it is supposed to have been added!",
                       box.contains(b[i]));
        }
        for (int i=BOX_CAPACITY; i<NUM_BALLS_TO_TEST; i++) {
            assertFalse("Box.add(Ball) allows a Ball to be added even though it is already full!",
                        box.add(b[i]));
        }
    }

    /** Test to check that Box.getBallsFromSmallest() is implemented correctly */
    @Test
    public void testGetBalls() {
        Random rnd = new Random();

        for (int k=0; k<TRIES_FOR_BALLS_TEST; k++) {

            box.clear();

            // Let's put all the balls into a list.
            LinkedList<Ball> list = new LinkedList<Ball>();
            for (int i=0; i<BOX_CAPACITY; i++) {
                list.add(b[i]);
            }

            // First we add the balls to the box in some random order.
            for (int i=0; i<BOX_CAPACITY; i++) {
                box.add(list.remove(rnd.nextInt(list.size())));
            }

            int contentsSize = box.size();
            // Next we call the iterator and check that the balls come out
            // in the correct order.
            Iterator<Ball> it = box.getBallsFromSmallest();
            int count = 0;
            while (it.hasNext() && count < BOX_CAPACITY) {
                Ball ball = it.next();
                assertEquals("Balls are not returned by Box.getBallsFromSmallest() iterator in the correct order",
                             b[count], ball);
                if (b[count] != ball) {
                    break;
                }
                count++;
            }
            assertEquals("Box.getBallsFromSmallest() did not return all the balls",
                         BOX_CAPACITY, count);
            assertEquals("Number of balls in box was modified",
                         contentsSize, box.size());
        }
    }

    /**
     * Test to check that Box.remove(Ball) is implemented
     * correctly. Depending on how <code>getBallsFromSmallest()</code>
     * is implemented, remove() might have to be overridden and this
     * test helps ensure that remove() is not broken in the process.
     */
    @Test
    public void testRemove() {
        box.clear();
        assertFalse("Box.remove(Ball) should fail because box is empty, but it didn't!",
                    box.remove(b[0]));
        for (int i=0; i<BOX_CAPACITY; i++) {
            box.clear();
            for (int j=0; j<i; j++) {
                box.add(b[j]);
            }
            for (int j=0; j<i; j++) {
                assertTrue("Box.remove(Ball) failed to remove a Ball that is supposed to be inside",
                           box.remove(b[j]));
                assertFalse("Box still contains a ball after it is supposed to have been removed!",
                            box.contains(b[j]));
            }
            for (int j=i; j<NUM_BALLS_TO_TEST; j++) {
                assertFalse("Box.remove(Ball) did not fail for a Ball that is not inside",
                            box.remove(b[j]));
            }
        }
    }


    /** Test to check that Box.clear() is implemented correctly */
    @Test
    public void testClear() {
        box.clear();
        assertEquals("Box is not empty after being cleared!", 0, box.size());
        box.add(b[0]);
        box.clear();
        assertEquals("Box is not empty after being cleared!", 0, box.size());
    }

    /** Test to check that check that we can put a Ball into a Box */
    @Test
    public void testVolume() {
        box.clear();
        assertEquals("Volume of empty Box is not zero!",
                     0, box.getVolume(), JUNIT_DOUBLE_DELTA);
        for (int i=0; i<BOX_CAPACITY; i++) {
            box.add(b[i]);
            assertEquals("Volume of Box with one ball",
                         (i+1)*(i+2)*BALL_UNIT_VOLUME/2, box.getVolume(),
                         JUNIT_DOUBLE_DELTA);
        }
    }

    /** Test to check that size() returns the correct number. */
    @Test
    public void testSize() {
        box.clear();
        assertEquals("size() of empty Box is not zero!", 0, box.size());
        for (int i=0; i<BOX_CAPACITY; i++) {
            box.add(b[i]);
            assertEquals("size() of Box with "+(i+1)+" ball(s)",
                         i+1, box.size());
        }
    }

    /** Test to check that size() returns the correct number. */
    @Test
    public void testContains() {
        box.clear();
        for (int i=0; i<BOX_CAPACITY; i++) {
            assertFalse("Empty Box seems to contain a ball!",
                        box.contains(b[i]));
        }
        for (int i=0; i<BOX_CAPACITY; i++) {
            box.add(b[i]);
            assertTrue("Box does not contain a Ball that is supposed to be inside!",
                       box.contains(b[i]));
            for (int j=i+1; j<BOX_CAPACITY; j++) {
                assertFalse("Box seems to contain a Ball that is not inside!",
                            box.contains(b[j]));
            }
        }
    }

    /**
     * Test to check that iterator() is implemented correctly.
     */
    @Test
    public void testIterator() {
        Set<Ball> allBalls = new HashSet<Ball>();
        Set<Ball> seenBalls = new HashSet<Ball>();
        box.clear();
        for (Ball aBall : b) {
            box.add(aBall);
            allBalls.add(aBall);
        }
        int i = 0;
        for (Ball aBall : box) {
            assertTrue("Iterator returned a ball that isn't in the container: " + aBall,
                       allBalls.contains(aBall));
            assertFalse("Iterator returned the same ball twice: " + aBall,
                        seenBalls.contains(aBall));
            seenBalls.add(aBall);
            i++;
        }
        assertEquals("BallContainer iterator did not return enough items!",
                     b.length-1, i);
    }
}


================================================
FILE: HW/hw0/test/FibonacciTest.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0.test;
import hw0.*;

import org.junit.Test;
import org.junit.BeforeClass;
import static org.junit.Assert.*;

/**
 * FibonacciTest is a glassbox test of the Fibonacci class.
 *
 * Recall that the Fibonacci sequence is a recursive
 * sequence where the first two terms of the sequence are 1 and all subsequent
 * terms are the sum of the previous two terms.
 *
 * Thus, the Fibonacci sequence starts out as 1, 1, 2, 3, 5, 8, 13...
 * The first 1 in the sequence is considered the "0th" term,
 * so the indices that <code>hw0.Fibonacci</code> uses are 0-based.
 *
 * @see hw0.Fibonacci
 *
 * @author mbolin
 */
public class FibonacciTest {

    private static Fibonacci fib = null;

    @BeforeClass
    public static void setupBeforeTests() throws Exception {
        fib = new Fibonacci();
    }

    /**
     * Tests that Fibonacci throws an IllegalArgumentException
     * for a negative number.
     */
    @Test(expected=IllegalArgumentException.class)
    public void expectedIllegalArgumentException() {
        fib.getFibTerm(-1);
    }


    /**
     * Tests that Fibonacci throws no IllegalArgumentException
     * for zero or for a positive number.
     */
    @Test
    public void testThrowsIllegalArgumentException() {

        // test 0
        try {
            fib.getFibTerm(0);
        } catch (IllegalArgumentException ex) {
            fail("Threw IllegalArgumentException for 0 but 0 is nonnegative: "
                    + ex);
        }

        // test 1
        try {
            fib.getFibTerm(1);
        } catch (IllegalArgumentException ex) {
            fail("Threw IllegalArgumentException for 1 but 1 is nonnegative: "
                    + ex);
        }
    }

    /** Tests to see that Fibonacci returns the correct value for the base cases, n=0 and n=1 */
    @Test
    public void testBaseCase() {
        assertEquals("getFibTerm(0)", 1, fib.getFibTerm(0));
        assertEquals("getFibTerm(1)", 1, fib.getFibTerm(1));
    }

    /** Tests inductive cases of the Fibonacci sequence */
    @Test
    public void testInductiveCase() {
        int[][] cases = new int[][] {
                { 2, 2 },
                { 3, 3 },
                { 4, 5 },
                { 5, 8 },
                { 6, 13 },
                { 7, 21 }
            };
        for (int i = 0; i < cases.length; i++) {
            assertEquals("getFibTerm(" + cases[i][0] + ")",
                         cases[i][1], fib.getFibTerm(cases[i][0]));
        }
    }

}


================================================
FILE: HW/hw0/test/HolaWorldTest.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0.test;
import static org.junit.Assert.assertEquals;
import hw0.HelloWorld;
import hw0.HolaWorld;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import org.junit.Test;

/**
 * HolaWorldTest is a simple test of the HolaWorld class that you
 * are to fix.  This test just makes sure that the program
 * does not crash and that the correct greeting is printed.
 */
public class HolaWorldTest {

    /**
     * Tests that HolaWorld does not crash
     */
    @Test
    public void testCrash() {
        /* Any exception thrown will be caught by JUnit. */
        HolaWorld.main(new String[0]);
    }

    /**
     * Tests that the HolaWorld greeting is correct.
     */
    @Test
    public void testGreeting() {
        HolaWorld world = new HolaWorld();
        assertEquals(HolaWorld.SPANISH_GREETING, world.getGreeting());
    }

    /**
     * Tests that the output of HolaWorld.main() is correct.
     * @throws FileNotFoundException 
     */
    @Test
    public void testMainOutput() throws FileNotFoundException {
        
        // Needed for windows line endings
        System.setProperty("line.separator", "\n");
        
        // Redirect System.out to an OutputStream
        PrintStream sysoutStream = System.out;
        ByteArrayOutputStream mainOutput = new ByteArrayOutputStream();
        System.setOut(new PrintStream(mainOutput));
        
        HolaWorld.main(new String[0]);
        System.setOut(sysoutStream);

        assertEquals(HelloWorld.GREETING + "\n" + HolaWorld.SPANISH_GREETING + "\n",
                    mainOutput.toString());
    }
}


================================================
FILE: HW/hw0/test/ImplementationTests.java
================================================
package hw0.test;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

/**
 * ImplementationTest is a simple test suite to test the implementation
 * of each homework.  You do not need to modify this file for Homework 0.
*/
@RunWith(Suite.class)
@SuiteClasses({})
public final class ImplementationTests
{
    //this class is a placeholder for the suite, so it has no members.
}


================================================
FILE: HW/hw0/test/RandomHelloTest.java
================================================
/**
 * This is part of HW0: Environment Setup and Java Introduction for CSE 331.
 */
package hw0.test;
import hw0.RandomHello;

import org.junit.Test;
import static org.junit.Assert.*;

import java.util.HashSet;
import java.util.Set;

/**
 * RandomHelloTest is a simple test of the RandomHello class that is
 * to be written by the students. This test just makes sure that the
 * program does not crash and that it prints at least 5 different
 * greetings.
 */
public class RandomHelloTest {

    /** Number of times to run the greeting test until we're quite sure we'd have seen all the greetings */
    private int TIMES_TO_TEST = 1000;

    /** Required number of greetings */
    private int REQUIRED_NUMBER_OF_GREETINGS = 5;

    /**
     * Tests that RandomHello does not crash.
     */
    @Test
    public void testCrash() {
        /* If RandomHello.main() throws an exception, it will
         * propagate outside testCrash() and JUnit will flag
         * an error. */
        RandomHello.main(new String[0]);
    }


    /**
     * Tests that the greetings are indeed random and that there are
     * at least 5 different ones.
     */
    @Test
    public void testGreetings() {
        RandomHello world = new RandomHello();
        Set<String> set = new HashSet<String>();

        for (int i=0; i< TIMES_TO_TEST; i++) {
            String greeting = world.getGreeting();
            if (!set.contains(greeting)) {
                set.add(greeting);
            }
        }
        assertEquals("Wrong number of greetings in RandomHello",
                     REQUIRED_NUMBER_OF_GREETINGS, set.size());
    }


}


================================================
FILE: HW/hw0/test/SpecificationTests.java
================================================
package hw0.test;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

/**
 * SpecificationTests is a simple test suite to test your problem set
 * against the provided specifications.  You do not need to modify this
 * file for Homework 0.
 */
@RunWith(Suite.class)
@SuiteClasses({ FibonacciTest.class,
	        HolaWorldTest.class,
		RandomHelloTest.class,
		BallTest.class,
		BoxTest.class,
	        BallContainerTest.class })

public final class SpecificationTests
{
  // This class is a placeholder for the suite, so it has no members.
}


================================================
FILE: HW/hw2/hw2_answers.txt
================================================
Chun-Wei Chen
CSE 331
Homework 2
04/12/13

Problem 1
{pre: size > 0} 
k = 0; 
max = items[0];
{loop-inv: max = largest in items[0...k]}
while (k+1 != size) {
  {loop-inv: max = largest in items[0...k]}
  if (max < items[k+1]) {
    {max = largest in items[0Kk] ^ max < items[k+1]}
    max = items[k+1];
    {max = largest in items[0...k+1]}
  else {
    // nothing to do 
    {max = largest in items[0...k+1]}
  }
  {max = largest in items[0...k+1]}
  k = k+1;
  {loop-inv: max = largest in items[0...k]}
}
{loop-inv: max = largest in items[0...k]}
{max = largest in items[0...k] ^ k+1 = size}
-> {max = largest in items[0...k] ^ k = size-1}
-> {max = largest in items[0...size-1]}

Change k to be the last index of element in the array 
that has been checked, and use k+1 to refer to the index 
of next element to be check. I think this change made 
the code harder to write compared to original version 
since k stores the index of next element to be examine 
is more intuitive and doesn't need use k+1 instead of 
k that many times inside the loop.

Problem 2
@requires x >= 0 && y >= 0
int expt(int x, int y) {
  {x = x_pre & y = y_pre & x_pre >= 0 & y_pre >= 0}
  int z = 1;
  {x = x_pre & y = y_pre & x_pre >= 0 & y_pre >= 0 & z = 1}
  {LI: z*x^y = x_pre^y_pre}
  while (y != 0) {
    {z*x^y = x_pre^y_pre & y > 0}
    if (y % 2 == 0) {
      {z*x^y = x_pre^y_pre & y > 0 & y%2 = 0}
      y = y/2;
      x = x*x;
      {z*x^y = x_pre^y_pre & y > 0}
    } else {
      {z*x^y = x_pre^y_pre & y > 0 & y%2 = 1}
      z = z*x;
      y = y-1;
      {z*x^y = x_pre^y_pre & y >= 0 & y%2 = 0}
    }
    {z*x^y = x_pre^y_pre & y >= 0}
  }
  {LI: z*x^y = x_pre^y_pre}
  {z = x_pre^y_pre & y = 0}
  return z;
}

LI: z*x^y = x_pre^y_pre
1. prove true initially
   z = 1 & x = x_pre & y = y_pre
   => z*x^y = x^y = x_pre^y_pre
   => LI
2. prove true if the loop executes once
   {LI & y != 0}
   z = z_pre = 1
   if y%2 = 0 => y = y_pre/2 & x = x_pre*x_pre
              => z*x^y = (x_pre*x_pre)^(y_pre/2) = x_pre^y_pre
              => LI
   else (y%2 = 1) => y = y_pre-1 & z=z_pre*x_pre
                  => z*x^y = (z_pre*x_pre)*x_pre^(y_pre-1) 
				           = x_pre*x_pre^(y_pre-1) = x_pre^y_pre
                  => {LI}
   so {LI & y != 0} LoopBody {LI}
3. prove if it establishes the postcondition when the loop is terminated
   {LI & !(y != 0)} => {z*x^y = x_pre^y_pre & y = 0}
                    => {z = x_pre^y_pre & y = 0}

Problem 3
int i = 0;
int j = n-1;
{i = 0 & j = n-1}
{LI: all elements in a[0...i-1] <= a[0] & 
     all elements in a[j+1...] > a[0]}
while (i < j) {
  {all elements in a[0...i-1] <= a[0] & 
   all elements in a[j+1...] > a[0] & (i < j)}
  if (a[j] > a[0])
    {(a[j] > a[0]) & all  elements in a[0...i-1] <= a[0] & 
	 all elements in a[j...] > a[0]}
    j--;
    {LI: all elements in a[0...i-1] <= a[0] & 
	     all elements in a[j+1...] > a[0]}
  else if (a[i] <= a[0])
    {(a[i] <= a[0]) & all  elements in a[0...i] <= a[0] & 
	 all elements in a[j+1...] > a[0]}
    i++;
    {LI: all elements in a[0...i-1] <= a[0] & 
	     all elements in a[j+1...] > a[0]}
  else {
    {(a[j] <= a[0]) & (a[i] > a[0]) & 
	all elements in a[0...i-1] <= a[0] & all elements in a[j+1...] > a[0]}
    swap(a[i], a[j]);
    {all elements in a[0...i] <= a[0] & all elements in a[j...] > a[0]}
    i++;
    j--;
    {LI: all elements in a[0...i-1] <= a[0] & 
	     all elements in a[j+1...] > a[0]}
  }
}
{LI: all elements in a[0...i-1] <= a[0] & all elements in a[j+1...] > a[0]}
{all elements in a[0...i-1] <= a[0] & 
 all elements in a[j+1...] > a[0] & (i >= j)}
swap(a[0], a[j]);
{post:
 0                                  n
 +-------------+----+---------------+
a|  <= a[0]    |a[0]|     > a[0]    |
 +-------------+----+---------------+
}

LI: all elements in a[0...i-1] <= a[0] & all elements in a[j+1...] > a[0]
1. {i = 0 & j = n-1} => {i-1 = -1 & j+1 = n}
                     => {all  elements in a[0...i-1] <= a[0] & 
					     all elements in a[j+1...] > a[0]}
				     => {LI}
2. prove true if the loop executes once: 
   Refer to the code. I already put appropriate assertions 
   inside the loop to prove this true.
3. {all  elements in a[0...i-1] <= a[0] & 
    all elements in a[j+1...] > a[0] & !(i < j)}
   => {LI & (i >= j)}
   => {postcondition} 

Problem 4
int i, j, min;
i = 0;
{i = 0}
{LI_OUTER: a[0...i-1] is in sorted order}
while (i < n-1) {
  {a[0...i-1] is in sorted order & (i < n-1)}
  min = i;
  j = i+1;
  {a[0...i-1] is in sorted order & (i < n-1) & (min = i) & (j = i+1)}
  {LI_INNER: min contains the index of the smallest element in a[i...j-1]}
  while (j < n) {
    {min contains the index of the smallest element in a[i...j-1] & (j < n)}
    if (a[j] < a[min]) {
      {min contains the index of the smallest element in a[i...j-1] & 
	   (j < n) & (a[j] < a[min])}
      min = j;
      {min contains the index of the smallest element in a[i...j] & (j < n)}
    } else {
	  {min contains the index of the smallest element in a[i...j-1] & 
	   (j < n) & (a[j] >= a[min])}
	  => {min contains the index of the smallest element in a[i...j] & (j < n)}
    }
    {min contains the index of the smallest element in a[i...j] & (j < n)}
    j++;
    {min contains the index of the smallest element in a[i...j-1] & (j < n)}
	=> {LI_INNER: min contains the index of the smallest element in a[i...j-1]}
  }
  {LI_INNER: min contains the index of the smallest element in a[i...j-1]}
  {min contains the index of the smallest element in a[i...j-1] & j = n}
  swap(a[i], a[min]);
  {a[0...i] is in sorted order & (i < n-1) & (n = j)}
  i++;
  {a[0...i-1] is in sorted order & (i <= n-1) & (n = j)} 
  => {LI_OUTER: a[0...i-1] is in sorted order}
}
{LI_OUTER: a[0...i-1] is in sorted order}
{array a is in sorted order}

LI_INNER: min contains the index of the smallest element in a[i...j-1]
1. {a[0...i-1] is in sorted order & (i < n-1) & (min = i) & (j = i+1)}
   => {min = i & min = j-1}
   => {min contains the index of the smallest element in a[i...j-1]}
   => {LI_INNER}
2. prove true if the loop executes once: 
   Refer to the code. 
   I already put appropriate assertions inside the loop to prove this true.
3. {min contains the index of the smallest element in a[i...j-1] & !(j < n)}
   => {min contains the index of the smallest element in a[i...j-1] & j = n}
   => {postcondition}

{LI_OUTER: a[0...i-1] is in sorted order}
1. {i = 0} => {i-1 = -1} => {a[0...i-1] is in sorted order} => {LI_OUTER}
2. prove true if the loop executes once: 
   Refer to the code. 
   I already put appropriate assertions inside the loop to prove this true.
3. {a[0...i-1] is in sorted order & !(i < n-1)}
   => {a[0...i-1] is in sorted order & (i = n)}
   => {array a is in sorted order}
   => {postcondition}   

================================================
FILE: HW/hw2/hw3_problem0.txt
================================================
Chun-Wei Chen
CSE 331
Homework 3 - Problem 0
04/12/13

a. 
r = p - q: 
  set r = q by making a term-by-term copy of all terms in q to r
  foreach term, t_r, in r: 
    replace t_r in r with multiplication of t_r and -1
  p + r // use the polynomial addition provided in spec

b.
r = p * q: 
  set d_p = 0
  set d_q = 0
  set r = 0 // zero polynomial
  foreach term, t_p, in p:
    set d_p = degree of t_p
    
    foreach term, t_q, in q: 
      set d_q = degree of t_q
      if any term, t_r, in r has the same degree as d_p + d,
        then increment the t_r in r by t_p * t_q
        else insert t_p * t_q as a new term with degree as d_p + d into r
      set d_q = d_q + 1
    
    set d_q = 0
    set d_p = d_p + 1

c.
r = p * q: 
  set d_p = 0
  set d_q = 0
  set r = 0 // zero polynomial
  {d_p = 0 & d_q = 0 & r = "0"}
  {LI_OUTER: r + p[d_p...] * q = p * q}
  foreach term, t_p, in p in order of increasing degree:
    {LI_OUTER & d_p = 0 & d_q = 0 & t_p exists}
    set d_p = degree of t_p
    {LI_OUTER & t_p exists & d_p = degree of t_p & d_q = 0}
    {LI_INNER: r + p[d_p] * q[d_q...] = p[...d_p] * q}
    foreach term, t_q, in q in order of increasing degree: 
      {LI_INNER & t_q exists & d_p = degree of t_p & d_q = 0}
      set d_q = degree of t_q
      {LI_INNER & d_p = degree of t_p & d_q = degree of t_q}
      if any term, t_r, in r has the same degree as d_p + d,
        {LI_INNER & d_p = degree of t_p & d_q = degree of t_q & 
		 degree of d_p + d exists in r_pre}
        then increment the t_r in r by t_p * t_q
        {r + p[d_p] * q[d_q+1...] = p[...d_p] * q & 
		 d_p = degree of t_p & d_q = degree of t_q}
        
        {LI_INNER & d_p = degree of t_p & d_q = degree of t_q & 
		 degree of d_p + d not exists in r_pre}
        else insert t_p * t_q as a new term with degree as d_p + d into r
        {r + p[d_p] * q[d_q+1...] = p[...d_p] * q & 
		 d_p = degree of t_p & d_q = degree of t_q}
      {r + p[d_p] * q[d_q+1...] = p[...d_p] * q}
      set d_q = d_q + 1
      {r + p[d_p] * q[d_q...] = p[...d_p] * q}
    {LI_INNER: r + p[d_p] * q[d_q...] = p[...d_p] * q}
    {r + p[d_p+1...] * q = p * q}
    set d_q = 0
    set d_p = d_p + 1
    {r + p[d_p...] * q = p * q}
  {LI_OUTER: r + p[d_p...] * q = p * q}
  {r = p * q}
  
LI_INNER: r + p[d_p] * q[d_q...] = p[...d_p] * q
1. {LI_OUTER & t_p exists & d_p = degree of t_p & d_q = 0}
   => {r + p[d_p] * q[d_q...] 
       = p * q - p[d_p...] * q + p[d_p] * q[0...] 
       = p[...d_p] * q}
   => {LI_INNER}
2. Refer to assertions in the code above
3. {LI_INNER & d_q not exists}
   => {d_q - 1 = highest degree in q}
   => {q[d_q...] = "0"}
   => {r + p[d_p] * q[d_q...] + p[d_p+1...] * q 
       = r + p[d_p+1...] * q 
	   = p * q}
   => {postcondition}

LI_OUTER: r + p[d_p...] * q = p * q
1. {d_p = 0 & d_q = 0 & r = "0"}
   => {r + p[d_p...] * q = 0 + p[0...] * q = p * q}
   => {LI_OUTER}
2. Refer to assertions in the code above
3. {LI_OUTER & t_p not exists}
   => {d_p - 1 = highest degree in p}
   => {p[d_p...] = "0"}
   => {r + p[d_p...] * q = r = p * q}
   => {postcondition}

Note: "0" means zero polynomial

d.
q = u / v:
  set q = 0 // zero polynomial
  set r = u by making a term-by-term copy of all terms in u to r
  while r != 0 and highest degree of r >= highest degree of v: 
    set t = leading term of r / leading term of v
    set d = highest degree of r - highest degree of v
    set s to be a polynomial that has a term of degree d with coefficient t
    set q = s + q
    set r = r - (s * v)

e.
(x^3-2*x+3) / (3*x^2) = 1/3*x
u = (x^3-2*x+3)
v = (3*x^2)
q = 0 // zero polynomial
r = copy of u = (x^3-2*x+3)
while r != 0 and highest degree of r >= highest degree of v
  [r != 0 and highest degree of r (3) >= highest degree of v (2)] YES
  Iteration 1: 
    [set t = leading term of r / leading term of v] t = 1/3
    [set d = highest degree of r - highest degree of v] d = 2 - 1 = 1
    [set s to be a polynomial that has a term of degree d with coefficient t] 
	s = 1/3*x
    [set q = s + q] q = 0 + 1/3*x = 1/3*x
    [set r = r - (s * v)] 
	r = x^3-2*x+3 - ((1/3*x) * (3*x^2)) = x^3-2*x+3 - x^3 = -2*x+3
  [r != 0 and highest degree of r (1) >= highest degree of v (2)] NO
DONE! q = 1/3*x

(x^3+x-1) / (x+1) = x^2-x+2
u = (x^3+x-1)
v = (x+1)
q = 0 // zero polynomial
r = copy of u = (x^3+x-1)
while r != 0 and highest degree of r >= highest degree of v
  [r != 0 and highest degree of r (3) >= highest degree of v (1)] YES
  Iteration 1: 
    [set t = leading term of r / leading term of v] t = 1
    [set d = highest degree of r - highest degree of v] d = 3 - 1 = 2
    [set s to be a polynomial that has a term of degree d with coefficient t] 
	s = x^2
    [set q = s + q] q = 0 + x^2 = x^2
    [set r = r - (s * v)] 
	r = x^3+x-1 - (x^2 * (x+1)) = x^3+x-1 - (x^3+x^2) = -x^2+x-1
  [r != 0 and highest degree of r (2) >= highest degree of v (1)] YES
  Iteration 2: 
    [set t = leading term of r / leading term of v] t = -1
    [set d = highest degree of r - highest degree of v] d = 2 - 1 = 1
    [set s to be a polynomial that has a term of degree d with coefficient t] 
	s = -x
    [set q = s + q] q = x^2 + (-x) = x^2-x
    [set r = r - (s * v)] 
	r = -x^2+x-1 - (-x * (x+1)) = -x^2+x+1 - (-x^2-x) = 2*x-1
  [r != 0 and highest degree of r (1) >= highest degree of v (1)] YES
  Iteration 3: 
    [set t = leading term of r / leading term of v] t = 2
    [set d = highest degree of r - highest degree of v] d = 1 - 1 = 0
    [set s to be a polynomial that has a term of degree d with coefficient t] 
	s = 2
    [set q = s + q] q = x^2-x + 2 = x^2-x+2
    [set r = r - (s * v)] r = 2*x-1 - (2 * x+1) = 2*x-1 - (2*x+2) = -3
  [r != 0 and highest degree of r (0) >= highest degree of v (1)] NO
DONE! q = x^2-x+2

================================================
FILE: HW/hw3/CalculatorFrame.java
================================================
package hw3;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;


/**
 * <B>CalculatorFrame</b> is part of the graphical calculator that utilizes all
 * of the other classes in package hw3. CalculatorFrame contains the main()
 * function which starts the calculator.
 */

public final class CalculatorFrame extends JFrame {
    JPanel jPanel1 = new JPanel();

    JPanel jPanel2 = new JPanel();

    JPanel jPanel3 = new JPanel();

    JPanel jPanel4 = new JPanel();

    JPanel jPanel5 = new JPanel();

    JPanel jPanel6 = new JPanel();

    JPanel jPanel8 = new JPanel();

    Border border1;

    JLabel jLabel5 = new JLabel();

    JLabel jLabel6 = new JLabel();

    JTextField jTextField1 = new JTextField();

    JTextField jTextField2 = new JTextField();

    JButton jButton_exp = new JButton();

    JButton jButton_div = new JButton();

    JButton jButton_mul = new JButton();

    JButton jButton_7 = new JButton();

    JButton jButton_8 = new JButton();

    JButton jButton_9 = new JButton();

    JButton jButton_4 = new JButton();

    JButton jButton_5 = new JButton();

    JButton jButton_6 = new JButton();

    JButton jButton_1 = new JButton();

    JButton jButton_2 = new JButton();

    JButton jButton_3 = new JButton();

    JButton jButton_0 = new JButton();

    JButton jButton_x = new JButton();

    JButton jButton_Enter = new JButton();

    JButton jButton_plus = new JButton();

    JButton jButton_minus = new JButton();

    JButton jButton_swap = new JButton();

    JButton jButton_pop = new JButton();

    JButton jButton_dup = new JButton();

    JButton jButton_int = new JButton();

    JButton jButton_dif = new JButton();

    JTextArea jTextArea_Current = new JTextArea();

    JTextArea jTextArea_Stack_3 = new JTextArea();

    JTextArea jTextArea_Stack_2 = new JTextArea();

    JTextArea jTextArea_Stack_1 = new JTextArea();

    JTextArea jTextArea_Stack_0 = new JTextArea();

    BorderLayout borderLayout1 = new BorderLayout();

    PolyGraph pg;

    RatPolyStack stack;

    Border border2;

    Border border3;

    Border border4;

    Border border5;

    JPanel jPanel7 = new JPanel();

    JButton jButton_stack_mul = new JButton();

    JButton jButton_stack_div = new JButton();

    JButton jButton_stack_add = new JButton();

    JButton jButton_stack_sub = new JButton();

    JButton jButton_Clear = new JButton();

    // Serializable classes are supposed to have this
    private static final long serialVersionUID = 42L;

    public CalculatorFrame() {
        try {
            // Student-written code that may throw an exception
            stack = new RatPolyStack();

            jbInit();
            // exit the application when this window is closed
            addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    setVisible(false);
                    dispose();
                    System.exit(0);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /*@AssertNonNullAfter({"pg", "border1", "border2", "border3", "border4", "border5"})*/
    private void jbInit() throws Exception {
        border1 = BorderFactory
                .createBevelBorder(BevelBorder.LOWERED, Color.white,
                        Color.white, Color.white, new Color(124, 124, 124));
        border2 = BorderFactory.createBevelBorder(BevelBorder.LOWERED,
                Color.red, Color.white, new Color(178, 178, 178), new Color(
                        124, 124, 124));
        border3 = BorderFactory.createBevelBorder(BevelBorder.LOWERED,
                Color.blue, Color.white, new Color(178, 178, 178), new Color(
                        124, 124, 124));
        border4 = BorderFactory.createBevelBorder(BevelBorder.LOWERED,
                Color.green, Color.white, new Color(178, 178, 178), new Color(
                        124, 124, 124));
        border5 = BorderFactory.createBevelBorder(BevelBorder.LOWERED,
                Color.orange, Color.white, new Color(178, 178, 178), new Color(
                        124, 124, 124));
        jPanel1.setLayout(null);
        jPanel1.setBackground(Color.gray);
        jPanel1.setBorder(BorderFactory.createRaisedBevelBorder());
        jPanel2.setBorder(BorderFactory.createRaisedBevelBorder());
        jPanel2.setBounds(new Rectangle(21, 21, 330, 371));
        jPanel2.setLayout(borderLayout1);
        jPanel3.setBorder(BorderFactory.createRaisedBevelBorder());
        jPanel3.setBounds(new Rectangle(366, 23, 259, 219));
        jPanel3.setLayout(null);
        jPanel4.setBorder(BorderFactory.createRaisedBevelBorder());
        jPanel4.setBounds(new Rectangle(365, 258, 258, 132));
        jPanel4.setLayout(null);
        jPanel5.setBorder(BorderFactory.createRaisedBevelBorder());
        jPanel5.setBounds(new Rectangle(21, 410, 167, 90));
        jPanel5.setLayout(null);
        jPanel6.setBorder(BorderFactory.createRaisedBevelBorder());
        jPanel6.setBounds(new Rectangle(197, 410, 196, 275));
        jPanel6.setLayout(null);
        jPanel8.setBorder(BorderFactory.createRaisedBevelBorder());
        jPanel8.setBounds(new Rectangle(21, 510, 167, 90));
        jPanel8.setLayout(null);
        jLabel5.setText("X max");
        jLabel5.setBounds(new Rectangle(8, 47, 34, 25));
        jLabel6.setBounds(new Rectangle(10, 10, 34, 24));
        jLabel6.setText("X min");
        jTextField1.setText("-1.0");
        jTextField1.setBounds(new Rectangle(50, 15, 104, 22));
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
           @Override
            public void actionPerformed(ActionEvent e) {
                jTextField1_actionPerformed(e);
            }
        });
        jTextField2.setBounds(new Rectangle(49, 51, 104, 22));
        jTextField2.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jTextField2_actionPerformed(e);
            }
        });
        jTextField2.setText("1.0");
        jButton_exp.setFont(new java.awt.Font("Dialog", 0, 18));
        jButton_exp.setMargin(new Insets(2, 2, 2, 2));
        jButton_exp.setText("^");
        jButton_exp.setBounds(new Rectangle(9, 10, 41, 44));
        jButton_exp.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_exp_actionPerformed(e);
            }
        });

        jButton_int.setBounds(new Rectangle(10, 7, 146, 35));
        jButton_int.setText("Integrate");
        jButton_int.setFont(new java.awt.Font("Dialog", 0, 18));
        jButton_int.setMargin(new Insets(2, 2, 2, 2));
        jButton_int.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_int_actionPerformed(e);
            }
        });

        jButton_dif.setBounds(new Rectangle(10, 47, 146, 36));
        jButton_dif.setText("Differentiate");
        jButton_dif.setFont(new java.awt.Font("Dialog", 0, 18));
        jButton_dif.setMargin(new Insets(2, 2, 2, 2));
        jButton_dif.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_dif_actionPerformed(e);
            }
        });

        jButton_div.setBounds(new Rectangle(103, 10, 41, 44));
        jButton_div.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_div_actionPerformed(e);
            }
        });
        jButton_div.setText("/");
        jButton_div.setFont(new java.awt.Font("Dialog", 0, 18));
        jButton_div.setMargin(new Insets(2, 2, 2, 2));
        jButton_mul.setFont(new java.awt.Font("Dialog", 0, 18));
        jButton_mul.setMargin(new Insets(2, 2, 2, 2));
        jButton_mul.setText("*");
        jButton_mul.setBounds(new Rectangle(55, 10, 41, 44));
        jButton_mul.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_mul_actionPerformed(e);
            }
        });
        jButton_7.setBounds(new Rectangle(9, 60, 41, 44));
        jButton_7.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_7_actionPerformed(e);
            }
        });
        jButton_7.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_7.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_7.setMargin(new Insets(2, 2, 2, 2));
        jButton_7.setText("7");
        jButton_8.setText("8");
        jButton_8.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_8.setMargin(new Insets(2, 2, 2, 2));
        jButton_8.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_8.setBounds(new Rectangle(55, 60, 41, 44));
        jButton_8.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_8_actionPerformed(e);
            }
        });
        jButton_9.setBounds(new Rectangle(103, 60, 41, 44));
        jButton_9.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_9_actionPerformed(e);
            }
        });
        jButton_9.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_9.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_9.setMargin(new Insets(2, 2, 2, 2));
        jButton_9.setText("9");
        jButton_4.setText("4");
        jButton_4.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_4.setMargin(new Insets(2, 2, 2, 2));
        jButton_4.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_4.setBounds(new Rectangle(9, 111, 41, 44));
        jButton_4.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_4_actionPerformed(e);
            }
        });
        jButton_5.setBounds(new Rectangle(55, 111, 41, 44));
        jButton_5.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_5_actionPerformed(e);
            }
        });
        jButton_5.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_5.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_5.setMargin(new Insets(2, 2, 2, 2));
        jButton_5.setText("5");
        jButton_6.setText("6");
        jButton_6.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_6.setMargin(new Insets(2, 2, 2, 2));
        jButton_6.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_6.setBounds(new Rectangle(103, 111, 41, 44));
        jButton_6.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_6_actionPerformed(e);
            }
        });
        jButton_1.setBounds(new Rectangle(9, 163, 41, 44));
        jButton_1.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_1_actionPerformed(e);
            }
        });
        jButton_1.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_1.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_1.setMargin(new Insets(2, 2, 2, 2));
        jButton_1.setText("1");
        jButton_2.setText("2");
        jButton_2.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_2.setMargin(new Insets(2, 2, 2, 2));
        jButton_2.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_2.setBounds(new Rectangle(55, 163, 41, 44));
        jButton_2.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_2_actionPerformed(e);
            }
        });
        jButton_3.setBounds(new Rectangle(103, 163, 41, 44));
        jButton_3.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_3_actionPerformed(e);
            }
        });
        jButton_3.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_3.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_3.setMargin(new Insets(2, 2, 2, 2));
        jButton_3.setText("3");
        jButton_0.setText("0");
        jButton_0.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_0.setMargin(new Insets(2, 2, 2, 2));
        jButton_0.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_0.setBounds(new Rectangle(9, 218, 89, 44));
        jButton_0.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_0_actionPerformed(e);
            }
        });
        jButton_x.setText("x");
        jButton_x.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_x.setMargin(new Insets(2, 2, 2, 2));
        jButton_x.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_x.setBounds(new Rectangle(103, 218, 41, 44));
        jButton_x.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_x_actionPerformed(e);
            }
        });
        jButton_Enter.setBounds(new Rectangle(8, 171, 77, 44));
        jButton_Enter.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_Enter_actionPerformed(e);
            }
        });
        jButton_Enter.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_Enter.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_Enter.setMargin(new Insets(2, 2, 2, 2));
        jButton_Enter.setText("Enter");
        jButton_plus.setBounds(new Rectangle(149, 10, 41, 44));
        jButton_plus.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_plus_actionPerformed(e);
            }
        });
        jButton_plus.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_plus.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_plus.setMargin(new Insets(2, 2, 2, 2));
        jButton_plus.setText("+");
        jButton_minus.setText("-");
        jButton_minus.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_minus.setMargin(new Insets(2, 2, 2, 2));
        jButton_minus.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_minus.setBounds(new Rectangle(149, 61, 41, 44));
        jButton_minus.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_minus_actionPerformed(e);
            }
        });
        jButton_swap.setText("Swap");
        jButton_swap.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_swap.setMargin(new Insets(2, 2, 2, 2));
        jButton_swap.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_swap.setBounds(new Rectangle(8, 8, 75, 44));
        jButton_swap.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_swap_actionPerformed(e);
            }
        });
        jButton_pop.setBounds(new Rectangle(8, 63, 75, 44));
        jButton_pop.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_pop_actionPerformed(e);
            }
        });
        jButton_pop.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_pop.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_pop.setMargin(new Insets(2, 2, 2, 2));
        jButton_pop.setText("Pop");
        jButton_dup.setText("Dup");
        jButton_dup.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_dup.setMargin(new Insets(2, 2, 2, 2));
        jButton_dup.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_dup.setBounds(new Rectangle(8, 118, 76, 44));
        jButton_dup.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_dup_actionPerformed(e);
            }
        });
        jTextArea_Current.setLineWrap(true);
        jTextArea_Current.setBorder(BorderFactory.createLoweredBevelBorder());
        jTextArea_Current.setBounds(new Rectangle(8, 11, 239, 111));
        jTextArea_Stack_3.setLineWrap(true);
        jTextArea_Stack_3.setBorder(border5);
        jTextArea_Stack_3.setEditable(false);
        jTextArea_Stack_3.setBounds(new Rectangle(8, 10, 241, 40));
        jTextArea_Stack_2.setBounds(new Rectangle(8, 57, 241, 40));
        jTextArea_Stack_2.setLineWrap(true);
        jTextArea_Stack_2.setBorder(border4);
        jTextArea_Stack_2.setEditable(false);
        jTextArea_Stack_1.setLineWrap(true);
        jTextArea_Stack_1.setBorder(border3);
        jTextArea_Stack_1.setEditable(false);
        jTextArea_Stack_1.setBounds(new Rectangle(8, 105, 241, 40));
        jTextArea_Stack_0.setLineWrap(true);
        jTextArea_Stack_0.setBorder(border2);
        jTextArea_Stack_0.setEditable(false);
        jTextArea_Stack_0.setBounds(new Rectangle(8, 154, 241, 40));
        jPanel7.setBorder(BorderFactory.createRaisedBevelBorder());
        jPanel7.setBounds(new Rectangle(403, 411, 199, 283));
        jPanel7.setLayout(null);
        jButton_stack_mul
                .addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        jButton_stack_mul_actionPerformed(e);
                    }
                });
        jButton_stack_mul.setBounds(new Rectangle(105, 118, 75, 44));
        jButton_stack_mul.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_stack_mul.setMargin(new Insets(2, 2, 2, 2));
        jButton_stack_mul.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_stack_mul.setText("Mul");
        jButton_stack_div.setText("Div");
        jButton_stack_div.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_stack_div.setMargin(new Insets(2, 2, 2, 2));
        jButton_stack_div.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_stack_div.setBounds(new Rectangle(105, 171, 75, 44));
        jButton_stack_div
                .addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        jButton_stack_div_actionPerformed(e);
                    }
                });
        jButton_stack_add.setText("Add");
        jButton_stack_add.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_stack_add.setMargin(new Insets(2, 2, 2, 2));
        jButton_stack_add.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_stack_add.setBounds(new Rectangle(105, 8, 75, 44));
        jButton_stack_add
                .addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        jButton_stack_add_actionPerformed(e);
                    }
                });
        jButton_stack_sub.setText("Sub");
        jButton_stack_sub.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_stack_sub.setMargin(new Insets(2, 2, 2, 2));
        jButton_stack_sub.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_stack_sub.setBounds(new Rectangle(105, 63, 75, 44));
        jButton_stack_sub
                .addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        jButton_stack_sub_actionPerformed(e);
                    }
                });
        jButton_Clear.setText("Clear");
        jButton_Clear.setMargin(new Insets(2, 2, 2, 2));
        jButton_Clear.setHorizontalTextPosition(SwingConstants.CENTER);
        jButton_Clear.setFont(new java.awt.Font("Dialog", 1, 18));
        jButton_Clear.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton_Clear_actionPerformed(e);
            }
        });
        jButton_Clear.setBounds(new Rectangle(105, 225, 77, 44));
        this.getContentPane().add(jPanel1, BorderLayout.CENTER);
        jPanel1.add(jPanel2, null);
        jPanel1.add(jPanel3, null);
        jPanel3.add(jTextArea_Stack_3, null);
        jPanel3.add(jTextArea_Stack_2, null);
        jPanel3.add(jTextArea_Stack_0, null);
        jPanel3.add(jTextArea_Stack_1, null);
        jPanel1.add(jPanel4, null);
        jPanel4.add(jTextArea_Current, null);
        jPanel1.add(jPanel5, null);
        jPanel1.add(jPanel8, null);
        jPanel5.add(jLabel6, null);
        jPanel5.add(jLabel5, null);
        jPanel5.add(jTextField1, null);
        jPanel5.add(jTextField2, null);
        jPanel8.add(jButton_int, null);
        jPanel8.add(jButton_dif, null);
        jPanel1.add(jPanel6, null);
        jPanel6.add(jButton_exp, null);
        jPanel6.add(jButton_8, null);
        jPanel6.add(jButton_9, null);
        jPanel6.add(jButton_4, null);
        jPanel6.add(jButton_5, null);
        jPanel6.add(jButton_6, null);
        jPanel6.add(jButton_3, null);
        jPanel6.add(jButton_0, null);
        jPanel6.add(jButton_x, null);
        jPanel6.add(jButton_div, null);
        jPanel6.add(jButton_plus, null);
        jPanel6.add(jButton_mul, null);
        jPanel6.add(jButton_7, null);
        jPanel6.add(jButton_2, null);
        jPanel6.add(jButton_1, null);
        jPanel6.add(jButton_minus, null);
        jPanel1.add(jPanel7, null);
        jPanel7.add(jButton_pop, null);
        jPanel7.add(jButton_dup, null);
        jPanel7.add(jButton_Enter, null);
        jPanel7.add(jButton_swap, null);
        jPanel7.add(jButton_stack_div, null);
        jPanel7.add(jButton_stack_mul, null);
        jPanel7.add(jButton_stack_add, null);
        jPanel7.add(jButton_stack_sub, null);
        jPanel7.add(jButton_Clear, null);

        pg = new PolyGraph(this);
        // pg.setBackground(Color.white);
        jPanel2.add(pg, "Center");
    }

    /** Main method */
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }

        CalculatorFrame frame = new CalculatorFrame();

        // Validate frames that have preset sizes
        frame.validate();

        // Center the window
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

        frame.setSize(new Dimension(670, 730));
        frame.setTitle("Polynomial Calculator");

        Dimension frameSize = frame.getSize();

        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        frame.setLocation((screenSize.width - frameSize.width) / 2,
                (screenSize.height - frameSize.height) / 2);
        frame.setVisible(true);
    }

    boolean startNewEq = false;

    void appendToCurrentText(String textToAdd) {
        if (startNewEq) {
            jTextArea_Current.setText("");
            startNewEq = false;
        }
        String currentText = jTextArea_Current.getText();
        jTextArea_Current.setText(currentText + textToAdd);
    }

    void jButton_1_actionPerformed(ActionEvent e) {
        appendToCurrentText("1");
    }

    void jButton_2_actionPerformed(ActionEvent e) {
        appendToCurrentText("2");
    }

    void jButton_3_actionPerformed(ActionEvent e) {
        appendToCurrentText("3");
    }

    void jButton_4_actionPerformed(ActionEvent e) {
        appendToCurrentText("4");
    }

    void jButton_5_actionPerformed(ActionEvent e) {
        appendToCurrentText("5");
    }

    void jButton_6_actionPerformed(ActionEvent e) {
        appendToCurrentText("6");
    }

    void jButton_7_actionPerformed(ActionEvent e) {
        appendToCurrentText("7");
    }

    void jButton_8_actionPerformed(ActionEvent e) {
        appendToCurrentText("8");
    }

    void jButton_9_actionPerformed(ActionEvent e) {
        appendToCurrentText("9");
    }

    void jButton_exp_actionPerformed(ActionEvent e) {
        if (startNewEq == true) {
            startNewEq = false;
        }
        appendToCurrentText("^");
    }

    void jButton_mul_actionPerformed(ActionEvent e) {
        if (startNewEq == true) {
            startNewEq = false;
        }
        appendToCurrentText("*");
    }

    void jButton_div_actionPerformed(ActionEvent e) {
        if (startNewEq == true) {
            startNewEq = false;
        }
        appendToCurrentText("/");
    }

    void jButton_plus_actionPerformed(ActionEvent e) {
        if (startNewEq == true) {
            startNewEq = false;
        }
        appendToCurrentText("+");
    }

    void jButton_minus_actionPerformed(ActionEvent e) {
        if (startNewEq == true) {
            startNewEq = false;
        }
        appendToCurrentText("-");
    }

    void jButton_0_actionPerformed(ActionEvent e) {
        appendToCurrentText("0");
    }

    void jButton_x_actionPerformed(ActionEvent e) {
        appendToCurrentText("x");
    }

    void jButton_swap_actionPerformed(ActionEvent e) {
        try {
            if (stack.size() > 1) {
                stack.swap();
            }
            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_pop_actionPerformed(ActionEvent e) {
        try {
            if (stack.size() > 0) {
                RatPoly popped = stack.pop();
                jTextArea_Current.setText(popped.toString());
                startNewEq = true;
            }
            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_dup_actionPerformed(ActionEvent e) {
        try {
            if (stack.size() > 0) {
                stack.dup();
            }
            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_Enter_actionPerformed(ActionEvent e) {
        String currentText = jTextArea_Current.getText();
        RatPoly parsedRatPoly;

        startNewEq = true;
        jTextArea_Current.setText("");

        // Exception handler used here since some of this calls what will
        // ultimately be student-written code.
        try {
            // Parse text to get new RatPoly and push it onto the stack.
            parsedRatPoly = RatPoly.valueOf(currentText);
            stack.push(parsedRatPoly);

            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            // Provide more informative message here.
            jTextArea_Current.setText(currentText);
            e1.printStackTrace();
            return;
        }

    }

    void updateStackDisplay() {
        // First, clear all the text areas for the stack display.
        jTextArea_Stack_0.setText("");
        jTextArea_Stack_1.setText("");
        jTextArea_Stack_2.setText("");
        jTextArea_Stack_3.setText("");

        RatPoly currentRatPoly;
        String tempString;

        // Now fill in new information base on what's in stack.
        // Note that size of stack must be checked.
        if (stack.size() > 0) {
            currentRatPoly = stack.getNthFromTop(0);
            tempString = currentRatPoly.toString();
            jTextArea_Stack_0.setText(tempString);
        }

        if (stack.size() > 1) {
            currentRatPoly = stack.getNthFromTop(1);
            tempString = currentRatPoly.toString();
            jTextArea_Stack_1.setText(tempString);
        }

        if (stack.size() > 2) {
            currentRatPoly = stack.getNthFromTop(2);
            tempString = currentRatPoly.toString();
            jTextArea_Stack_2.setText(tempString);
        }

        if (stack.size() > 3) {
            currentRatPoly = stack.getNthFromTop(3);
            tempString = currentRatPoly.toString();
            jTextArea_Stack_3.setText(tempString);
        }
        // Consider abstracting this better! This would require
        // putting the text areas into an array.

    }

    void updateGraph() {
        pg.repaint();
    }

    void jTextField1_actionPerformed(ActionEvent e) {
        updateGraph();
    }

    void jTextField2_actionPerformed(ActionEvent e) {
        updateGraph();
    }

    void jButton_stack_mul_actionPerformed(ActionEvent e) {
        try {
            if (stack.size() > 1)
                stack.mul();
            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_stack_div_actionPerformed(ActionEvent e) {
        try {
            if (stack.size() > 1)
                stack.div();
            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_int_actionPerformed(ActionEvent e) {
        try {
            // System.out.println("Integrate Button Clicked");
            stack.integrate();
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_dif_actionPerformed(ActionEvent e) {
        try {
            // System.out.println("Differentiate Button Clicked");
            stack.differentiate();
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_stack_add_actionPerformed(ActionEvent e) {
        try {
            if (stack.size() > 1)
                stack.add();
            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_stack_sub_actionPerformed(ActionEvent e) {
        try {
            if (stack.size() > 1)
                stack.sub();
            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

    void jButton_Clear_actionPerformed(ActionEvent e) {
        try {
            if (stack.size() > 0)
                stack.clear();
            // Update displays (so that they display new stack contents).
            updateStackDisplay();
            updateGraph();
        } catch (Exception e1) {
            e1.printStackTrace();
            return;
        }
    }

}


================================================
FILE: HW/hw3/HW3_comment_key.txt
================================================
Written response:

  CHECKREP - any changes in the rep invariant must be reflected by changes in the checkrep() method.

Code Style and readability:

  LIST_CONST - List defines a constructor which accepts a list argument and builds a duplicate,
  identical list. It is preferable to use this constructor, rather than building an empty list
  and copying each element explicitly.

  INTERFACE - use interfaces as variable & field types wherever possible.

  DEGREE - In RatPoly.degree() you should rely on the RI which states that the highest degree of
  a polynomial will be at the start of terms. Thus, it is not necessary to iterate over all of
  terms to find the highest degree.

  FOREACH - prefer for-each loops when iterating over every element in a list or other iterable
  data structure

  CHECKREP - check rep should be called at the end of any method which changes object state. For
  immutable objects (like RatPoly), this is usually just the constructor. (a notable exception, is
  that checkrep can be removed from production code if it represents a serious performance cost)

  REINVENT - Use your libraries, including the ones youve already written. Ex: Add and subtract
  are very similar for RatPoly, you can use one to solve the other with a minimum of code, rather
  than re-implementing the full algorithm.

  STACK_GET - Know your libraries. using pop & push makes getNthFromTop method less clear and
  less efficient than it otherwise might be. Java.util.Stack supports other methods which are
  better suited to the job youre trying to do in getNthFromTop. (esp .elementAt and .get)


================================================
FILE: HW/hw3/PolyGraph.java
================================================
package hw3;

import java.awt.*;

/**
 * <b>PolyGraph</b> is part of the graphical calculator that utilizes all of
 * the other classes in package hw3. PolyGraph implements the graphing
 * component.
 *
 * @author Felix Klock, Andreas Hofmann
 * @version 1.0
 */

public final class PolyGraph extends Canvas {
    Color col[] = new Color[4];

    Color zeroline = new Color(0xe0, 0xe0, 0xff);

    CalculatorFrame calcFrame;

    // Serializable classes are supposed to have this
    private static final long serialVersionUID = 24L;

    public PolyGraph(CalculatorFrame cf) {
        super();

        calcFrame = cf;

        col[0] = new Color(0xa0, 0, 0);
        col[1] = new Color(0, 0, 0xFF);
        col[2] = new Color(0, 0x80, 0);
        col[3] = new Color(0, 0, 0);
    }

    @Override
    public void update(Graphics g) {
        paint(g);
    }

    @Override
    public void paint(Graphics g) {
        int w = getSize().width;
        int h = getSize().height;

        g.setColor(Color.white);
        g.fillRect(0, 0, w, h);

        /*
         * g.setColor(Color.red); String msg= "Click to graph selected
         * variable"; int wid= getFontMetrics(getFont()).stringWidth(msg);
         * g.drawString(msg, (w-wid)/2, h/2);
         */

        // Draw axes and data
        int numIncrements = 100;

        float xMin = Float.parseFloat(calcFrame.jTextField1.getText());
        float xMax = Float.parseFloat(calcFrame.jTextField2.getText());
        float yMin = 0;
        float yMax = 0;
        float[] xValBuffer1 = null;
        float[] yValBuffer1 = null;
        float[] xValBuffer2 = null;
        float[] yValBuffer2 = null;
        float[] xValBuffer3 = null;
        float[] yValBuffer3 = null;
        float[] xValBuffer4 = null;
        float[] yValBuffer4 = null;
        float[] yExtrema;
        String msg;

        if (xMin >= xMax) {
            g.setColor(Color.red);
            msg = "Xmin must be greater than Xmax";
            int wid = getFontMetrics(getFont()).stringWidth(msg);
            g.drawString(msg, (w - wid) / 2, h / 2);
            return;
        }

        // Get RatPoly
        RatPoly currentRatPoly;

        // Now fill in new information base on what's in stack.
        // Note that size of stack must be checked.
        if ((calcFrame.stack != null) && (calcFrame.stack.size() > 0)) {
            currentRatPoly = calcFrame.stack.getNthFromTop(0);
            xValBuffer1 = new float[numIncrements];
            yValBuffer1 = new float[numIncrements];
            yExtrema = new float[2];
        } else {
            g.setColor(Color.red);
            msg = "Stack is empty";
            int wid = getFontMetrics(getFont()).stringWidth(msg);
            g.drawString(msg, (w - wid) / 2, h / 2);
            return;
        }

        updatePlotBuffer(xMin, xMax, numIncrements, xValBuffer1, yValBuffer1,
                yExtrema, currentRatPoly);

        yMin = yExtrema[0];
        yMax = yExtrema[1];

        if (calcFrame.stack.size() > 1) {
            currentRatPoly = calcFrame.stack.getNthFromTop(1);
            xValBuffer2 = new float[numIncrements];
            yValBuffer2 = new float[numIncrements];

            updatePlotBuffer(xMin, xMax, numIncrements, xValBuffer2,
                    yValBuffer2, yExtrema, currentRatPoly);

            if (yExtrema[0] < yMin) {
                yMin = yExtrema[0];
            }

            if (yExtrema[1] > yMax) {
                yMax = yExtrema[1];
            }
        }

        if (calcFrame.stack.size() > 2) {
            currentRatPoly = calcFrame.stack.getNthFromTop(2);
            xValBuffer3 = new float[numIncrements];
            yValBuffer3 = new float[numIncrements];

            updatePlotBuffer(xMin, xMax, numIncrements, xValBuffer3,
                    yValBuffer3, yExtrema, currentRatPoly);

            if (yExtrema[0] < yMin) {
                yMin = yExtrema[0];
            }

            if (yExtrema[1] > yMax) {
                yMax = yExtrema[1];
            }
        }

        if (calcFrame.stack.size() > 3) {
            currentRatPoly = calcFrame.stack.getNthFromTop(3);
            xValBuffer4 = new float[numIncrements];
            yValBuffer4 = new float[numIncrements];

            updatePlotBuffer(xMin, xMax, numIncrements, xValBuffer4,
                    yValBuffer4, yExtrema, currentRatPoly);

            if (yExtrema[0] < yMin) {
                yMin = yExtrema[0];
            }

            if (yExtrema[1] > yMax) {
                yMax = yExtrema[1];
            }
        }

        // At this point, min and max have been computed, and buffers
        // are full. Draw axes, then draw graph line.
        int bord = 32;
        g.setColor(Color.black);
        g.drawLine(bord, h - bord, w - bord, h - bord); // horizontal axis
        g.drawLine(bord, bord, bord, h - bord); // vertical axis

        float gw = w - 2 * bord; // width of graph area inside axes
        float gh = h - 2 * bord; // height of graph area inside axes

        // Draw axis labels.
        msg = Float.toString(xMin);
        g.drawString(msg, bord, h - 8);

        msg = Float.toString(xMax);
        g.drawString(msg, w - bord, h - 8);

        msg = Float.toString(yMin);
        g.drawString(msg, 8, h - bord);

        msg = Float.toString(yMax);
        g.drawString(msg, 8, bord);

        // Draw graph line.
        g.setColor(Color.red);
        drawPlot(xMin, xMax, yMin, yMax, xValBuffer1, yValBuffer1, gw, gh,
                bord, numIncrements, h, g);

        g.setColor(Color.blue);
        if (calcFrame.stack.size() > 1) {
            assert xValBuffer2 != null
                : "@SuppressWarnings(nullness): dependent:  non-null if calcFrame.stack.size() > 1";
            assert yValBuffer2 != null
                : "@SuppressWarnings(nullness): dependent:  non-null if calcFrame.stack.size() > 1";
            drawPlot(xMin, xMax, yMin, yMax, xValBuffer2, yValBuffer2, gw, gh,
                    bord, numIncrements, h, g);
        }

        g.setColor(Color.green);
        if (calcFrame.stack.size() > 2) {
            assert xValBuffer3 != null
                : "@SuppressWarnings(nullness): dependent:  non-null if calcFrame.stack.size() > 2";
            assert yValBuffer3 != null
                : "@SuppressWarnings(nullness): dependent:  non-null if calcFrame.stack.size() > 2";
            drawPlot(xMin, xMax, yMin, yMax, xValBuffer3, yValBuffer3, gw, gh,
                    bord, numIncrements, h, g);
        }

        g.setColor(Color.orange);
        if (calcFrame.stack.size() > 3) {
            assert xValBuffer4 != null
                : "@SuppressWarnings(nullness): dependent:  non-null if calcFrame.stack.size() > 3";
            assert yValBuffer4 != null
                : "@SuppressWarnings(nullness): dependent:  non-null if calcFrame.stack.size() > 3";
            drawPlot(xMin, xMax, yMin, yMax, xValBuffer4, yValBuffer4, gw, gh,
                    bord, numIncrements, h, g);
        }

        // Consider abstracting this better!
    }

    public void updatePlotBuffer(float xMin, float xMax, int numIncrements,
            float xValBuffer[], float yValBuffer[], float yExtrema[],
            RatPoly currentRatPoly) {
        float delta = (xMax - xMin) / numIncrements;
        float currentX = xMin;
        boolean firstTime = true;
        int i;
        float yVal = 0;
        float yMin = 0;
        float yMax = 0;

        for (i = 0; i < numIncrements; ++i) {
            if (currentX < xMax) {
                xValBuffer[i] = currentX;
                yVal = (float) currentRatPoly.eval(currentX);
                yValBuffer[i] = yVal;

                if (firstTime) {
                    firstTime = false;
                    yMin = yVal;
                    yMax = yVal;
                } else {
                    if (yVal < yMin) {
                        yMin = yVal;
                    }

                    if (yVal > yMax) {
                        yMax = yVal;
                    }
                }

                currentX += delta;
            } else {
                xValBuffer[i] = xValBuffer[i - 1];
                yValBuffer[i] = yValBuffer[i - 1];
            }
        }

        yExtrema[0] = yMin;
        yExtrema[1] = yMax;
    }

    public void drawPlot(float xMin, float xMax, float yMin, float yMax,
            float xValBuffer[], float yValBuffer[], float gw, float gh,
            int bord, int numIncrements, int h, Graphics g) {
        float xVal = 0;
        float yVal = 0;
        float previousX = 0;
        float previousY = 0;
        boolean firstTime = true;
        float xRange = xMax - xMin;
        float yRange = yMax - yMin;
        int xPrevScaled = 0;
        int yPrevScaled = 0;
        int xScaled = 0;
        int yScaled = 0;
        int i;
        for (i = 0; i < numIncrements; ++i) {
            if (firstTime) {
                firstTime = false;
                xVal = xValBuffer[i];
                yVal = yValBuffer[i];
                previousX = xVal;
                previousY = yVal;
            } else {
                previousX = xVal;
                previousY = yVal;
                xVal = xValBuffer[i];
                yVal = yValBuffer[i];
            }

            // Now draw a line from previous to current.
            xPrevScaled = Math.round((previousX - xMin) * gw / xRange);
            yPrevScaled = Math.round((previousY - yMin) * gh / yRange);
            xScaled = Math.round((xVal - xMin) * gw / xRange);
            yScaled = Math.round((yVal - yMin) * gh / yRange);

            g.drawLine(bord + xPrevScaled, h - bord - yPrevScaled, bord
                       + xScaled, h - bord - yScaled);
        }
    }

}


================================================
FILE: HW/hw3/RatNum.java
================================================
package hw3;

/** <b>RatNum</b> represents an <b>immutable</b> rational number.
    It includes all of the elements in the set of rationals, as well
    as the special "NaN" (not-a-number) element that results from
    division by zero.
    <p>
    The "NaN" element is special in many ways.  Any arithmetic
    operation (such as addition) involving "NaN" will return "NaN".
    With respect to comparison operations, such as less-than, "NaN" is
    considered equal to itself, and larger than all other rationals.
    <p>
    Examples of RatNums include "-1/13", "53/7", "4", "NaN", and "0".
 */

// ("immutable" is a common term for which "Effective Java" (p. 63)
// provides the following definition: "An immutatable class is simply
// a class whose instances cannot be modified.  All of the information
// contained in each instance is provided when it is created and is
// fixed for the lifetime of the object.")
public final class RatNum extends Number implements Comparable<RatNum> {

    private final int numer;
    private final int denom;

    // Abstraction Function:
    //   A RatNum r is NaN if r.denom = 0, (r.numer / r.denom) otherwise.
    // (An abstraction function explains what the state of the fields in a
    // RatNum represents.  In this case, a rational number can be
    // understood as the result of dividing two integers, or not-a-number
    // if we would be dividing by zero.)

    // Representation invariant for every RatNum r:
    //   (r.denom >= 0) &&
    //   (r.denom > 0 ==> there does not exist integer i > 1 such that
    //                    r.numer mod i = 0 and r.denom mod i = 0;)
    //   In other words,
    //     * r.denom is always non-negative.
    //     * r.numer/r.denom is in reduced form (assuming r.denom is not zero).
    // (A representation invariant tells us something that is true for all
    // instances of a RatNum)

    /** A constant holding a Not-a-Number (NaN) value of type RatNum */
    public static final RatNum NaN = new RatNum(1, 0);

    /** A constant holding a zero value of type RatNum */
    public static final RatNum ZERO = new RatNum(0);

    /** @param n The value of the new RatNum.
        @effects Constructs a new RatNum = n.
    */
    public RatNum(int n) {
        numer = n;
        denom = 1;
        checkRep();
    }

    /** @param n The numerator of the new RatNum.
        @param d The denominator of the new RatNum.
        @effects If d = 0, constructs a new RatNum = NaN.  Else
         constructs a new RatNum = (n / d).
    */
    public RatNum(int n, int d) {
        // special case for zero denominator; gcd(n,d) requires d != 0
        if (d == 0) {
            numer = n;
            denom = 0;

        } else {

            // reduce ratio to lowest terms
            int g = gcd(n,d);
            n = n / g;
            d = d / g;

            if (d < 0) {
                numer = -n;
                denom = -d;
            } else {
                numer = n;
                denom = d;
            }
        }
        checkRep();
    }

    /**
     * Checks that the representation invariant holds (if any).
     **/
    // Throws a RuntimeException if the rep invariant is violated.
    private void checkRep() throws RuntimeException {
        if (denom < 0) {
            throw new RuntimeException("Denominator of a RatNum cannot be less than zero");
        }

        if (denom > 0) {
            int thisGcd = gcd (numer, denom);
            if ((thisGcd != 1) && (thisGcd != -1)) {
                throw new RuntimeException("RatNum not in lowest form");
            }
        }
    }

    /** Returns true if this is NaN
        @return true iff this is NaN (not-a-number)
    */
    public boolean isNaN() {
        return (denom == 0);
    }

    /** Returns true if this is negative.
        @return true iff this < 0. */
    public boolean isNegative() {
        return (compareTo(ZERO) < 0);
    }

    /** Returns true if this is positive.
        @return true iff this > 0. */
    public boolean isPositive() {
        return (compareTo(ZERO) > 0);
    }

    /** Compares two RatNums.
        @param rn The RatNum to be compared.
        @requires rn != null
        @return a negative number if this < rn,
        0 if this = rn,
        a positive number if this > rn.
    */
    @Override
    public int compareTo(RatNum rn) {
        if (this.isNaN() && rn.isNaN()) {
            return 0;
        } else if (this.isNaN()) {
            return 1;
        } else if (rn.isNaN()) {
            return -1;
        } else {
            RatNum diff = this.sub(rn);
            return diff.numer;
        }
    }

    /** Approximates the value of this rational.
        @return a double approximation for this.  Note that "NaN" is
        mapped to {@link Double#NaN}, and the {@link Double#NaN} value
        is treated in a special manner by several arithmetic operations,
        such as the comparison and equality operators.  See the
        <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.2.3">
        Java Language Specification, section 4.2.3</a>, for more details.
    */
    @Override
    public double doubleValue() {
        if (isNaN()) {
            return Double.NaN;
        } else {
            // convert int values to doubles before dividing.
            return ((double)numer) / ((double)denom);
        }
    }

    /** Returns an integer approximation for this.  The rational number
        is rounded to the nearest integer.
     */
    @Override
    public int intValue() {
        // round to nearest by adding +/- .5 before truncating division.
	// we expect the implementation to use "round half away from zero".
	// for more info, see http://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero

        // note that even though the result is guaranteed to fit in an
        // int, we need to use longs for the computation.
        if (numer >= 0) {
            return (int) (((long)numer + (denom/2)) / denom);
        } else {
            return (int) (((long)numer - (denom/2)) / denom);
        }
    }

    /** Returns a float approximation for this.  This method is
        specified by our superclass, Number.
     */
    @Override
    public float floatValue() {
        return (float) doubleValue();
    }


    /** Returns a long approximation for this.  This method is
        specified by our superclass, Number.  The value returned
        is rounded to the nearest long.
     */
    @Override
    public long longValue() {
        return intValue();
    }


    // in the implementation comments for the following methods, <this>
    // is notated as "a/b" and <arg> likewise as "x/y"

    /** Returns the additive inverse of this RatNum.
        @return a Rational equal to (0 - this).
    */
    public RatNum negate() {
        return new RatNum(- this.numer, this.denom);
    }

    /** Addition operation.
        @param arg The other value to be added.
        @requires arg != null
        @return a RatNum equal to (this + arg).
        If either argument is NaN, then returns NaN.
    */
    public RatNum add(RatNum arg) {
        // a/b + x/y = ay/by + bx/by = (ay + bx)/by
        return new RatNum(this.numer*arg.denom + arg.numer*this.denom,
                          this.denom*arg.denom);
    }

    /** Subtraction operation.
        @param arg The value to be subtracted.
        @requires arg != null
        @return a RatNum equal to (this - arg).
        If either argument is NaN, then returns NaN.
    */
    public RatNum sub(RatNum arg) {
        // a/b - x/y = a/b + -x/y
        return this.add(arg.negate());
    }

    /** Multiplication operation.
        @param arg The other value to be multiplied.
        @requires arg != null
        @return a RatNum equal to (this * arg).
        If either argument is NaN, then returns NaN.
    */
    public RatNum mul(RatNum arg) {
        // (a/b) * (x/y) = ax/by
        return new RatNum(this.numer*arg.numer,
                          this.denom*arg.denom );
    }

    /** Division operation.
        @param arg The divisor.
        @requires arg != null
        @return a RatNum equal to (this / arg).
        If arg is zero, or if either argument is NaN, then returns NaN.
    */
    public RatNum div(RatNum arg) {
        // (a/b) / (x/y) = ay/bx
        if (arg.isNaN()) {
            return arg;
        } else {
            return new RatNum(this.numer*arg.denom,
                              this.denom*arg.numer);
        }
    }

    /** Returns the greatest common divisor of 'a' and 'b'.
        @param a, b The numbers for which to find the GCD.
        @requires b != 0
        @return d such that a % d = 0 and b % d = 0
    */
    private static int gcd(int a, int b) {
        // Euclid's method
        if (b == 0) {
            return 0;
        }
        while (b != 0) {
            int tmp = b;
            b = a % b;
            a = tmp;
        }
        return a;
    }

    /** Standard hashCode function.
        @return an int that all objects equal to this will also
        return.
    */
    @Override
    public int hashCode() {
        // all instances that are NaN must return the same hashcode;
        if (this.isNaN()) {
            return 0;
        }
        return this.numer*2 + this.denom*3;
    }

    /** Standard equality operation.
        @param obj The object to be compared for equality.
        @return true if and only if 'obj' is an instance of a RatNum
        and 'this' and 'obj' represent the same rational number.  Note
        that NaN = NaN for RatNums.
    */
    @Override
    public boolean equals(/*@Nullable*/ Object obj) {
        if (obj instanceof RatNum) {
            RatNum rn = (RatNum) obj;

            // special case: check if both are NaN
            if (this.isNaN() && rn.isNaN()) {
                return true;
            } else {
                return this.numer == rn.numer && this.denom == rn.denom;
            }
        } else {
            return false;
        }
    }

    /** @return a String representing this, in reduced terms.
        The returned string will either be "NaN", or it will take on
        either of the forms "N" or "N/M", where N and M are both
        integers in decimal notation and M != 0.
    */
    @Override
    public String toString() {
        // using '+' as String concatenation operator in this method
        if (isNaN()) {
            return "NaN";
        } else if (denom != 1) {
            return numer + "/" + denom;
        } else {
            return Integer.toString(numer);
        }
    }

    /** Makes a RatNum from a string describing it.
        @param ratStr A string of the format described in the @requires clause.
        @requires 'ratStr' is an instance of a string, with no spaces,
        of the form: <UL>
        <LI> "NaN"
        <LI> "N/M", where N and M are both integers in
        decimal notation, and M != 0, or
        <LI> "N", where N is an integer in decimal
        notation.
        </UL>
        @returns NaN if ratStr = "NaN".  Else returns a
        RatNum r = ( N / M ), letting M be 1 in the case
        where only "N" is passed in.
    */
    public static RatNum valueOf(String ratStr) {
        int slashLoc = ratStr.indexOf('/');
        if (ratStr.equals("NaN")) {
            return new RatNum(1,0);
        } else if (slashLoc == -1) {
            // not NaN, and no slash, must be an Integer
            return new RatNum( Integer.parseInt( ratStr ) );
        } else {
            // slash, need to parse the two parts separately
            int n = Integer.parseInt(ratStr.substring(0, slashLoc));
            int d = Integer.parseInt(ratStr.substring(slashLoc+1,
                                                      ratStr.length()));
            return new RatNum(n, d);
        }
    }

    /**
     * Declare a serialization version number. This field is necessary because
     * our parent class (Number) implements Serializable; see the api docs for
     * java.lang.Serializable for more details.
     */
    private static final long serialVersionUID = -8593953691277016262L;
}


================================================
FILE: HW/hw3/RatPoly.java
================================================
package hw3;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

/**
 * <b>RatPoly</b> represents an immutable single-variate polynomial expression.
 * RatPolys are sums of RatTerms with non-negative exponents.
 * <p>
 *
 * Examples of RatPolys include "0", "x-10", and "x^3-2*x^2+5/3*x+3", and "NaN".
 */
// See RatNum's documentation for a definition of "immutable".
public final class RatPoly {
	
    /** Holds all the RatTerms in this RatPoly */
    private final List<RatTerm> terms;

    // Definitions:
    // For a RatPoly p, let C(p,i) be "p.terms.get(i).getCoeff()" and
    // E(p,i) be "p.terms.get(i).getExpt()"
    // length(p) be "p.terms.size()"
    // (These are helper functions that will make it easier for us
    // to write the remainder of the specifications. They are not
    // executable code; they just represent complex expressions in a
    // concise manner, so that we can stress the important parts of
    // other expressions in the spec rather than get bogged down in
    // the details of how we extract the coefficient for the 2nd term
    // or the exponent for the 5th term. So when you see C(p,i),
    // think "coefficient for the ith term in p".)
    //
    // Abstraction Function:
    // RatPoly, p, represents the polynomial equal to the sum of the
    // RatTerms contained in 'terms':
    // sum (0 <= i < length(p)): p.terms.get(i)
    // If there are no terms, then the RatPoly represents the zero
    // polynomial.
    //
    // Representation Invariant for every RatPoly p:
    // terms != null &&
    // forall i such that (0 <= i < length(p)), C(p,i) != 0 &&
    // forall i such that (0 <= i < length(p)), E(p,i) >= 0 &&
    // forall i such that (0 <= i < length(p) - 1), E(p,i) > E(p, i+1)
    // In other words:
    // * The terms field always points to some usable object.
    // * No term in a RatPoly has a zero coefficient.
    // * No term in a RatPoly has a negative exponent.
    // * The terms in a RatPoly are sorted in descending exponent order.
    // (It is implied that 'terms' does not contain any null elements by the
    // above
    // invariant.)

    /** A constant holding a Not-a-Number (NaN) value of type RatPoly */
    public static final RatPoly NaN = new RatPoly(RatTerm.NaN);

    /** A constant holding a zero value of type RatPoly */
    public static final RatPoly ZERO = new RatPoly();

    /**
     * @effects Constructs a new Poly, "0".
     */
    public RatPoly() {
        terms = new ArrayList<RatTerm>();
        checkRep();
    }

    /**
     * @param rt The single term which the new RatPoly equals.
     * @requires rt.getExpt() >= 0
     * @effects Constructs a new Poly equal to "rt". If rt.getCoeff() is zero,
     *          constructs a "0" polynomial.
     */
    public RatPoly(RatTerm rt) {
    	terms = new ArrayList<RatTerm>();
    	// remain empty list, which represents "0" polynomial, if rt.getCoeff is zero 
        if (!(rt.getCoeff().equals(RatNum.ZERO)))
        	terms.add(new RatTerm(rt.getCoeff(), rt.getExpt()));
        checkRep();
    }

    /**
     * @param c The constant in the term which the new RatPoly equals.
     * @param e The exponent in the term which the new RatPoly equals.
     * @requires e >= 0
     * @effects Constructs a new Poly equal to "c*x^e". If c is zero, constructs
     *          a "0" polynomial.
     */
    public RatPoly(int c, int e) {
    	terms = new ArrayList<RatTerm>();
    	// remain empty list, which represents "0" polynomial, if c == 0
        if (!(c == 0))
        	terms.add(new RatTerm(new RatNum(c), e));
        checkRep();
    }

    /**
     * @param rt A list of terms to be contained in the new RatPoly.
     * @requires 'rt' satisfies clauses given in rep. invariant
     * @effects Constructs a new Poly using 'rt' as part of the representation.
     *          The method does not make a copy of 'rt'.
     */
    private RatPoly(List<RatTerm> rt) {
        terms = rt;
        // The spec tells us that we don't need to make a copy of 'rt'
        checkRep();
    }

    /**
     * Returns the degree of this RatPoly.
     *
     * @requires !this.isNaN()
     * @return the largest exponent with a non-zero coefficient, or 0 if this is
     *         "0".
     */
    public int degree() {
        if (terms.size() == 0)
        	return 0;
        return terms.get(0).getExpt();
    }

    /**
     * Gets the RatTerm associated with degree 'deg'
     *
     * @param deg The degree for which to find the corresponding RatTerm.
     * @requires !this.isNaN()
     * @return the RatTerm of degree 'deg'. If there is no term of degree 'deg'
     *         in this poly, then returns the zero RatTerm.
     */
    public RatTerm getTerm(int deg) {
        for (int i = 0; i < terms.size(); i++) {
        	if (terms.get(i).getExpt() == deg)
        		return terms.get(i);
        }
        return RatTerm.ZERO;
    }

    /**
     * Returns true if this RatPoly is not-a-number.
     *
     * @return true if and only if this has some coefficient = "NaN".
     */
    public boolean isNaN() {
        for (int i = 0; i < terms.size(); i++) {
        	if (terms.get(i).isNaN())
        		return true;
        }
        return false;
    }

    /**
     * Scales coefficients within 'lst' by 'scalar' (helper procedure).
     *
     * @param lst The RatTerms to be scaled.
     * @param scalar the value by which to scale coefficients in lst.
     * @requires lst, scalar != null
     * @modifies lst
     * @effects Forall i s.t. 0 <= i < lst.size(), if lst.get(i) = (C . E) then
     *          lst_post.get(i) = (C*scalar . E)
     * @see hw3.RatTerm regarding (C . E) notation
     */
    private static void scaleCoeff(List<RatTerm> lst, RatNum scalar) {
    	if (scalar.equals(RatNum.ZERO)) {
    		// for any RatPoly p, p * 0 = 0
    		lst.clear();
    	} else {
    		for (int i = 0; i < lst.size(); i++)
    			lst.set(i, new RatTerm(lst.get(i).getCoeff().mul(scalar), lst.get(i).getExpt()));
    	}
    }

    /**
     * Increments exponents within 'lst' by 'degree' (helper procedure).
     *
     * @param lst The RatTerms whose exponents are to be incremented.
     * @param degree the value by which to increment exponents in lst.
     * @requires lst != null
     * @modifies lst
     * @effects Forall i s.t. 0 <= i < lst.size(), if (C . E) = lst.get(i) then
     *          lst_post.get(i) = (C . E+degree)
     * @see hw3.RatTerm regarding (C . E) notation
     */
    private static void incremExpt(List<RatTerm> lst, int degree) {
    	if (degree == 0)
    		return;
    	
    	for (int i = 0; i < lst.size(); i++) {
        	lst.set(i, new RatTerm(lst.get(i).getCoeff(), lst.get(i).getExpt() + degree));
        	if (lst.get(i).getExpt() < 0) {
        		// due to allowing degree to be less than 0, need to drop off the terms 
        		// with degree less than zero after the manipulation
        		lst.remove(i);
        		i--;
        	}
    	}
    }

    /**
     * Helper procedure: Inserts a term into a sorted sequence of terms,
     * preserving the sorted nature of the sequence. If a term with the given
     * degree already exists, adds their coefficients.
     *
     * Definitions: Let a "Sorted List<RatTerm>" be a List<RatTerm> V such
     * that [1] V is sorted in descending exponent order && [2] there are no two
     * RatTerms with the same exponent in V && [3] there is no RatTerm in V with
     * a coefficient equal to zero
     *
     * For a Sorted List<RatTerm> V and integer e, let cofind(V, e) be either
     * the coefficient for a RatTerm rt in V whose exponent is e, or zero if
     * there does not exist any such RatTerm in V. (This is like the coeff
     * function of RatPoly.) We will write sorted(lst) to denote that lst is a
     * Sorted List<RatTerm>, as defined above.
     *
     * @param lst The list into which newTerm should be inserted.
     * @param newTerm The term to be inserted into the list.
     * @requires lst != null && sorted(lst)
     * @modifies lst
     * @effects sorted(lst_post) && (cofind(lst_post,newTerm.getExpt()) =
     *          cofind(lst,newTerm.getExpt()) + newTerm.getCoeff())
     */
    private static void sortedInsert(List<RatTerm> lst, RatTerm newTerm) {
    	if (newTerm.isZero())
    		// for any RatPoly p, p + 0 = p 
    		return;
    	
    	// find the appropriate index, based on descending exponent order, to insert
        for (int i = 0; i < lst.size(); i++) {
        	if (newTerm.getExpt() > lst.get(i).getExpt()) {
        		// insert a new term if lst if term with the given degree
        		// doesn't exist
        		lst.add(i, newTerm);
        		return;
        	} else if (newTerm.getExpt() == lst.get(i).getExpt()) {
        		// add newTerm's coeff to original term's coeff in lst
        		lst.set(i, new RatTerm(lst.get(i).getCoeff().add(
        				newTerm.getCoeff()), newTerm.getExpt()));
        		if (lst.get(i).getCoeff().equals(RatNum.ZERO)) {
        			// if adding newTerm make that term become zero coeff, 
        			// remove it and decrease the counter by 1
        			lst.remove(i);
        			i--;
        		}
        		return;
        	}
    	}
        // add newTerm at the end if term with the given degree
        // is smaller than all the terms' degrees in lst
        lst.add(newTerm);
    }
    
    /**
     * Make a copy of all the terms in RatPoly.
     * 
     * @return a copy of all the terms in RatPoly
     */
    private ArrayList<RatTerm> copy() {
    	ArrayList<RatTerm> temp = new ArrayList<RatTerm>();
    	for (int i = 0; i < terms.size(); i++)
    		temp.add(new RatTerm(terms.get(i).getCoeff(), terms.get(i).getExpt()));
    	return temp;
    }

    /**
     * Return the additive inverse of this RatPoly.
     *
     * @return a RatPoly equal to "0 - this"; if this.isNaN(), returns some r
     *         such that r.isNaN()
     */
    public RatPoly negate() {
        if (isNaN())
        	return new RatPoly(RatTerm.NaN);
        
        ArrayList<RatTerm> temp = copy();
        scaleCoeff(temp, new RatNum(-1));
        return new RatPoly(temp);
    }

    /**
     * Addition operation.
     *
     * @param p The other value to be added.
     * @requires p != null
     * @return a RatPoly, r, such that r = "this + p"; if this.isNaN() or
     *         p.isNaN(), returns some r such that r.isNaN()
     */
    public RatPoly add(RatPoly p) {
    	if (this.isNaN() || p.isNaN())
        	return new RatPoly(RatTerm.NaN);
    	
    	ArrayList<RatTerm> temp = p.copy();
    	for (RatTerm rt : terms)
    		sortedInsert(temp, rt);
    	return new RatPoly(temp);
    }

    /**
     * Subtraction operation.
     *
     * @param p The value to be subtracted.
     * @requires p != null
     * @return a RatPoly, r, such that r = "this - p"; if this.isNaN() or
     *         p.isNaN(), returns some r such that r.isNaN()
     */
    public RatPoly sub(RatPoly p) {
    	if (this.isNaN() || p.isNaN())
        	return new RatPoly(RatTerm.NaN);
    	
    	// this - p = this + (-p)
        return add(p.negate());
    }

    /**
     * Multiplication operation.
     *
     * @param p The other value to be multiplied.
     * @requires p != null
     * @return a RatPoly, r, such that r = "this * p"; if this.isNaN() or
     *         p.isNaN(), returns some r such that r.isNaN()
     */
    public RatPoly mul(RatPoly p) {
    	if (this.isNaN() || p.isNaN())
        	return new RatPoly(RatTerm.NaN);
    	
    	RatPoly result = new RatPoly(); // zero polynomial
    	for (RatTerm rt : terms) {
    		ArrayList<RatTerm> temp = p.copy();
    		// say this = a*x^b, p = c*x^d + e,
    		// p * a = a * (c*x^d + e) = (a*c)*x^d + (a*e)
    		scaleCoeff(temp, rt.getCoeff());
    		// ((a*c)*x^d + (a*e)) * x^b = (a*c)*x^(b+d) + (a*e)*x^b
    		incremExpt(temp, rt.getExpt());
    		// sum up every part of multiplication's results 
    		// to get this * p
    		result = result.add(new RatPoly(temp));
    		
    	}
    	result.checkRep();
    	return result;
    }

    /**
     * Division operation (truncating).
     *
     * @param p The divisor.
     * @requires p != null
     * @return a RatPoly, q, such that q = "this / p"; if p = 0 or this.isNaN()
     *         or p.isNaN(), returns some q such that q.isNaN()
     *         <p>
     *
     * Division of polynomials is defined as follows: Given two polynomials u
     * and v, with v != "0", we can divide u by v to obtain a quotient
     * polynomial q and a remainder polynomial r satisfying the condition u = "q *
     * v + r", where the degree of r is strictly less than the degree of v, the
     * degree of q is no greater than the degree of u, and r and q have no
     * negative exponents.
     * <p>
     *
     * For the purposes of this class, the operation "u / v" returns q as
     * defined above.
     * <p>
     *
     * The following are examples of div's behavior: "x^3-2*x+3" / "3*x^2" =
     * "1/3*x" (with r = "-2*x+3"). "x^2+2*x+15 / 2*x^3" = "0" (with r =
     * "x^2+2*x+15"). "x^3+x-1 / x+1 = x^2-x+2 (with r = "-3").
     * <p>
     *
     * Note that this truncating behavior is similar to the behavior of integer
     * division on computers.
     */
    public RatPoly div(RatPoly p) {
    	if (p.terms.size() == 0 || (this.isNaN() || p.isNaN()))
        	return new RatPoly(RatTerm.NaN);
    	
    	RatPoly q = new RatPoly(); // "0" polynomial, to hold result of quotient
    	RatPoly r = new RatPoly(this.copy()); // remainder
    	
    	// keep doing division if reminder is not zero or 
    	// remainder's degree is greater than or equal to divisor's degree
    	while (r.terms.size() != 0 && r.degree() >= p.degree()) {
    		// highest term of r: r_h, highest term of p: p_h, 
    		// quotient of this term's division : t
    		// r_h / p_h = t
    		RatNum c = r.terms.get(0).getCoeff().div(p.terms.get(0).getCoeff());
    		RatPoly t = new RatPoly(new RatTerm(c, r.degree() - p.degree()));
    		
    		// add quotient of this term's division to the quotient so far
    		// q_post = q_pre + t = q_pre + r_h / p_h
    		q = q.add(t);
    		// subtract remainder by (quotient of the term's division * divisor)
    		// r_post = r_pre - t * p
    		r = r.sub(t.mul(p));
    	}
        q.checkRep();
        return q;
    }

    /**
     * Return the derivative of this RatPoly.
     *
     * @return a RatPoly, q, such that q = dy/dx, where this == y. In other
     *         words, q is the derivative of this. If this.isNaN(), then return
     *         some q such that q.isNaN()
     *
     * <p>
     * The derivative of a polynomial is the sum of the derivative of each term.
     */
    public RatPoly differentiate() {
    	if (isNaN())
    		return new RatPoly(RatTerm.NaN);
    	
    	ArrayList<RatTerm> temp = copy();
    	for (int i = 0; i < temp.size(); i++) {
    		if (temp.get(i).getExpt() == 0) {
    			// y = c*x^0 = c, dy/dx = 0
    			// dropping of term with zero coeff to make rep invariant holds
    			temp.remove(i);
    			i--;
    		} else {
    			temp.set(i, temp.get(i).differentiate());
    		}
    	}
        return new RatPoly(temp);
    }

    /**
     * Returns the antiderivative of this RatPoly.
     *
     * @param integrationConstant The constant of integration to use when
     *  computating the antiderivative.
     * @requires integrationConstant != null
     * @return a RatPoly, q, such that dq/dx = this and the constant of
     *         integration is "integrationConstant" In other words, q is the
     *         antiderivative of this. If this.isNaN() or
     *         integrationConstant.isNaN(), then return some q such that
     *         q.isNaN()
     *
     * <p>
     * The antiderivative of a polynomial is the sum of the antiderivative of
     * each term plus some constant.
     */
    public RatPoly antiDifferentiate(RatNum integrationConstant) {
    	if (this.isNaN() || integrationConstant.isNaN())
    		return new RatPoly(RatTerm.NaN);
    	
    	ArrayList<RatTerm> temp = copy();
    	for (int i = 0; i < temp.size(); i++)
    		temp.set(i, temp.get(i).antiDifferentiate());
    	
    	// check if integrationConstant is zero to avoid 
    	// adding zero coeff term to make rep invariant hold
    	if (!integrationConstant.equals(RatNum.ZERO))
    		temp.add(new RatTerm(integrationConstant, 0));
    	
    	return new RatPoly(temp);
    }

    /**
     * Returns the integral of this RatPoly, integrated from lowerBound to
     * upperBound.
     *
     * <p>
     * The Fundamental Theorem of Calculus states that the definite integral of
     * f(x) with bounds a to b is F(b) - F(a) where dF/dx = f(x) NOTE: Remember
     * that the lowerBound can be higher than the upperBound.
     *
     * @param lowerBound The lower bound of integration.
     * @param upperBound The upper bound of integration.
     * @return a double that is the definite integral of this with bounds of
     *         integration between lowerBound and upperBound. If this.isNaN(),
     *         or either lowerBound or upperBound is Double.NaN, return
     *         Double.NaN.
     */
    public double integrate(double lowerBound, double upperBound) {
    	if (this.isNaN() || Double.isNaN(lowerBound) || Double.isNaN(upperBound))
    		return Double.NaN;
    	
    	RatPoly antiDiff = antiDifferentiate(new RatNum(1));
    	return antiDiff.eval(upperBound) - antiDiff.eval(lowerBound);
    }

    /**
     * Returns the value of this RatPoly, evaluated at d.
     *
     * @param d The value at which to evaluate this polynomial.
     * @return the value of this polynomial when evaluated at 'd'. For example,
     *         "x+2" evaluated at 3 is 5, and "x^2-x" evaluated at 3 is 6. if
     *         (this.isNaN() == true), return Double.NaN
     */
    public double eval(double d) {
        if (isNaN())
        	return Double.NaN;
        
        double result = 0;
        // this = f(x) = a*x^b + c*x^e + ... => f(d) = a*d^b + c*d^e + ...
        for (RatTerm rt : terms)
        	result += rt.eval(d);
        return result;
    }

    /**
     * Returns a string representation of this RatPoly.
     *
     * @return A String representation of the expression represented by this,
     *         with the terms sorted in order of degree from highest to lowest.
     *         <p>
     *         There is no whitespace in the returned string.
     *         <p>
     *         If the polynomial is itself zero, the returned string will just
     *         be "0".
     *         <p>
     *         If this.isNaN(), then the returned string will be just "NaN"
     *         <p>
     *         The string for a non-zero, non-NaN poly is in the form
     *         "(-)T(+|-)T(+|-)...", where "(-)" refers to a possible minus
     *         sign, if needed, and "(+|-)" refer to either a plus or minus
     *         sign, as needed. For each term, T takes the form "C*x^E" or "C*x"
     *         where C > 0, UNLESS: (1) the exponent E is zero, in which case T
     *         takes the form "C", or (2) the coefficient C is one, in which
     *         case T takes the form "x^E" or "x". In cases were both (1) and
     *         (2) apply, (1) is used.
     *         <p>
     *         Valid example outputs include "x^17-3/2*x^2+1", "-x+1", "-1/2",
     *         and "0".
     *         <p>
     */
    @Override
    public String toString() {
        if (terms.size() == 0) {
            return "0";
        }
        if (isNaN()) {
            return "NaN";
        }
        StringBuilder output = new StringBuilder();
        boolean isFirst = true;
        for (RatTerm rt : terms) {
            if (isFirst) {
                isFirst = false;
                output.append(rt.toString());
            } else {
                if (rt.getCoeff().isNegative()) {
                    output.append(rt.toString());
                } else {
                    output.append("+" + rt.toString());
                }
            }
        }
        return output.toString();
    }

    /**
     * Builds a new RatPoly, given a descriptive String.
     *
     * @param polyStr A string of the format described in the @requires clause.
     * @requires 'polyStr' is an instance of a string with no spaces that
     *           expresses a poly in the form defined in the toString() method.
     *           <p>
     *
     * Valid inputs include "0", "x-10", and "x^3-2*x^2+5/3*x+3", and "NaN".
     *
     * @return a RatPoly p such that p.toString() = polyStr
     */
    public static RatPoly valueOf(String polyStr) {

        List<RatTerm> parsedTerms = new ArrayList<RatTerm>();

        // First we decompose the polyStr into its component terms;
        // third arg orders "+" and "-" to be returned as tokens.
        StringTokenizer termStrings = new StringTokenizer(polyStr, "+-", true);

        boolean nextTermIsNegative = false;
        while (termStrings.hasMoreTokens()) {
            String termToken = termStrings.nextToken();

            if (termToken.equals("-")) {
                nextTermIsNegative = true;
            } else if (termToken.equals("+")) {
                nextTermIsNegative = false;
            } else {
                // Not "+" or "-"; must be a term
                RatTerm term = RatTerm.valueOf(termToken);

                // at this point, coeff and expt are initialized.
                // Need to fix coeff if it was preceeded by a '-'
                if (nextTermIsNegative) {
                    term = term.negate();
                }

                // accumulate terms of polynomial in 'parsedTerms'
                sortedInsert(parsedTerms, term);
            }
        }
        return new RatPoly(parsedTerms);
    }

    /**
     * Standard hashCode function.
     *
     * @return an int that all objects equal to this will also return.
     */
    @Override
    public int hashCode() {
        // all instances that are NaN must return the same hashcode;
        if (this.isNaN()) {
            return 0;
        }
        return terms.hashCode();
    }

    /**
     * Standard equality operation.
     *
     * @param obj The object to be compared for equality.
     * @return true if and only if 'obj' is an instance of a RatPoly and 'this'
     *         and 'obj' represent the same rational polynomial. Note that all
     *         NaN RatPolys are equal.
     */
    @Override
    public boolean equals(/*@Nullable*/ Object obj) {
        if (obj instanceof RatPoly) {
            RatPoly rp = (RatPoly) obj;

            // special case: check if both are NaN
            if (this.isNaN() && rp.isNaN()) {
                return true;
            } else {
                return terms.equals(rp.terms);
            }
        } else {
            return false;
        }
    }

    /**
     * Checks that the representation invariant holds (if any).
     */
    // Throws a RuntimeException if the rep invariant is violated.
    private void checkRep() throws RuntimeException {
    	if (terms == null) {
            throw new RuntimeException("terms == null");
        }
        for (int i = 0; i < terms.size(); i++) {
            if (terms.get(i).getCoeff().equals(new RatNum(0))) {
                throw new RuntimeException("zero coefficient");
            }
            if (terms.get(i).getExpt() < 0) {
                throw new RuntimeException("negative exponent");
            }
            if (i < terms.size() - 1) {
                if (terms.get(i + 1).getExpt() >= terms.get(i).getExpt()) {
                    throw new RuntimeException("terms out of order");
                }
            }
        }
    }
}


================================================
FILE: HW/hw3/RatPolyStack.java
================================================
package hw3;

import java.util.Iterator;
import java.util.Stack;

/**
 * <b>RatPolyStack</B> is a mutable finite sequence of RatPoly objects.
 * <p>
 * Each RatPolyStack can be described by [p1, p2, ... ], where [] is an empty
 * stack, [p1] is a one element stack containing the Poly 'p1', and so on.
 * RatPolyStacks can also be described constructively, with the append
 * operation, ':'. such that [p1]:S is the result of putting p1 at the front of
 * the RatPolyStack S.
 * <p>
 * A finite sequence has an associated size, corresponding to the number of
 * elements in the sequence. Thus the size of [] is 0, the size of [p1] is 1,
 * the size of [p1, p1] is 2, and so on.
 * <p>
 */
public final class RatPolyStack implements Iterable<RatPoly> {

    private final Stack<RatPoly> polys;

    // Abstraction Function:
    // Each element of a RatPolyStack, s, is mapped to the
    // corresponding element of polys.
    //
    // RepInvariant:
    // polys != null &&
    // forall i such that (0 <= i < polys.size(), polys.get(i) != null

    /**
     * @effects Constructs a new RatPolyStack, [].
     */
    public RatPolyStack() {
        polys = new Stack<RatPoly>();
        checkRep();
    }

    /**
     * Returns the number of RayPolys in this RatPolyStack.
     *
     * @return the size of this sequence.
     */
    public int size() {
        int size = 0;
        Iterator<RatPoly> it = iterator();
        while (it.hasNext()) {
        	size++;
        	it.next();
        }
        return size;
    }

    /**
     * Pushes a RatPoly onto the top of this.
     *
     * @param p The RatPoly to push onto this stack.
     * @requires p != null
     * @modifies this
     * @effects this_post = [p]:this
     */
    public void push(RatPoly p) {
    	checkRep();
    	polys.push(p);
        checkRep();
    }

    /**
     * Removes and returns the top RatPoly.
     *
     * @requires this.size() > 0
     * @modifies this
     * @effects If this = [p]:S then this_post = S
     * @return p where this = [p]:S
     */
    public RatPoly pop() {
    	checkRep();
    	RatPoly top = polys.pop();
    	checkRep();
    	return top;
    }

    /**
     * Duplicates the top RatPoly on this.
     *
     * @requires this.size() > 0
     * @modifies this
     * @effects If this = [p]:S then this_post = [p, p]:S
     */
    public void dup() {
    	checkRep();
        polys.push(polys.peek());
        checkRep();
    }

    /**
     * Swaps the top two elements of this.
     *
     * @requires this.size() >= 2
     * @modifies this
     * @effects If this = [p1, p2]:S then this_post = [p2, p1]:S
     */
    public void swap() {
    	checkRep();
    	RatPoly p1 = polys.pop();
    	RatPoly p2 = polys.pop();
    	polys.push(p1);
    	polys.push(p2);
    	checkRep();
    }

    /**
     * Clears the stack.
     *
     * @modifies this
     * @effects this_post = []
     */
    public void clear() {
    	checkRep();
        polys.clear();
        checkRep();
    }

    /**
     * Returns the RatPoly that is 'index' elements from the top of the stack.
     *
     * @param index The index of the RatPoly to be retrieved.
     * @requires index >= 0 && index < this.size()
     * @return If this = S:[p]:T where S.size() = index, then returns p.
     */
    public RatPoly getNthFromTop(int index) {
    	checkRep();
    	Stack<RatPoly> temp = new Stack<RatPoly>();
    	// use another stack to hold all the elements before 'index' element
    	for (int i = 0; i < index; i++)
    		temp.push(polys.pop());
    	RatPoly p = polys.peek();
    	// push all those elements back to original stack
    	for (int i = 0; i < index; i++)
    		polys.push(temp.pop());
    	checkRep();
    	return p;
    }

    /**
     * Pops two elements off of the stack, adds them, and places the result on
     * top of the stack.
     *
     * @requires this.size() >= 2
     * @modifies this
     * @effects If this = [p1, p2]:S then this_post = [p3]:S where p3 = p1 + p2
     */
    public void add() {
    	checkRep();
    	RatPoly p1 = polys.pop();
    	RatPoly p2 = polys.pop();
    	polys.push(p1.add(p2));
    	checkRep();
    }

    /**
     * Subtracts the top poly from the next from top poly, pops both off the
     * stack, and places the result on top of the stack.
     *
     * @requires this.size() >= 2
     * @modifies this
     * @effects If this = [p1, p2]:S then this_post = [p3]:S where p3 = p2 - p1
     */
    public void sub() {
    	checkRep();
    	RatPoly p1 = polys.pop();
    	RatPoly p2 = polys.pop();
    	polys.push(p2.sub(p1));
    	checkRep();
    }

    /**
     * Pops two elements off of the stack, multiplies them, and places the
     * result on top of the stack.
     *
     * @requires this.size() >= 2
     * @modifies this
     * @effects If this = [p1, p2]:S then this_post = [p3]:S where p3 = p1 * p2
     */
    public void mul() {
    	checkRep();
    	RatPoly p1 = polys.pop();
    	RatPoly p2 = polys.pop();
    	polys.push(p1.mul(p2));
    	checkRep();
    }

    /**
     * Divides the next from top poly by the top poly, pops both off the stack,
     * and places the result on top of the stack.
     *
     * @requires this.size() >= 2
     * @modifies this
     * @effects If this = [p1, p2]:S then this_post = [p3]:S where p3 = p2 / p1
     */
    public void div() {
    	checkRep();
    	RatPoly p1 = polys.pop();
    	RatPoly p2 = polys.pop();
    	polys.push(p2.div(p1));
    	checkRep();
    }

    /**
     * Pops the top element off of the stack, differentiates it, and places the
     * result on top of the stack.
     *
     * @requires this.size() >= 1
     * @modifies this
     * @effects If this = [p1]:S then this_post = [p2]:S where p2 = derivative
     *          of p1
     */
    public void differentiate() {
    	checkRep();
    	RatPoly p1 = polys.pop();
    	polys.push(p1.differentiate());
    	checkRep();
    }

    /**
     * Pops the top element off of the stack, integrates it, and places the
     * result on top of the stack.
     *
     * @requires this.size() >= 1
     * @modifies this
     * @effects If this = [p1]:S then this_post = [p2]:S where p2 = indefinite
     *          integral of p1 with integration constant 0
     */
    public void integrate() {
    	checkRep();
    	RatPoly p1 = polys.pop();
    	polys.push(p1.antiDifferentiate(new RatNum(0)));
    	checkRep();
    }

    /**
     * Returns an iterator of the elements contained in the stack.
     *
     * @return an iterator of the elements contained in the stack in order from
     *         the bottom of the stack to the top of the stack.
     */
    @Override
    public Iterator<RatPoly> iterator() {
        return polys.iterator();
    }

    /**
     * Checks that the representation invariant holds (if any).
     */
    // Throws a RuntimeException if the rep invariant is violated.
    private void checkRep() throws RuntimeException {
        /*assert polys != null: "polys should never be null.";
        for (RatPoly p : polys) {
        	assert p != null: "polys should never contain a null element.";
        }*/
        
        
    	if (polys == null) {
            throw new RuntimeException("polys should never be null.");
        }
        for (RatPoly p : polys) {
            if (p == null) {
                throw new RuntimeException(
                        "polys should never contain a null element.");
            }
        }
    }
}


================================================
FILE: HW/hw3/RatTerm.java
================================================
package hw3;

/**
 * <b>RatTerm</b> is an immutable representation of a term in a single-variable
 * polynomial expression. The term has the form C*x^E where C is a rational
 * number and E is an integer.
 * <p>
 *
 * A RatTerm, t, can be notated by the pair (C . E), where C is the coefficient
 * of t, and E is the exponent of t.
 * <p>
 *
 * The zero RatTerm, (0 . 0), is the only RatTerm that may have a zero
 * coefficient. For example, (0 . 7) is an invalid RatTerm and an attempt to
 * construct such a RatTerm (through the constructor or arithmetic operations on
 * existing RatTerms) will return the semantically equivalent RatTerm (0 . 0).
 * For example, (1 . 7) + (-1 . 7) = (0 . 0).
 * <p>
 *
 * (0 . 0), (1 . 0), (1 . 1), (1 . 3), (3/4 . 17), (7/2 . -1), and (NaN . 74)
 * are all valid RatTerms, corresponding to the polynomial terms "0", "1", "x",
 * "x^3", "3/4*x^17", "7/2*x^-1" and "NaN*x^74", respectively.
 */
// See RatNum's documentation for a definition of "immutable".
public final class RatTerm {

    /** Coefficient of this term. */
    private final RatNum coeff;

    /** Exponent of this term. */
    private final int expt;

    // Abstraction Function:
    // For a given RatTerm t, "coefficient of t" is synonymous with
    // t.coeff, and, likewise, "exponent of t" is synonymous with t.expt.
    // All RatTerms with a zero coefficient are represented by the
    // zero RatTerm, z, which has zero for its coefficient AND exponent.
    //
    // Representation Invariant:
    // coeff != null
    // coeff.equals(RatNum.ZERO) ==> expt == 0

    /** A constant holding a Not-a-Number (NaN) value of type RatTerm */
    public static final RatTerm NaN = new RatTerm(RatNum.NaN, 0);

    /** A constant holding a zero value of type RatTerm */
    public static final RatTerm ZERO = new RatTerm(RatNum.ZERO, 0);

    /** A constant holding a one value of type RatTerm */
    private static final RatNum ONE = new RatNum(1);

    /**
     * @param c the coefficient of the RatTerm to be constructed.
     * @param e the exponent of the RatTerm to be constructed.
     * @requires c != null
     * @effects Constructs a new RatTerm t, with t.coeff = c, and if
     *          c.equals(RatNum.ZERO), then t.expt = 0, otherwise t.expt = e
     */
    public RatTerm(RatNum c, int e) {
    	// special case for zero coefficient
        if (c.equals(RatNum.ZERO)) {
        	coeff = c;
            expt = 0;
        } else {
        	coeff = c;
        	expt = e;
        }
        checkRep(); // check if representation invariant holds
    }

    /**
     * Gets the coefficient of this RatTerm.
     *
     * @return the coefficient of this RatTerm.
     */
    public RatNum getCoeff() {
    	return coeff;
    }

    /**
     * Gets the exponent of this RatTerm.
     *
     * @return the exponent of this RatTerm.
     */
    public int getExpt() {
        return expt;
    }

    /**
     * Returns true if this RatTerm is not-a-number.
     *
     * @return true if and only if this has NaN as a coefficient.
     */
    public boolean isNaN() {
        return coeff.isNaN();
    }

    /**
     * Returns true if this RatTerm is equal to 0.
     *
     * @return true if and only if this has zero as a coefficient.
     */
    public boolean isZero() {
        return coeff.equals(RatNum.ZERO);
    }

    /**
     * Returns the value of this RatTerm, evaluated at d.
     *
     * @param d The value at which to evaluate this term.
     * @return the value of this polynomial when evaluated at 'd'. For example,
     *         "3*x^2" evaluated at 2 is 12. if (this.isNaN() == true), return
     *         Double.NaN
     */
    public double eval(double d) {
    	if (isNaN())
    		return Double.NaN;
        
    	return coeff.doubleValue() * Math.pow(d, expt);
    }

    /**
     * Negation operation.
     *
     * @return a RatTerm equals to (-this). If this is NaN, then returns NaN.
     */
    public RatTerm negate() {
        return new RatTerm(coeff.negate(), expt);
    }

    /**
     * Addition operation.
     *
     * @param p The other value to be added.
     * @requires arg != null
     * @return a RatTerm equals to (this + arg). If either argument is NaN, then
     *         returns NaN.
     * @throws IllegalArgumentException
     *             if (this.expt != arg.expt) and neither argument is zero or
     *             NaN.
     */
    public RatTerm add(RatTerm p) {
    	if (this.isNaN() || p.isNaN())
    		return new RatTerm(RatNum.NaN, this.expt);
    	
    	else if (this.isZero())
    		// 0 + a*x^b = a*x^b
    		return new RatTerm(p.coeff, p.expt);
    	
    	else if (p.isZero())
    		// a*x^b + 0 = a*x^b
    		return new RatTerm(this.coeff, this.expt);
    	
    	else if (this.expt != p.expt)
    		throw new IllegalArgumentException("Argument p must have the " +
    				"same exponent as this term.");
    	
    	// (a*x^c) + (b*x^c) = (a+b)*x^c
    	return new RatTerm(this.coeff.add(p.coeff), this.expt);
    }

    /**
     * Subtraction operation.
     *
     * @param p The value to be subtracted.
     * @requires arg != null
     * @return a RatTerm equals to (this - arg). If either argument is NaN, then
     *         returns NaN.
     * @throws IllegalArgumentException
     *             if (this.expt != arg.expt) and neither argument is zero or
     *             NaN.
     */
    public RatTerm sub(RatTerm p) {
    	if (this.isNaN() || p.isNaN())
    		return new RatTerm(RatNum.NaN, this.expt);
    	
    	else if (this.isZero())
    		// 0 - a*x^b = -a*x^b
    		return new RatTerm(p.coeff.negate(), p.expt);
    	
    	else if (p.isZero())
    		// a*x^b - 0 = a*x^b
    		return new RatTerm(this.coeff, this.expt);
    	
    	else if (this.expt != p.expt)
    		throw new IllegalArgumentException("Argument p must have the " +
    				"same exponent as this term.");
    	
    	// (a*x^c) - (b*x^c) = (a-b)*x^c
    	return new RatTerm(this.coeff.sub(p.coeff), this.expt);
    }

    /**
     * Multiplication operation.
     *
     * @param p The other value to be multiplied.
     * @requires arg != null
     * @return a RatTerm equals to (this * arg). If either argument is NaN, then
     *         returns NaN.
     */
    public RatTerm mul(RatTerm p) {
    	if (this.isNaN() || p.isNaN())
    		return new RatTerm(RatNum.NaN, this.expt);
    	
    	// (a*x^b) * (c*x^d) = (a*c)*x^(b+d)
        return new RatTerm(this.coeff.mul(p.coeff), this.expt + p.expt);
    }

    /**
     * Division operation.
     *
     * @param p The divisor.
     * @requires arg != null
     * @return a RatTerm equals to (this / arg). If arg is zero, or if either
     *         argument is NaN, then returns NaN.
     */
    public RatTerm div(RatTerm p) {
    	if (p.isZero() || (this.isNaN() || p.isNaN()))
    		return new RatTerm(RatNum.NaN, this.expt);
    	
    	// (a*x^b) / (c*x^d) = (a/c)*x^(b-d)
        return new RatTerm(this.coeff.div(p.coeff), this.expt - p.expt);
    }

    /**
     * Return the derivative of this RatTerm.
     *
     * @return a RatTerm that, q, such that q = dy/dx, where this == y. In other
     *         words, q is the derivative of this. If this.isNaN(), then return
     *         some q such that q.isNaN()
     *         <p>
     *         Given a term, a*x^b, the derivative of the term is: (a*b)*x^(b-1)
     *         for b > 0 and 0 for b == 0 (Do not worry about the case when b <
     *         0. The caller of this function, RatPoly, contains a rep.
     *         invariant stating that b is never less than 0.)
     */
    public RatTerm differentiate() {
        if (isNaN())
        	return new RatTerm(RatNum.NaN, 0);
        
        else if (expt == 0)
        	// y = 0, dy/dx = 0
        	return new RatTerm(RatNum.ZERO, 0);
        
        return new RatTerm(coeff.mul(new RatNum(expt)), expt - 1);
    }

    /**
     * Returns the antiderivative of this RatTerm.
     *
     * @return a RatTerm, q, such that dq/dx = this where the constant of
     *         intergration is assumed to be 0. In other words, q is the
     *         antiderivative of this. If this.isNaN(), then return some q such
     *         that q.isNaN()
     *         <p>
     *         Given a term, a*x^b, (where b >= 0) the antiderivative of the
     *         term is: a/(b+1)*x^(b+1) (Do not worry about the case when b < 0.
     *         The caller of this function, RatPoly, contains a rep. invariant
     *         stating that b is never less than 0.)
     */
    public RatTerm antiDifferentiate() {
        if (isNaN())
        	return new RatTerm(RatNum.NaN, 0);
        
        return new RatTerm(coeff.div(new RatNum(expt + 1)), expt + 1);
    }

    /**
     * Returns a string representation of this RatTerm.
     *
     * @return A String representation of the expression represented by this.
     *         <p>
     *         There is no whitespace in the returned string.
     *         <p>
     *         If the term is itself zero, the returned string will just be "0".
     *         <p>
     *         If this.isNaN(), then the returned string will be just "NaN"
     *         <p>
     *
     * The string for a non-zero, non-NaN RatTerm is in the form "C*x^E" where C
     * is a valid string representation of a RatNum (see {@link hw3.RatNum}'s
     * toString method) and E is an integer. UNLESS: (1) the exponent E is zero,
     * in which case T takes the form "C" (2) the exponent E is one, in which
     * case T takes the form "C*x" (3) the coefficient C is one, in which case T
     * takes the form "x^E" or "x" (if E is one) or "1" (if E is zero).
     * <p>
     * Valid example outputs include "3/2*x^2", "-1/2", "0", and "NaN".
     */
    @Override
    public String toString() {
        if (this.isNaN()) {
            return "NaN";
        }
        StringBuilder output = new StringBuilder();
        RatNum c = coeff;
        int e = expt;
        if (c.isNegative()) {
            output.append("-");
            c = c.negate();
        }
        if (c.equals(ONE) && e == 1) {
            output.append("x");
        } else if (e == 0) {
            output.append(c.toString());
        } else if (c.equals(ONE)) {
            output.append("x^" + e);
        } else if (e == 1) {
            output.append(c.toString() + "*x");
        } else {
            output.append(c.toString() + "*x^" + e);
        }
        return output.toString();
    }

    /**
     * Builds a new RatTerm, given a descriptive String.
     *
     * @param ratStr A string of the format described in the @requires clause.
     * @requires 'termStr' is an instance of a string with no spaces that
     *           expresses a RatTerm in the form defined in the toString()
     *           method.
     *           <p>
     *
     * Valid inputs include "0", "x", and "-5/3*x^3", and "NaN".
     *
     * @return a RatTerm t such that t.toString() = termStr
     */
    public static RatTerm valueOf(String termStr) {
        if (termStr.equals("NaN")) {
            return NaN;
        }

        // Term is: "R" or "R*x" or "R*x^N" or "x^N" or "x",
        // where R is a rational num and N is an integer.

        // First we parse the coefficient
        int multIndex = termStr.indexOf("*");
        RatNum coeff = null;
        if (multIndex == -1) {
            // "R" or "x^N" or "x"
            int xIndex = termStr.indexOf("x");
            if (xIndex == -1) {
                // "R"
                coeff = RatNum.valueOf(termStr);
            } else {
                int negIndex = termStr.indexOf("-");
                // "x^N" or "x" ==> coeff = 1
                if (negIndex == -1) {
                    coeff = new RatNum(1);
                }
                // "-x^N" or "-x" ==> coeff = -1
                else if (negIndex == 0) {
                    coeff = new RatNum(-1);
                } else {
                    throw new RuntimeException(
                            "Minus sign, '-', not allowed in the middle of input string: "
                                    + termStr);
                }
            }
        } else {
            // "R*x" or "R*x^N"
            coeff = RatNum.valueOf(termStr.substring(0, multIndex));
        }

        // Second we parse the exponent
        int powIndex = termStr.indexOf("^");
        int expt;
        if (powIndex == -1) {
            // "R" or "R*x" or "x"
            int xIndex = termStr.indexOf("x");
            if (xIndex == -1) {
                // "R"
                expt = 0;
            } else {
                // "R*x" or "x"
                expt = 1;
            }
        } else {
            // "R*x^N" or "x^N"
            expt = Integer.parseInt(termStr.substring(powIndex + 1));
        }
        return new RatTerm(coeff, expt);
    }

    /**
     * Standard hashCode function.
     *
     * @return an int that all objects equal to this will also.
     */
    @Override
    public int hashCode() {
        if (this.isNaN()) {
            return 0;
        }
        return coeff.hashCode() * 7 + expt * 43;
    }

    /**
     * Standard equality operation.
     *
     * @param obj The object to be compared for equality.
     * @return true iff 'obj' is an instance of a RatTerm and 'this' and 'obj'
     *         represent the same RatTerm. Note that all NaN RatTerms are equal.
     */
    @Override
    public boolean equals(/*@Nullable*/ Object obj) {
        if (obj instanceof RatTerm) {
            RatTerm rt = (RatTerm) obj;
            if (this.isNaN() && rt.isNaN()) {
                return true;
            } else {
                return this.expt == rt.expt && this.coeff.equals(rt.coeff);
            }
        } else {
            return false;
        }
    }

    /**
     * Checks that the representation invariant holds (if any).
     * Throws an exception if the rep invariant is violated.
     */
    private void checkRep() throws RuntimeException {
       // assert coeff != null: "coeff == null";
       // assert !(coeff.equals(RatNum.ZERO) && expt != 0): "coeff is zero while expt == " + expt;
        
    	if (coeff == null) {
            throw new RuntimeException("coeff == null");
        }
        if (coeff.equals(RatNum.ZERO) && expt != 0) {
            throw new RuntimeException("coeff is zero while expt == " + expt);
        }
    }
}


================================================
FILE: HW/hw3/answers/problem1.txt
================================================
Chun-Wei Chen
CSE 331
Homework 3
04/19/13

a. Explain what the return statement, which is creating a new RatNum 
   object with appropriate arguments, does.
   
b. If this is null, it will throw NullPointerException instantly when 
   the method is called, which is before trying to access the instance 
   variable; therefore, there's no need to check this != null.
   
c. If the argument passed to add and mul is NaN, they will return NaN 
   because the result's denominator is 0 due to multiply with NaN's 0 
   denominator. div needs to check if the argument is NaN in order to 
   satisfy, "Any arithmetic operation involving 'NaN' will return 'NaN,'" 
   since the multiplication with argument's numerator is in the result's 
   numerator, which will result in zero instead of NaN.
   
d. It's a static method since it doesn't access to instance variables of 
   RatNum. An alternative way would be to make a new constructor which 
   takes a string as argument.
   
e. Constructor with two parameters should remove gcd part in order to 
   satisfy new rep invariant, which is more efficient since it can now 
   construct a RatNum in O(1). equals and hashCode need to use gcd inside 
   the method in order to return true or same hashcode for same rational 
   number, such as 1/2 and 2/4, which makes them less efficient due to 
   adding gcd. toString also needs to use gcd in order to satisfy the 
   spec, which makes it less efficient because of gcd method which 
   contains a loop.
   
f. It fails to meet the specification since the specification doesn't 
   have modifies clause says that this is modified by the method. It 
   also fails to meet class specifications since the class 
   specification says RatNum represents an immutable rational number 
   while the new version of the method does mutate it.
   
g. Since there's no mutator method in RatNum class, the instance 
   variables of RatNum are declared as final, which can only be 
   initialized once, and all methods of arithmetic return a new RatNum 
   object without modifying original object(s); therefore, checkRep at 
   the end of constructor is sufficient to hold rep invariant.																 

================================================
FILE: HW/hw3/answers/problem2.txt
================================================
Chun-Wei Chen
CSE 331
Homework 3
04/19/13

a. I only included a call to checkRep at the end of constructor since there's 
   no mutator method in the class, the instance variables are declared as 
   final (can only be initialized once), and all methods of arithmetic, 
   differentiate and antidifferentiate return a new RatTerm object without 
   modifying original object(s); therefore, checkRep at the end of constructor 
   is sufficient to hold rep invariant.
   
b. isZero should be change, and I would negate the coeff and then compare the 
   equality (using equals) with original coeff, which is more complex in terms 
   of code clarity since it uses two method call to determine if coeff is zero. 
   toString should add a check of isZero before checking e == 1 and then 
   append 0 to output if isZero is true, which is more complex since it needs 
   another condition check.
   
c. The constructor needs to be changed so that when passing in a NaN and any 
   exponent should be NaN instead of NaN*x^expt.
   
I prefer both since the rep invariant allows us to avoid terms such as 0*x^3 
and NaN*x^5 so that we don't need to worry about different representation of 
them when doing add, sub, mul, or div.																			

================================================
FILE: HW/hw3/answers/problem5.txt
================================================
Chun-Wei Chen
CSE 331
Homework 3
04/19/13

My four favorite polynomial equations:
x^3-1
6*x^5+5*x^4+4*x^3+3*x^2+2*x+1
x^2+2*x+1
x^8+3*x^6+5*x^4+7*x^2+9

================================================
FILE: HW/hw3/answers/problem6.txt
================================================
Chun-Wei Chen
CSE 331
Homework 3
04/19/13

a. No, they are different. The rep invariant generated by Daikon is 
   this.denom >= 0 while the rep invariant in RatNum is this.denom >= 0 && 
   r.numer/r.denom is in reduced form; in other words Daikon's output is 
   weaker than the true rep invariant.

b. The invariant generated by Daikon using RatNumTest is this.numer >= -1 && 
   arg != null && arg.numer >= -1 && arg.denom >= 0	while the invariant 
   generated by Daikon using RatNumSmallTest is this.numer >= -1 && 
   this.denom >= 1 && arg != null && arg.denom >= 1. RatNumTest covers the 
   case arg.denom == 0 and doesn't have constraint on this.denom, while the 
   RatNumSmallTest didn't cover arg.denom == 0 and have constraint on 
   this.denom that this.denom >= 1. Both cases show that RatNumSmallTest 
   didn't test the case where this or arg is NaN (denom == 0) when calling 
   sub method.

================================================
FILE: HW/hw3/build.xml
================================================
<!--Minimal ant build file that needs to be created per hw.  You
 mostly just have to use this as an example, and modify the project
 name, and the also.compile property to be a comma-separated list of
 other hws to compile in the shown fashion. -->

<project name = "hw3" basedir = "../">
  <property name = "hwname" value = "${ant.project.name}"/>
  <property name = "hw" location = "${hwname}"/>
  <property name = "checker.force" value = "false"/>
  <!-- disable nullness checker -->
  <property name = "checker.disabled" value="true"/>
  <property name="compiler.args" value="-g -source 5 -target 5 -Awarns -Xmaxwarns 10000"/>
  <import file="../common.xml"/>
   <target name = "daikon-RatNumTest" depends = "build">
    <java classname="daikon.Chicory"
          fork="yes"
          spawn="no"
          dir="${hw}"
          classpathref="common.classpath">
      <arg value="--ppt-omit-pattern=junit|^${hwname}.test"/>
      <arg value="--dtrace-file=daikon-RatNumTest.dtrace.gz"/>
      <arg value="--daikon"/>
      <arg value="--daikon_args"/>
      <arg value="--var-omit-pattern=ZERO|NaN|serialVersionUID --config_option daikon.PptRelation.enable_object_user=false
            --no_text_output --config_option daikon.Daikon.progress_delay=-1"/>
      <arg value="org.junit.runner.JUnitCore"/>
      <arg value="${hwname}.test.RatNumTest"/>
    </java>
    <if>
      <not>
	<available file="${hw}/daikon-RatNumTest.inv.gz"/>
      </not>
      <then>
        <fail message="Chicory was unable to create file daikon-RatNumTest.inv.gz"/>
      </then>
    </if>
    <java classname="daikon.PrintInvariants"
          fork="yes"
          spawn="no"
          classpathref="common.classpath"
          dir="${hw}"
          output="${hw}/daikon-RatNumTest.inv.txt">
       <arg value="daikon-RatNumTest.inv.gz"/>
    </java>

    <echo> "Results are in daikon-RatNumTest.inv.txt" </echo>
  </target>

  <target name = "daikon-RatNumSmallTest" depends = "build">
    <java classname="daikon.Chicory"
          fork="yes"
          spawn="no"
          dir="${hw}"
          classpathref="common.classpath">
      <arg value="--ppt-omit-pattern=junit|^${hwname}.test"/>
      <arg value="--dtrace-file=daikon-RatNumSmallTest.dtrace.gz"/>
      <arg value="--daikon"/>
      <arg value="--daikon_args"/>
      <arg value="--var-omit-pattern=ZERO|NaN|serialVersionUID --config_option daikon.PptRelation.enable_object_user=false
            --no_text_output --config_option daikon.Daikon.progress_delay=-1"/>
      <arg value="org.junit.runner.JUnitCore"/>
      <arg value="${hwname}.test.RatNumSmallTest"/>
    </java>
    <if>
      <not>
	<available file="${hw}/daikon-RatNumSmallTest.inv.gz"/>
      </not>
      <then>
        <fail message="Chicory was unable to create file daikon-RatNumSmallTest.inv.gz"/>
      </then>
    </if>
    <java classname="daikon.PrintInvariants"
          fork="yes"
          spawn="no"
          classpathref="common.classpath"
          dir="${hw}"
          output="${hw}/daikon-RatNumSmallTest.inv.txt">
       <arg value="daikon-RatNumSmallTest.inv.gz"/>
    </java>

    <echo> "Results are in daikon-RatNumSmallTest.inv.txt" </echo>
  </target>

</project>


================================================
FILE: HW/hw3/daikon-RatNumSmallTest.inv.txt
================================================
===========================================================================
com.sun.proxy.$Proxy4:::CLASS
com.sun.proxy.$Proxy4.m1 has only one value
com.sun.proxy.$Proxy4.m1 != null
com.sun.proxy.$Proxy4.m3 has only one value
com.sun.proxy.$Proxy4.m3 != null
com.sun.proxy.$Proxy4.m0 has only one value
com.sun.proxy.$Proxy4.m0 != null
com.sun.proxy.$Proxy4.m4 has only one value
com.sun.proxy.$Proxy4.m4 != null
com.sun.proxy.$Proxy4.m5 has only one value
com.sun.proxy.$Proxy4.m5 != null
com.sun.proxy.$Proxy4.m2 has only one value
com.sun.proxy.$Proxy4.m2 != null
===========================================================================
com.sun.proxy.$Proxy4:::OBJECT
===========================================================================
com.sun.proxy.$Proxy4.$Proxy4(java.lang.reflect.InvocationHandler):::ENTER
arg0 != null
arg0.getClass() == sun.reflect.annotation.AnnotationInvocationHandler.class
===========================================================================
com.sun.proxy.$Proxy4.$Proxy4(java.lang.reflect.InvocationHandler):::EXIT
===========================================================================
com.sun.proxy.$Proxy4.annotationType():::ENTER
===========================================================================
com.sun.proxy.$Proxy4.annotationType():::EXIT
com.sun.proxy.$Proxy4.m1 == orig(com.sun.proxy.$Proxy4.m1)
com.sun.proxy.$Proxy4.m3 == orig(com.sun.proxy.$Proxy4.m3)
com.sun.proxy.$Proxy4.m0 == orig(com.sun.proxy.$Proxy4.m0)
com.sun.proxy.$Proxy4.m4 == orig(com.sun.proxy.$Proxy4.m4)
com.sun.proxy.$Proxy4.m5 == orig(com.sun.proxy.$Proxy4.m5)
com.sun.proxy.$Proxy4.m2 == orig(com.sun.proxy.$Proxy4.m2)
return has only one value
return != null
===========================================================================
com.sun.proxy.$Proxy4.expected():::ENTER
===========================================================================
com.sun.proxy.$Proxy4.expected():::EXIT
com.sun.proxy.$Proxy4.m1 == orig(com.sun.proxy.$Proxy4.m1)
com.sun.proxy.$Proxy4.m3 == orig(com.sun.proxy.$Proxy4.m3)
com.sun.proxy.$Proxy4.m0 == orig(com.sun.proxy.$Proxy4.m0)
com.sun.proxy.$Proxy4.m4 == orig(com.sun.proxy.$Proxy4.m4)
com.sun.proxy.$Proxy4.m5 == orig(com.sun.proxy.$Proxy4.m5)
com.sun.proxy.$Proxy4.m2 == orig(com.sun.proxy.$Proxy4.m2)
return has only one value
return != null
===========================================================================
com.sun.proxy.$Proxy4.timeout():::ENTER
===========================================================================
com.sun.proxy.$Proxy4.timeout():::EXIT
com.sun.proxy.$Proxy4.m1 == orig(com.sun.proxy.$Proxy4.m1)
com.sun.proxy.$Proxy4.m3 == orig(com.sun.proxy.$Proxy4.m3)
com.sun.proxy.$Proxy4.m0 == orig(com.sun.proxy.$Proxy4.m0)
com.sun.proxy.$Proxy4.m4 == orig(com.sun.proxy.$Proxy4.m4)
com.sun.proxy.$Proxy4.m5 == orig(com.sun.proxy.$Proxy4.m5)
com.sun.proxy.$Proxy4.m2 == orig(com.sun.proxy.$Proxy4.m2)
return == 0
===========================================================================
hw3.RatNum:::OBJECT
this.denom >= 0
===========================================================================
hw3.RatNum.RatNum(int):::ENTER
===========================================================================
hw3.RatNum.RatNum(int):::EXIT
this.numer == orig(n)
this.denom == 1
===========================================================================
hw3.RatNum.RatNum(int, int):::ENTER
===========================================================================
hw3.RatNum.RatNum(int, int):::EXIT
===========================================================================
hw3.RatNum.add(hw3.RatNum):::ENTER
this.numer >= -1
arg != null
arg.denom >= 0
===========================================================================
hw3.RatNum.add(hw3.RatNum):::EXIT
this.numer == orig(this.numer)
this.denom == orig(this.denom)
arg.numer == orig(arg.numer)
arg.denom == orig(arg.denom)
this.numer >= -1
arg.denom >= 0
return != null
return.denom >= 0
===========================================================================
hw3.RatNum.checkRep():::ENTER
===========================================================================
hw3.RatNum.checkRep():::EXIT
this.numer == orig(this.numer)
this.denom == orig(this.denom)
===========================================================================
hw3.RatNum.compareTo(hw3.RatNum):::ENTER
this.numer >= -1
rn != null
rn.numer >= -1
rn.denom >= 0
===========================================================================
hw3.RatNum.compareTo(hw3.RatNum):::EXIT135
this.numer one of { -1, 1, 100 }
this.denom == 0
rn.denom one of { 1, 2 }
return == 1
this.numer != this.denom
this.denom < rn.denom
rn.denom >= return
===========================================================================
hw3.RatNum.compareTo(hw3.RatNum):::EXIT137
this.denom one of { 1, 2 }
rn.numer one of { -1, 1, 100 }
rn.denom == 0
return == -1
this.numer >= return
this.denom > rn.denom
this.denom > return
rn.numer != rn.denom
rn.numer >= return
===========================================================================
hw3.RatNum.compareTo(hw3.RatNum):::EXIT140
this.denom >= 1
rn.denom one of { 1, 2, 3 }
===========================================================================
hw3.RatNum.compareTo(hw3.RatNum):::EXIT
this.numer == orig(this.numer)
this.denom == orig(this.denom)
rn.numer == orig(rn.numer)
rn.denom == orig(rn.denom)
this.numer >= -1
rn.numer >= -1
rn.denom >= 0
===========================================================================
hw3.RatNum.div(hw3.RatNum):::ENTER
this.numer >= -1
arg != null
arg.numer >= -1
arg.denom >= 0
===========================================================================
hw3.RatNum.div(hw3.RatNum):::EXIT253
arg.numer == return.numer
arg.denom == return.denom
return == orig(arg)
this.denom one of { 0, 1, 2 }
arg.denom == 0
this.denom >= arg.denom
===========================================================================
hw3.RatNum.div(hw3.RatNum):::EXIT255
arg.denom >= 1
===========================================================================
hw3.RatNum.div(hw3.RatNum):::EXIT
this.numer == orig(this.numer)
this.denom == orig(this.denom)
arg.numer == orig(arg.numer)
arg.denom == orig(arg.denom)
(arg.denom == 0)  ==>  (arg.denom == return.denom)
(arg.denom == 0)  ==>  (arg.numer == return.numer)
(arg.denom == 0)  ==>  (return == orig(arg))
(arg.denom == 0)  ==>  (return.denom == 0)
(arg.denom == 0)  ==>  (return.numer >= -1)
(arg.denom == 0)  ==>  (this.denom >= arg.denom)
(arg.denom == 0)  ==>  (this.denom >= return.denom)
(arg.denom == 0)  ==>  (this.denom one of { 0, 1, 2 })
this.numer >= -1
arg.numer >= -1
arg.denom >= 0
return != null
return.denom >= 0
===========================================================================
hw3.RatNum.doubleValue():::ENTER
===========================================================================
hw3.RatNum.doubleValue():::EXIT155
this.numer == 1
this.denom == 0
return == Double.NaN
orig(this) has only one value
===========================================================================
hw3.RatNum.doubleValue():::EXIT158
this.denom >= 1
===========================================================================
hw3.RatNum.doubleValue():::EXIT
this.numer == orig(this.numer)
this.denom == orig(this.denom)
(this.denom == 0)  ==>  (orig(this) has only one value)
(this.denom == 0)  ==>  (return == Double.NaN)
(this.denom == 0)  ==>  (this.numer == 1)
===========================================================================
hw3.RatNum.equals(java.lang.Object):::ENTER
this.numer >= -1
this.denom one of { 0, 1, 2 }
obj != null
obj.getClass() == hw3.RatNum.class
===========================================================================
hw3.RatNum.equals(java.lang.Object):::EXIT304
this.numer one of { -1, 1, 100 }
this.denom == 0
return == true
this.numer != this.denom
===========================================================================
hw3.RatNum.equals(java.lang.Object):::EXIT304;condition="return == true"
===========================================================================
hw3.RatNum.equals(java.lang.Object):::EXIT306
this.denom one of { 1, 2 }
===========================================================================
hw3.RatNum.equals(java.lang.Object):::EXIT306;condition="return == true"
===========================================================================
hw3.RatNum.equals(java.lang.Object):::EXIT306;condition="not(return == true)"
===========================================================================
hw3.RatNum.equals(java.lang.Object):::EXIT
this.numer == orig(this.numer)
this.denom == orig(this.denom)
(return == false)  ==>  (this.denom one of { 1, 2 })
(return == true)  ==>  (this.denom one of { 0, 1, 2 })
this.numer >= -1
this.denom one of { 0, 1, 2 }
===========================================================================
hw3.RatNum.equals(java.lang.Object):::EXIT;condition="return == true"
return == true
===========================================================================
hw3.RatNum.equals(java.lang.Object):::EXIT;condition="not(return == true)"
this.denom one of { 1, 2 }
return == false
===========================================================================
hw3.RatNum.gcd(int, int):::ENTER
b != 0
===========================================================================
hw3.RatNum.gcd(int, int):::EXIT275
===========================================================================
hw3.RatNum.gcd(int, int):::EXIT
return != 0
orig(a) % return == 0
orig(b) % return == 0
===========================================================================
hw3.RatNum.isNaN():::ENTER
===========================================================================
hw3.RatNum.isNaN():::EXIT
this.numer ==
Download .txt
gitextract_cke7msu3/

├── HW/
│   ├── hw0/
│   │   ├── Adder.java
│   │   ├── Ball.java
│   │   ├── BallContainer.java
│   │   ├── Box.java
│   │   ├── Fibonacci.java
│   │   ├── HelloWorld.java
│   │   ├── HolaWorld.java
│   │   ├── RandomHello.java
│   │   ├── answers/
│   │   │   ├── problem6.txt
│   │   │   └── problem7.txt
│   │   ├── build.xml
│   │   ├── hw0-comments.txt
│   │   ├── optional/
│   │   │   ├── Card.java
│   │   │   ├── CardSuit.java
│   │   │   ├── CardValue.java
│   │   │   ├── FinancialCalc.java
│   │   │   ├── MyHand.java
│   │   │   ├── Point.java
│   │   │   ├── Primes.java
│   │   │   └── StringScrambler.java
│   │   ├── required.properties
│   │   └── test/
│   │       ├── BallContainerTest.java
│   │       ├── BallTest.java
│   │       ├── BoxTest.java
│   │       ├── FibonacciTest.java
│   │       ├── HolaWorldTest.java
│   │       ├── ImplementationTests.java
│   │       ├── RandomHelloTest.java
│   │       └── SpecificationTests.java
│   ├── hw2/
│   │   ├── hw2_answers.txt
│   │   └── hw3_problem0.txt
│   ├── hw3/
│   │   ├── CalculatorFrame.java
│   │   ├── HW3_comment_key.txt
│   │   ├── PolyGraph.java
│   │   ├── RatNum.java
│   │   ├── RatPoly.java
│   │   ├── RatPolyStack.java
│   │   ├── RatTerm.java
│   │   ├── answers/
│   │   │   ├── problem1.txt
│   │   │   ├── problem2.txt
│   │   │   ├── problem5.txt
│   │   │   └── problem6.txt
│   │   ├── build.xml
│   │   ├── daikon-RatNumSmallTest.inv.txt
│   │   ├── daikon-RatNumTest.inv.txt
│   │   ├── required.properties
│   │   └── test/
│   │       ├── ImplementationTests.java
│   │       ├── RatNumSmallTest.java
│   │       ├── RatNumTest.java
│   │       ├── RatPolyStackTest.java
│   │       ├── RatPolyTest.java
│   │       ├── RatTermTest.java
│   │       └── SpecificationTests.java
│   ├── hw4/
│   │   ├── DGraph.java
│   │   ├── LabeledEdge.java
│   │   ├── answers/
│   │   │   ├── problem1.txt
│   │   │   ├── problem2.txt
│   │   │   ├── problem3.txt
│   │   │   └── problem4.txt
│   │   ├── build.xml
│   │   ├── hw4-grading-key.txt
│   │   ├── nullness/
│   │   │   ├── NullnessExample.java
│   │   │   └── NullnessExampleWithWarnings.java
│   │   ├── problem1/
│   │   │   ├── IntQueue1.java
│   │   │   └── IntQueue2.java
│   │   ├── required.properties
│   │   └── test/
│   │       ├── DGraphTest.java
│   │       ├── HW4TestDriver.java
│   │       ├── ImplementationTests.java
│   │       ├── LabeledEdgeTest.java
│   │       ├── ScriptFileTests.java
│   │       ├── SpecificationTests.java
│   │       ├── emptyGraph.expected
│   │       ├── emptyGraph.test
│   │       ├── exampleTestVariousCases1.expected
│   │       ├── exampleTestVariousCases1.test
│   │       ├── oneNodeGraph.expected
│   │       ├── oneNodeGraph.test
│   │       ├── oneNodeReflexiveEdgeGraph.expected
│   │       ├── oneNodeReflexiveEdgeGraph.test
│   │       ├── twoNodesCompleteGraph.expected
│   │       ├── twoNodesCompleteGraph.test
│   │       ├── twoNodesGraph.expected
│   │       ├── twoNodesGraph.test
│   │       ├── twoNodesGraphAlphabetical.expected
│   │       ├── twoNodesGraphAlphabetical.test
│   │       ├── twoNodesMultipleEdgesGraph.expected
│   │       ├── twoNodesMultipleEdgesGraph.test
│   │       ├── twoNodesMutipleEdgesGraphAlphabetical.expected
│   │       ├── twoNodesMutipleEdgesGraphAlphabetical.test
│   │       ├── twoNodesTwoEdgesGraph1.expected
│   │       ├── twoNodesTwoEdgesGraph1.test
│   │       ├── twoNodesTwoEdgesGraph2.expected
│   │       └── twoNodesTwoEdgesGraph2.test
│   ├── hw5/
│   │   ├── MarvelParser.java
│   │   ├── MarvelPaths.java
│   │   ├── build.xml
│   │   ├── changes.txt
│   │   ├── data/
│   │   │   ├── empty.tsv
│   │   │   ├── marvel.tsv
│   │   │   ├── oneNodeGraph.tsv
│   │   │   ├── sports.tsv
│   │   │   ├── staffSuperheroes.tsv
│   │   │   ├── threeNodesWithReflexiveEdge.tsv
│   │   │   ├── twoNodesGraph.tsv
│   │   │   └── zoos.tsv
│   │   ├── hw5-comment-key.txt
│   │   ├── required.properties
│   │   └── test/
│   │       ├── HW5TestDriver.java
│   │       ├── ImplementationTests.java
│   │       ├── ScriptFileTests.java
│   │       ├── SpecificationTests.java
│   │       ├── TestMarvelPaths.java
│   │       ├── exampleTestMarvelOneHop.expected
│   │       ├── exampleTestMarvelOneHop.test
│   │       ├── exampleTestParserSmallishGraph.expected
│   │       ├── exampleTestParserSmallishGraph.test
│   │       ├── exampleTestSimpleBFSTwoHops.expected
│   │       ├── exampleTestSimpleBFSTwoHops.test
│   │       ├── testAddingReflexiveEdge.expected
│   │       ├── testAddingReflexiveEdge.test
│   │       ├── testFindPathSportsGraph.expected
│   │       ├── testFindPathSportsGraph.test
│   │       ├── testFindPathZooGraph.expected
│   │       ├── testFindPathZooGraph.test
│   │       ├── testParserAndBFSEmptyGraph.expected
│   │       ├── testParserAndBFSEmptyGraph.test
│   │       ├── testParserAndBFSOneNodeGraph.expected
│   │       ├── testParserAndBFSOneNodeGraph.test
│   │       ├── testParserAndBFSTwoNodesGraph.expected
│   │       ├── testParserAndBFSTwoNodesGraph.test
│   │       ├── testParserSportsGraph.expected
│   │       ├── testParserSportsGraph.test
│   │       ├── testParserZooGraph.expected
│   │       └── testParserZooGraph.test
│   ├── hw6/
│   │   ├── MarvelParser2.java
│   │   ├── MarvelPaths2.java
│   │   ├── build.xml
│   │   ├── data/
│   │   │   ├── empty.tsv
│   │   │   ├── marvel.tsv
│   │   │   ├── oneNodeGraph.tsv
│   │   │   ├── sports.tsv
│   │   │   └── threeNodesTwoEdgesGraph.tsv
│   │   ├── required.properties
│   │   └── test/
│   │       ├── HW6TestDriver.java
│   │       ├── ImplementationTests.java
│   │       ├── ScriptFileTests.java
│   │       ├── SpecificationTests.java
│   │       ├── TestMarvelPaths2.java
│   │       ├── emptyGraph.expected
│   │       ├── emptyGraph.test
│   │       ├── emptyGraphFindPath.expected
│   │       ├── emptyGraphFindPath.test
│   │       ├── exampleFindOnlyPossiblePath.expected
│   │       ├── exampleFindOnlyPossiblePath.test
│   │       ├── exampleMarvelBasicSearch.expected
│   │       ├── exampleMarvelBasicSearch.test
│   │       ├── oneNodeGraph.expected
│   │       ├── oneNodeGraph.test
│   │       ├── oneNodeGraphFindPathOnNonExistingNode.expected
│   │       ├── oneNodeGraphFindPathOnNonExistingNode.test
│   │       ├── oneNodeGraphFindPathOnOnlyNode.expected
│   │       ├── oneNodeGraphFindPathOnOnlyNode.test
│   │       ├── sportsGraphFindPath.expected
│   │       ├── sportsGraphFindPath.test
│   │       ├── threeNodesTwoEdgesGraph.expected
│   │       ├── threeNodesTwoEdgesGraph.test
│   │       ├── threeNodesTwoEdgesGraphFindExistingPath.expected
│   │       ├── threeNodesTwoEdgesGraphFindExistingPath.test
│   │       ├── threeNodesTwoEdgesGraphFindNonExistingPath.expected
│   │       ├── threeNodesTwoEdgesGraphFindNonExistingPath.test
│   │       ├── twoNodesTwoEdgesGraphFindPath.expected
│   │       └── twoNodesTwoEdgesGraphFindPath.test
│   ├── hw7/
│   │   ├── CampusDataParser.java
│   │   ├── CampusRouteFindingModel.java
│   │   ├── CampusRouteFindingTool.java
│   │   ├── Coordinates.java
│   │   ├── build.xml
│   │   ├── mvc.txt
│   │   ├── required.properties
│   │   ├── sample_output.txt
│   │   └── test/
│   │       ├── CampusDataParserTest.java
│   │       ├── CampusRouteFindingModelTest.java
│   │       ├── CoordinatesTest.java
│   │       ├── HW7TestDriver.java
│   │       ├── ImplementationTests.java
│   │       ├── ScriptFileTests.java
│   │       ├── SpecificationTests.java
│   │       ├── campusBuildings.expected
│   │       ├── campusBuildings.test
│   │       ├── echoEmptyLineAndComments.expected
│   │       ├── echoEmptyLineAndComments.test
│   │       ├── exampleBasicFindPath.expected
│   │       ├── exampleBasicFindPath.test
│   │       ├── findRouteWithTwoUnknownBuildings.expected
│   │       ├── findRouteWithTwoUnknownBuildings.test
│   │       ├── findRouteWithUnknownEndingBuilding.expected
│   │       ├── findRouteWithUnknownEndingBuilding.test
│   │       ├── findRouteWithUnknownStartingBuilding.expected
│   │       ├── findRouteWithUnknownStartingBuilding.test
│   │       ├── menuCommand.expected
│   │       ├── menuCommand.test
│   │       ├── quitCommand.expected
│   │       ├── quitCommand.test
│   │       ├── unknownCommands.expected
│   │       └── unknownCommands.test
│   └── hw8/
│       ├── CampusPathsMain.java
│       ├── CampusRouteFindingGUI.java
│       ├── CampusRouteFindingGUIController.java
│       ├── CampusRouteFindingMapView.java
│       ├── answers/
│       │   ├── extra.txt
│       │   └── model-changes.txt
│       ├── build.xml
│       └── required.properties
├── README.md
├── Week 03/
│   └── Section/
│       ├── Circle1.java
│       ├── Circle2.java
│       ├── Circle3.java
│       ├── IntMapUncommented.java
│       ├── IntTreeMapCommented.java
│       └── IntTreeMapUncommented.java
├── Week 07/
│   └── Section/
│       └── generics/
│           ├── ArrayList.java
│           ├── GenericsTest.java
│           ├── SetUtils.java
│           └── TypeBreaker.java
├── Week 09/
│   ├── Section/
│   │   └── section9-src/
│   │       ├── .metadata/
│   │       │   ├── .mylyn/
│   │       │   │   └── .taskListIndex/
│   │       │   │       ├── segments.gen
│   │       │   │       └── segments_1
│   │       │   ├── .plugins/
│   │       │   │   ├── org.eclipse.core.resources/
│   │       │   │   │   ├── .history/
│   │       │   │   │   │   ├── 1b/
│   │       │   │   │   │   │   └── d0b7a658d0c800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 23/
│   │       │   │   │   │   │   └── e08e32b9cfc800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 2f/
│   │       │   │   │   │   │   └── 4083655ed0c800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 4a/
│   │       │   │   │   │   │   └── e0c80c18d0c800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 63/
│   │       │   │   │   │   │   └── e080bc50d0c800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 76/
│   │       │   │   │   │   │   └── 200dca82e2c8001213e1ea49183f8040
│   │       │   │   │   │   ├── 79/
│   │       │   │   │   │   │   └── d02f6190cfc800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 88/
│   │       │   │   │   │   │   └── 203a54fccfc800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── 91/
│   │       │   │   │   │   │   └── d0c84cf3cec800121e7fa2deb6ad53cb
│   │       │   │   │   │   ├── a3/
│   │       │   │   │   │   │   └── e0c7cda8cfc800121e7fa2deb6ad53cb
│   │       │   │   │   │   └── f9/
│   │       │   │   │   │       └── 607f222ccfc800121e7fa2deb6ad53cb
│   │       │   │   │   ├── .projects/
│   │       │   │   │   │   ├── WeatherReportSolution/
│   │       │   │   │   │   │   ├── .indexes/
│   │       │   │   │   │   │   │   ├── af/
│   │       │   │   │   │   │   │   │   └── history.index
│   │       │   │   │   │   │   │   └── e4/
│   │       │   │   │   │   │   │       └── history.index
│   │       │   │   │   │   │   └── .markers
│   │       │   │   │   │   └── WeatherReportStarter/
│   │       │   │   │   │       ├── .indexes/
│   │       │   │   │   │       │   ├── af/
│   │       │   │   │   │       │   │   └── history.index
│   │       │   │   │   │       │   └── e4/
│   │       │   │   │   │       │       └── history.index
│   │       │   │   │   │       └── .markers
│   │       │   │   │   ├── .root/
│   │       │   │   │   │   ├── .indexes/
│   │       │   │   │   │   │   ├── history.version
│   │       │   │   │   │   │   ├── properties.index
│   │       │   │   │   │   │   └── properties.version
│   │       │   │   │   │   └── 4.tree
│   │       │   │   │   └── .safetable/
│   │       │   │   │       └── org.eclipse.core.resources
│   │       │   │   ├── org.eclipse.core.runtime/
│   │       │   │   │   └── .settings/
│   │       │   │   │       ├── com.collabnet.subversion.merge.prefs
│   │       │   │   │       ├── org.eclipse.core.resources.prefs
│   │       │   │   │       ├── org.eclipse.debug.ui.prefs
│   │       │   │   │       ├── org.eclipse.jdt.core.prefs
│   │       │   │   │       ├── org.eclipse.jdt.debug.ui.prefs
│   │       │   │   │       ├── org.eclipse.jdt.launching.prefs
│   │       │   │   │       ├── org.eclipse.jdt.ui.prefs
│   │       │   │   │       ├── org.eclipse.m2e.discovery.prefs
│   │       │   │   │       ├── org.eclipse.mylyn.context.core.prefs
│   │       │   │   │       ├── org.eclipse.mylyn.monitor.ui.prefs
│   │       │   │   │       ├── org.eclipse.team.cvs.ui.prefs
│   │       │   │   │       ├── org.eclipse.team.ui.prefs
│   │       │   │   │       ├── org.eclipse.ui.editors.prefs
│   │       │   │   │       ├── org.eclipse.ui.ide.prefs
│   │       │   │   │       ├── org.eclipse.ui.prefs
│   │       │   │   │       ├── org.eclipse.ui.workbench.prefs
│   │       │   │   │       ├── org.tigris.subversion.subclipse.tools.usage.prefs
│   │       │   │   │       └── org.tigris.subversion.subclipse.ui.prefs
│   │       │   │   ├── org.eclipse.debug.core/
│   │       │   │   │   └── .launches/
│   │       │   │   │       ├── WeatherReportMain (1).launch
│   │       │   │   │       └── WeatherReportMain.launch
│   │       │   │   ├── org.eclipse.debug.ui/
│   │       │   │   │   ├── dialog_settings.xml
│   │       │   │   │   └── launchConfigurationHistory.xml
│   │       │   │   ├── org.eclipse.e4.workbench/
│   │       │   │   │   └── workbench.xmi
│   │       │   │   ├── org.eclipse.jdt.core/
│   │       │   │   │   ├── 1115467115.index
│   │       │   │   │   ├── 1299022128.index
│   │       │   │   │   ├── 1498219845.index
│   │       │   │   │   ├── 163172794.index
│   │       │   │   │   ├── 1686896964.index
│   │       │   │   │   ├── 1697886153.index
│   │       │   │   │   ├── 1995173708.index
│   │       │   │   │   ├── 2496411864.index
│   │       │   │   │   ├── 305854171.index
│   │       │   │   │   ├── 3065916431.index
│   │       │   │   │   ├── 30765161.index
│   │       │   │   │   ├── 3133528496.index
│   │       │   │   │   ├── 3974580528.index
│   │       │   │   │   ├── 4041092966.index
│   │       │   │   │   ├── 4108727661.index
│   │       │   │   │   ├── 4155206848.index
│   │       │   │   │   ├── externalLibsTimeStamps
│   │       │   │   │   ├── invalidArchivesCache
│   │       │   │   │   ├── javaLikeNames.txt
│   │       │   │   │   ├── nonChainingJarsCache
│   │       │   │   │   └── savedIndexNames.txt
│   │       │   │   ├── org.eclipse.jdt.launching/
│   │       │   │   │   ├── .install.xml
│   │       │   │   │   └── libraryInfos.xml
│   │       │   │   ├── org.eclipse.jdt.ui/
│   │       │   │   │   ├── OpenTypeHistory.xml
│   │       │   │   │   ├── QualifiedTypeNameHistory.xml
│   │       │   │   │   └── dialog_settings.xml
│   │       │   │   ├── org.eclipse.m2e.logback.configuration/
│   │       │   │   │   ├── 0.log
│   │       │   │   │   └── logback.1.2.0.20120903-1050.xml
│   │       │   │   ├── org.eclipse.pde.core/
│   │       │   │   │   └── .cache/
│   │       │   │   │       └── clean-cache.properties
│   │       │   │   ├── org.eclipse.ui.ide/
│   │       │   │   │   └── dialog_settings.xml
│   │       │   │   ├── org.eclipse.ui.intro/
│   │       │   │   │   └── dialog_settings.xml
│   │       │   │   ├── org.eclipse.ui.workbench/
│   │       │   │   │   ├── dialog_settings.xml
│   │       │   │   │   ├── workbench.xml
│   │       │   │   │   └── workingsets.xml
│   │       │   │   └── org.eclipse.wb.discovery.core/
│   │       │   │       └── toolkits.xml
│   │       │   └── version.ini
│   │       ├── WeatherReportSolution/
│   │       │   ├── .classpath
│   │       │   ├── .project
│   │       │   ├── .settings/
│   │       │   │   └── org.eclipse.jdt.core.prefs
│   │       │   └── src/
│   │       │       ├── Thermometer.java
│   │       │       ├── WeatherIcon.java
│   │       │       ├── WeatherPanel.java
│   │       │       ├── WeatherReportGUI.java
│   │       │       ├── WeatherReportMain.java
│   │       │       └── WeatherReportModel.java
│   │       ├── WeatherReportStarter/
│   │       │   ├── .classpath
│   │       │   ├── .project
│   │       │   ├── .settings/
│   │       │   │   └── org.eclipse.jdt.core.prefs
│   │       │   └── src/
│   │       │       ├── Thermometer.java
│   │       │       ├── WeatherIcon.java
│   │       │       ├── WeatherPanel.java
│   │       │       ├── WeatherReportGUI.java
│   │       │       ├── WeatherReportMain.java
│   │       │       └── WeatherReportModel.java
│   │       └── images/
│   │           ├── license.txt
│   │           └── license.txt~
│   ├── lect23-graphics-code/
│   │   ├── .htaccess
│   │   ├── Face.java
│   │   ├── FaceMain.java
│   │   ├── SimpleFrameMain.java
│   │   ├── SimpleLayoutMain.java
│   │   └── SimplePaintMain.java
│   └── lect24-events-code/
│       ├── .htaccess
│       ├── ButtonDemo1.java
│       ├── ButtonDemo2.java
│       └── ballsim/
│           ├── Ball.java
│           ├── BallGraphicsView.java
│           ├── BallSimControl.java
│           ├── BallSimMain.java
│           ├── SimModel.java
│           ├── SimThing.java
│           └── SimView.java
└── lecture3-Abstraction_by_Specification.ppt
Download .txt
SYMBOL INDEX (1151 symbols across 114 files)

FILE: HW/hw0/Adder.java
  class Adder (line 10) | public class Adder {
    method main (line 12) | public static void main(String[] args) {
    method computeSum (line 28) | public static int computeSum(int x, int y) {

FILE: HW/hw0/Ball.java
  class Ball (line 13) | public class Ball {
    method Ball (line 21) | public Ball(double volume) {
    method getVolume (line 29) | public double getVolume() {

FILE: HW/hw0/BallContainer.java
  class BallContainer (line 19) | public class BallContainer implements Iterable<Ball> {
    method BallContainer (line 29) | public BallContainer() {
    method iterator (line 40) | public Iterator<Ball> iterator() {
    method add (line 62) | public boolean add(Ball b) {
    method remove (line 83) | public boolean remove(Ball b) {
    method getVolume (line 98) | public double getVolume() {
    method size (line 106) | public int size() {
    method clear (line 113) | public void clear() {
    method contains (line 126) | public boolean contains(Ball b) {

FILE: HW/hw0/Box.java
  class Box (line 19) | public class Box implements Iterable<Ball> {
    method Box (line 34) | public Box(double maxVolume) {
    method iterator (line 44) | public Iterator<Ball> iterator() {
    method add (line 62) | public boolean add(Ball b) {
    method getBallsFromSmallest (line 77) | public Iterator<Ball> getBallsFromSmallest() {
    method remove (line 96) | public boolean remove(Ball b) {
    method getVolume (line 105) | public double getVolume() {
    method size (line 113) | public int size() {
    method clear (line 120) | public void clear() {
    method contains (line 131) | public boolean contains(Ball b) {
    class ballComparator (line 139) | public class ballComparator implements Comparator<Ball> {
      method compare (line 151) | public int compare(Ball b1, Ball b2) {

FILE: HW/hw0/Fibonacci.java
  class Fibonacci (line 15) | public class Fibonacci {
    method getFibTerm (line 24) | public int getFibTerm(int n) {

FILE: HW/hw0/HelloWorld.java
  class HelloWorld (line 12) | public class HelloWorld {
    method main (line 20) | public static void main(String[] args) {
    method getGreeting (line 28) | public String getGreeting() {

FILE: HW/hw0/HolaWorld.java
  class HolaWorld (line 12) | public class HolaWorld extends HelloWorld {
    method main (line 21) | public static void main(String[] argv) {
    method getGreeting (line 35) | public String getGreeting() {

FILE: HW/hw0/RandomHello.java
  class RandomHello (line 13) | public class RandomHello {
    method main (line 19) | public static void main(String[] args) {
    method getGreeting (line 27) | public String getGreeting() {

FILE: HW/hw0/optional/Card.java
  class Card (line 9) | public class Card implements Comparable<Card> {
    method Card (line 49) | public Card(CardValue aValue, CardSuit aSuit) {
    method getSuit (line 58) | public CardSuit getSuit() {
    method getValue (line 66) | public CardValue getValue() {
    method compareTo (line 106) | public int compareTo(Card c) {
    method equals (line 131) | public boolean equals(/*@Nullable*/ Object otherCardObject) {
    method hashCode (line 148) | public int hashCode() {
    method toString (line 158) | public String toString() {

FILE: HW/hw0/optional/CardSuit.java
  type CardSuit (line 8) | public enum CardSuit {

FILE: HW/hw0/optional/CardValue.java
  type CardValue (line 8) | public enum CardValue  {
    method CardValue (line 114) | CardValue(String valueName, String letter) {
    method getName (line 128) | public String getName() {
    method getLetterOnCard (line 142) | public String getLetterOnCard() {
    method toString (line 154) | public String toString() {

FILE: HW/hw0/optional/FinancialCalc.java
  class FinancialCalc (line 3) | public class FinancialCalc {
    method main (line 5) | public static void main(String[] args) {

FILE: HW/hw0/optional/MyHand.java
  class MyHand (line 6) | public class MyHand {
    method MyHand (line 9) | MyHand() {
    method main (line 21) | public static void main(String[] args) {
    method printHand (line 41) | public void printHand() {
    method sortSmallestToLargest (line 49) | public void sortSmallestToLargest() {
    method sortLargesttoSmallest (line 57) | public void sortLargesttoSmallest() {
    method printHand_OnlyHearts (line 64) | public void printHand_OnlyHearts() {
    method printHand_RemoveFaceCards (line 72) | public void printHand_RemoveFaceCards() {

FILE: HW/hw0/optional/Point.java
  class Point (line 3) | class Point {
    method Point (line 10) | Point(double xVal, double yVal) {

FILE: HW/hw0/optional/Primes.java
  class Primes (line 3) | public class Primes {
    method findPrimes (line 5) | private static void findPrimes(int nValues) {
    method findPrimesFaster (line 25) | private static void findPrimesFaster(int nValues) {
    method findPrimesEvenFaster (line 31) | private static void findPrimesEvenFaster(int nValues) {
    method main (line 38) | public static void main(String[] args) {

FILE: HW/hw0/optional/StringScrambler.java
  class StringScrambler (line 3) | public class StringScrambler {
    method reverseWordOrder (line 5) | public String reverseWordOrder(String input) {
    method main (line 14) | public static void main(String args[]) {

FILE: HW/hw0/test/BallContainerTest.java
  class BallContainerTest (line 27) | public class BallContainerTest {
    method setupForTests (line 36) | @BeforeClass
    method testAdd (line 50) | @Test
    method testRemove (line 67) | @Test
    method testIterator (line 97) | @Test
    method testClear (line 124) | @Test
    method testVolume (line 136) | @Test
    method testSize (line 152) | @Test
    method testContains (line 165) | @Test
    method testVolumeAfterClear (line 181) | @Test

FILE: HW/hw0/test/BallTest.java
  class BallTest (line 16) | public class BallTest {
    method setupBeforeTests (line 23) | @BeforeClass
    method testVolume (line 29) | @Test

FILE: HW/hw0/test/BoxTest.java
  class BoxTest (line 35) | public class BoxTest {
    method setupBeforeTests (line 46) | @BeforeClass
    method testAdd (line 71) | @Test
    method testGetBalls (line 89) | @Test
    method testRemove (line 135) | @Test
    method testClear (line 160) | @Test
    method testVolume (line 170) | @Test
    method testSize (line 184) | @Test
    method testContains (line 196) | @Test
    method testIterator (line 217) | @Test

FILE: HW/hw0/test/FibonacciTest.java
  class FibonacciTest (line 26) | public class FibonacciTest {
    method setupBeforeTests (line 30) | @BeforeClass
    method expectedIllegalArgumentException (line 39) | @Test(expected=IllegalArgumentException.class)
    method testThrowsIllegalArgumentException (line 49) | @Test
    method testBaseCase (line 70) | @Test
    method testInductiveCase (line 77) | @Test

FILE: HW/hw0/test/HolaWorldTest.java
  class HolaWorldTest (line 18) | public class HolaWorldTest {
    method testCrash (line 23) | @Test
    method testGreeting (line 32) | @Test
    method testMainOutput (line 42) | @Test

FILE: HW/hw0/test/ImplementationTests.java
  class ImplementationTests (line 11) | @RunWith(Suite.class)

FILE: HW/hw0/test/RandomHelloTest.java
  class RandomHelloTest (line 19) | public class RandomHelloTest {
    method testCrash (line 30) | @Test
    method testGreetings (line 43) | @Test

FILE: HW/hw0/test/SpecificationTests.java
  class SpecificationTests (line 12) | @RunWith(Suite.class)

FILE: HW/hw3/CalculatorFrame.java
  class CalculatorFrame (line 17) | public final class CalculatorFrame extends JFrame {
    method CalculatorFrame (line 125) | public CalculatorFrame() {
    method jbInit (line 146) | private void jbInit() throws Exception {
    method main (line 575) | public static void main(String[] args) {
    method appendToCurrentText (line 608) | void appendToCurrentText(String textToAdd) {
    method jButton_1_actionPerformed (line 617) | void jButton_1_actionPerformed(ActionEvent e) {
    method jButton_2_actionPerformed (line 621) | void jButton_2_actionPerformed(ActionEvent e) {
    method jButton_3_actionPerformed (line 625) | void jButton_3_actionPerformed(ActionEvent e) {
    method jButton_4_actionPerformed (line 629) | void jButton_4_actionPerformed(ActionEvent e) {
    method jButton_5_actionPerformed (line 633) | void jButton_5_actionPerformed(ActionEvent e) {
    method jButton_6_actionPerformed (line 637) | void jButton_6_actionPerformed(ActionEvent e) {
    method jButton_7_actionPerformed (line 641) | void jButton_7_actionPerformed(ActionEvent e) {
    method jButton_8_actionPerformed (line 645) | void jButton_8_actionPerformed(ActionEvent e) {
    method jButton_9_actionPerformed (line 649) | void jButton_9_actionPerformed(ActionEvent e) {
    method jButton_exp_actionPerformed (line 653) | void jButton_exp_actionPerformed(ActionEvent e) {
    method jButton_mul_actionPerformed (line 660) | void jButton_mul_actionPerformed(ActionEvent e) {
    method jButton_div_actionPerformed (line 667) | void jButton_div_actionPerformed(ActionEvent e) {
    method jButton_plus_actionPerformed (line 674) | void jButton_plus_actionPerformed(ActionEvent e) {
    method jButton_minus_actionPerformed (line 681) | void jButton_minus_actionPerformed(ActionEvent e) {
    method jButton_0_actionPerformed (line 688) | void jButton_0_actionPerformed(ActionEvent e) {
    method jButton_x_actionPerformed (line 692) | void jButton_x_actionPerformed(ActionEvent e) {
    method jButton_swap_actionPerformed (line 696) | void jButton_swap_actionPerformed(ActionEvent e) {
    method jButton_pop_actionPerformed (line 710) | void jButton_pop_actionPerformed(ActionEvent e) {
    method jButton_dup_actionPerformed (line 726) | void jButton_dup_actionPerformed(ActionEvent e) {
    method jButton_Enter_actionPerformed (line 740) | void jButton_Enter_actionPerformed(ActionEvent e) {
    method updateStackDisplay (line 766) | void updateStackDisplay() {
    method updateGraph (line 806) | void updateGraph() {
    method jTextField1_actionPerformed (line 810) | void jTextField1_actionPerformed(ActionEvent e) {
    method jTextField2_actionPerformed (line 814) | void jTextField2_actionPerformed(ActionEvent e) {
    method jButton_stack_mul_actionPerformed (line 818) | void jButton_stack_mul_actionPerformed(ActionEvent e) {
    method jButton_stack_div_actionPerformed (line 831) | void jButton_stack_div_actionPerformed(ActionEvent e) {
    method jButton_int_actionPerformed (line 844) | void jButton_int_actionPerformed(ActionEvent e) {
    method jButton_dif_actionPerformed (line 856) | void jButton_dif_actionPerformed(ActionEvent e) {
    method jButton_stack_add_actionPerformed (line 868) | void jButton_stack_add_actionPerformed(ActionEvent e) {
    method jButton_stack_sub_actionPerformed (line 881) | void jButton_stack_sub_actionPerformed(ActionEvent e) {
    method jButton_Clear_actionPerformed (line 894) | void jButton_Clear_actionPerformed(ActionEvent e) {

FILE: HW/hw3/PolyGraph.java
  class PolyGraph (line 14) | public final class PolyGraph extends Canvas {
    method PolyGraph (line 24) | public PolyGraph(CalculatorFrame cf) {
    method update (line 35) | @Override
    method paint (line 40) | @Override
    method updatePlotBuffer (line 216) | public void updatePlotBuffer(float xMin, float xMax, int numIncrements,
    method drawPlot (line 258) | public void drawPlot(float xMin, float xMax, float yMin, float yMax,

FILE: HW/hw3/RatNum.java
  class RatNum (line 21) | public final class RatNum extends Number implements Comparable<RatNum> {
    method RatNum (line 52) | public RatNum(int n) {
    method RatNum (line 63) | public RatNum(int n, int d) {
    method checkRep (line 91) | private void checkRep() throws RuntimeException {
    method isNaN (line 107) | public boolean isNaN() {
    method isNegative (line 113) | public boolean isNegative() {
    method isPositive (line 119) | public boolean isPositive() {
    method compareTo (line 130) | @Override
    method doubleValue (line 152) | @Override
    method intValue (line 165) | @Override
    method floatValue (line 183) | @Override
    method longValue (line 193) | @Override
    method negate (line 205) | public RatNum negate() {
    method add (line 215) | public RatNum add(RatNum arg) {
    method sub (line 227) | public RatNum sub(RatNum arg) {
    method mul (line 238) | public RatNum mul(RatNum arg) {
    method div (line 250) | public RatNum div(RatNum arg) {
    method gcd (line 265) | private static int gcd(int a, int b) {
    method hashCode (line 282) | @Override
    method equals (line 297) | @Override
    method toString (line 318) | @Override
    method valueOf (line 344) | public static RatNum valueOf(String ratStr) {

FILE: HW/hw3/RatPoly.java
  class RatPoly (line 15) | public final class RatPoly {
    method RatPoly (line 63) | public RatPoly() {
    method RatPoly (line 74) | public RatPoly(RatTerm rt) {
    method RatPoly (line 89) | public RatPoly(int c, int e) {
    method RatPoly (line 103) | private RatPoly(List<RatTerm> rt) {
    method degree (line 116) | public int degree() {
    method getTerm (line 130) | public RatTerm getTerm(int deg) {
    method isNaN (line 143) | public boolean isNaN() {
    method scaleCoeff (line 162) | private static void scaleCoeff(List<RatTerm> lst, RatNum scalar) {
    method incremExpt (line 183) | private static void incremExpt(List<RatTerm> lst, int degree) {
    method sortedInsert (line 221) | private static void sortedInsert(List<RatTerm> lst, RatTerm newTerm) {
    method copy (line 256) | private ArrayList<RatTerm> copy() {
    method negate (line 269) | public RatPoly negate() {
    method add (line 286) | public RatPoly add(RatPoly p) {
    method sub (line 304) | public RatPoly sub(RatPoly p) {
    method mul (line 320) | public RatPoly mul(RatPoly p) {
    method div (line 370) | public RatPoly div(RatPoly p) {
    method differentiate (line 407) | public RatPoly differentiate() {
    method antiDifferentiate (line 441) | public RatPoly antiDifferentiate(RatNum integrationConstant) {
    method integrate (line 473) | public double integrate(double lowerBound, double upperBound) {
    method eval (line 489) | public double eval(double d) {
    method toString (line 526) | @Override
    method valueOf (line 563) | public static RatPoly valueOf(String polyStr) {
    method hashCode (line 601) | @Override
    method equals (line 618) | @Override
    method checkRep (line 638) | private void checkRep() throws RuntimeException {

FILE: HW/hw3/RatPolyStack.java
  class RatPolyStack (line 20) | public final class RatPolyStack implements Iterable<RatPoly> {
    method RatPolyStack (line 35) | public RatPolyStack() {
    method size (line 45) | public int size() {
    method push (line 63) | public void push(RatPoly p) {
    method pop (line 77) | public RatPoly pop() {
    method dup (line 91) | public void dup() {
    method swap (line 104) | public void swap() {
    method clear (line 119) | public void clear() {
    method getNthFromTop (line 132) | public RatPoly getNthFromTop(int index) {
    method add (line 154) | public void add() {
    method sub (line 170) | public void sub() {
    method mul (line 186) | public void mul() {
    method div (line 202) | public void div() {
    method differentiate (line 219) | public void differentiate() {
    method integrate (line 235) | public void integrate() {
    method iterator (line 248) | @Override
    method checkRep (line 257) | private void checkRep() throws RuntimeException {

FILE: HW/hw3/RatTerm.java
  class RatTerm (line 25) | public final class RatTerm {
    method RatTerm (line 59) | public RatTerm(RatNum c, int e) {
    method getCoeff (line 76) | public RatNum getCoeff() {
    method getExpt (line 85) | public int getExpt() {
    method isNaN (line 94) | public boolean isNaN() {
    method isZero (line 103) | public boolean isZero() {
    method eval (line 115) | public double eval(double d) {
    method negate (line 127) | public RatTerm negate() {
    method add (line 142) | public RatTerm add(RatTerm p) {
    method sub (line 173) | public RatTerm sub(RatTerm p) {
    method mul (line 201) | public RatTerm mul(RatTerm p) {
    method div (line 217) | public RatTerm div(RatTerm p) {
    method differentiate (line 237) | public RatTerm differentiate() {
    method antiDifferentiate (line 261) | public RatTerm antiDifferentiate() {
    method toString (line 289) | @Override
    method valueOf (line 328) | public static RatTerm valueOf(String termStr) {
    method hashCode (line 390) | @Override
    method equals (line 405) | @Override
    method checkRep (line 423) | private void checkRep() throws RuntimeException {

FILE: HW/hw3/test/ImplementationTests.java
  class ImplementationTests (line 12) | @RunWith(Suite.class)

FILE: HW/hw3/test/RatNumSmallTest.java
  class RatNumSmallTest (line 17) | public final class RatNumSmallTest {
    method eq (line 71) | private void eq(RatNum ratNum, String rep) {
    method testOneArgConstructor (line 165) | @Test
    method testTwoArgConstructor (line 174) | @Test
    method testIsNaN (line 196) | @Test
    method assertPos (line 209) | private void assertPos(RatNum n) {
    method assertNeg (line 214) | private void assertNeg(RatNum n) {
    method testIsPosAndIsNeg (line 219) | @Test
    method approxEq (line 250) | private void approxEq(double expected, double actual) {
    method testApprox (line 254) | @Test
    method testEqualsReflexive (line 285) | @Test
    method testEquals (line 292) | @Test
    method testToStringSimple (line 351) | @Test
    method testToStringFractions (line 369) | @Test
    method testToStringNaN (line 384) | @Test
    method decChk (line 424) | private void decChk(String s, RatNum expected) {
    method testValueOf (line 429) | @Test
    method testNegate (line 465) | @Test
    method testAddSimple (line 486) | @Test
    method testAddComplex (line 497) | @Test
    method testAddImproper (line 513) | @Test
    method testAddOnNaN (line 522) | @Test
    method testAddTransitively (line 536) | @Test
    method testSubSimple (line 555) | @Test
    method testSubComplex (line 567) | @Test
    method testSubImproper (line 576) | @Test
    method testSubTransitively (line 589) | @Test
    method testMulProperties (line 612) | @Test
    method testMulSimple (line 633) | @Test
    method testMulComplex (line 640) | @Test
    method testMulImproper (line 649) | @Test
    method testMulOnNaN (line 657) | @Test
    method testMulTransitively (line 669) | @Test
    method testDivSimple (line 688) | @Test
    method testDivComplex (line 699) | @Test
    method testDivImproper (line 715) | @Test
    method testDivOnNaN (line 722) | @Test
    method testDivTransitively (line 736) | @Test
    method assertGreater (line 762) | private void assertGreater(RatNum larger, RatNum smaller) {
    method testCompareToReflexive (line 767) | @Test
    method testCompareToNonFract (line 775) | @Test
    method testCompareToFract (line 784) | @Test
    method testCompareToNaNs (line 796) | @Test

FILE: HW/hw3/test/RatNumTest.java
  class RatNumTest (line 20) | public final class RatNumTest {
    method eq (line 75) | private void eq(RatNum ratNum, String rep) {
    method testOneArgConstructor (line 174) | @Test
    method testTwoArgConstructorPos (line 183) | @Test
    method testTwoArgConstructorNeg (line 192) | @Test
    method testTwoArgConstructorImproperFract (line 197) | @Test
    method testTwoArgConstructorNaN (line 203) | @Test
    method testIsNaN (line 218) | @Test
    method testIsNotNaN (line 225) | @Test
    method assertPos (line 239) | private void assertPos(RatNum n) {
    method assertNeg (line 244) | private void assertNeg(RatNum n) {
    method testZeroIsNotPosNorNeg (line 250) | @Test
    method testIsNegWholeNum (line 256) | @Test
    method testIsNegFraction (line 261) | @Test
    method testIsPosWholeNum (line 267) | @Test
    method testIsPosFraction (line 274) | @Test
    method testNaNIsPos (line 282) | @Test
    method approxEq (line 299) | private void approxEq(double expected, double actual) {
    method testDoubleValueSmallNum (line 303) | @Test
    method testDoubleValueWholeNumber (line 311) | @Test // Whole numbers
    method testDoubleValueFracNumber (line 319) | @Test // Fractional numbers
    method testDoubleValueNaN (line 326) | @Test // NaN double Value
    method testFloatValueSmallNum (line 338) | @Test // Float Value Small Number
    method testFloatValueWholeNumber (line 346) | @Test // Float Value Whole Number
    method testFloatValueFracNumber (line 354) | @Test // Fractional numbers
    method testFloatValueNaN (line 361) | @Test // NaN Float Value
    method testIntValueUnsupported (line 373) | @Test
    method testIntValueWithOutRound (line 387) | @Test
    method testIntValueWithRoundtoPosOne (line 394) | @Test
    method testIntValueWithRoundtoNegOne (line 401) | @Test
    method testIntValueWithRoundMaxValue (line 408) | @Test
    method testIntValueWithRoundOneOverMaxValue (line 416) | @Test  //Ensure 1 / Max Value == 0
    method testIntValueMaxValueDivByMaxValue (line 422) | @Test  //Ensure Max Value / Max Value == 1
    method testIntValueWithRoundMinValue (line 430) | @Test
    method testIntValueMinValueDivByMinValue (line 438) | @Test //Ensure Min Value / Min Value == 1
    method testEqualsReflexive (line 458) | @Test
    method testEqualsSimple (line 465) | @Test
    method testEqualsSimpleWithDiffObjects (line 474) | @Test
    method testEqualsNotReducedFormOne (line 483) | @Test
    method testEqualsNotReducedFormNegOne (line 491) | @Test
    method testEqualsNotReducedFormFraction (line 498) | @Test
    method testEqualsNaN (line 505) | @Test
    method testEqualsForFalsePos (line 513) | @Test
    method testEqualsForSign (line 522) | @Test
    method testEqualsNotFalsePosWithFracs (line 529) | @Test
    method testToStringSimple (line 553) | @Test
    method testToStringFractions (line 571) | @Test
    method testToStringNaN (line 589) | @Test
    method testToStringOneDenom (line 607) | @Test
    method testToStringReduction (line 616) | @Test
    method decChk (line 636) | private void decChk(String s, RatNum expected) {
    method testValueOf (line 641) | @Test
    method testValueOfPosOne (line 647) | @Test
    method testValueOfNegOne (line 654) | @Test
    method testValueOfPosTwo (line 661) | @Test
    method testValueOfOneHalf (line 668) | @Test
    method testValueOfThreeHalfs (line 674) | @Test
    method testValueOfNa (line 680) | @Test
    method testNegateNaN (line 699) | @Test
    method testNegateToPos (line 706) | @Test
    method testNegateToNeg (line 712) | @Test
    method testAddSimple (line 726) | @Test
    method testAddComplexToOne (line 737) | @Test
    method testAddComplex (line 743) | @Test
    method testAddImproper (line 754) | @Test
    method testAddOnNaN (line 762) | @Test
    method testAddTransitivelyZero (line 777) | @Test
    method testAddTransitivelyOne (line 783) | @Test
    method testAddTransitivelyWholeNum (line 789) | @Test
    method testAddTransitivelyNaN (line 798) | @Test
    method testAddTransitivelyFractions (line 804) | @Test
    method testSubSimple (line 814) | @Test
    method testSubSimpleToNeg (line 823) | @Test
    method testSubComplex (line 830) | @Test
    method testSubImproper (line 839) | @Test
    method testSubOnNaN (line 845) | @Test
    method testSubTransitivetyWholeNumsToNonZero (line 859) | @Test
    method testSubTransitivetyWholeNumsToZero (line 871) | @Test
    method testSubTransitivelyComplex (line 877) | @Test
    method testSubTransitivelyNaN (line 886) | @Test
    method testMulPropertiesZero (line 897) | @Test
    method testMulPropertiesOne (line 906) | @Test
    method testMulPropertiesNegOne (line 915) | @Test
    method testMulSimple (line 924) | @Test
    method testMulComplexToOne (line 931) | @Test
    method testMulComplexToComplex (line 937) | @Test
    method testMulImproper (line 944) | @Test
    method testMulOnNaN (line 952) | @Test
    method testMulTransitivelyToNonZero (line 964) | @Test
    method testMulTransitivelyToZero (line 972) | @Test
    method testMulTransitivelyComplex (line 978) | @Test
    method testMulTransitivelyNaN (line 987) | @Test
    method testSimpleDivToZero (line 997) | @Test
    method testDivComplex (line 1006) | @Test
    method testDivImproper (line 1019) | @Test
    method testDivNaN (line 1026) | @Test
    method testDivOnNaN (line 1034) | @Test
    method testDivTransitivelyWholeNum (line 1048) | @Test
    method testDivTransitively (line 1056) | @Test
    method testDivTransitivelyNaN (line 1065) | @Test
    method assertGreater (line 1082) | private void assertGreater(RatNum larger, RatNum smaller) {
    method testCompareToReflexive (line 1087) | @Test
    method testCompareToNonFract (line 1095) | @Test
    method testCompareToFract (line 1104) | @Test
    method testCompareToNaNs (line 1116) | @Test

FILE: HW/hw3/test/RatPolyStackTest.java
  class RatPolyStackTest (line 15) | public final class RatPolyStackTest {
    method constantPoly (line 17) | private RatPoly constantPoly(int constant) {
    method constantPoly (line 23) | private RatPoly constantPoly(char constant) {
    method stack (line 28) | private RatPolyStack stack() {
    method stack (line 33) | private RatPolyStack stack(String desc) {
    method eqv (line 46) | private boolean eqv(RatPoly p1, RatPoly p2) {
    method assertStackIs (line 55) | private void assertStackIs(RatPolyStack s, String desc) {
    method testCtor (line 73) | @Test
    method testPush (line 83) | @Test
    method testPushCheckForSharingTwixtStacks (line 106) | @Test
    method testPop (line 134) | @Test
    method testDupWithOneVal (line 154) | @Test
    method testDupWithTwoVal (line 164) | @Test
    method testDupWithMultVal (line 175) | @Test
    method testSwapWithTwoElems (line 186) | @Test
    method testSwapWithMultElems (line 193) | @Test
    method testSwapWitSameElems (line 200) | @Test
    method testClear (line 211) | @Test
    method testAddTwoElems (line 225) | @Test
    method testAddMultiElems (line 232) | @Test
    method testSubTwoElems (line 256) | @Test
    method testSubMultiElems (line 263) | @Test
    method testMulTwoElems (line 284) | @Test
    method testMulMultiElems (line 291) | @Test
    method testDivTwoElems (line 314) | @Test
    method testDivMultiElems (line 321) | @Test
    method testDifferentiate (line 332) | @Test
    method testIntegrate (line 361) | @Test

FILE: HW/hw3/test/RatPolyTest.java
  class RatPolyTest (line 17) | public final class RatPolyTest {
    method num (line 21) | private static RatNum num(int i) {
    method poly (line 26) | private RatPoly poly(int coef, int expt) {
    method quadPoly (line 32) | private RatPoly quadPoly(int x2, int x1, int x0) {
    method valueOf (line 38) | private RatPoly valueOf(String s) {
    method zero (line 43) | private RatPoly zero() {
    method eq (line 48) | private void eq(RatPoly p, String target) {
    method eq (line 53) | private void eq(RatPoly p, String target, String message) {
    method eqP (line 62) | private void eqP(String s, int anticipDegree, RatNum[] anticipCoeffs) {
    method eqP (line 75) | private void eqP(String s, int anticipDegree, int[] intCoeffs) {
    method assertToStringWorks (line 84) | private void assertToStringWorks(String s) {
    method setUp (line 99) | @Before
    method testNoArgCtor (line 124) | @Test
    method testTwoArgCtorWithZeroExp (line 129) | @Test
    method testTwoArgCtorWithOneExp (line 137) | @Test
    method testTwoArgCtorWithLargeExp (line 143) | @Test
    method testIsNaN (line 156) | @Test
    method testIsNotNaN (line 161) | @Test
    method testIsNaNEmptyPolynomial (line 169) | @Test
    method testValueOfSimple (line 179) | @Test
    method testValueOfMultTerms (line 186) | @Test
    method testValueOfLeadingNeg (line 193) | @Test
    method testValueOfLeadingConstants (line 200) | @Test
    method testValueOfRationalsSingleTerms (line 208) | @Test
    method testValueOfRationalsMultipleTerms (line 216) | @Test
    method testValueOfNaN (line 229) | @Test
    method testToStringSimple (line 238) | @Test
    method testToStringMultTerms (line 245) | @Test
    method testToStringLeadingNeg (line 252) | @Test
    method testToStringLeadingConstants (line 259) | @Test
    method testToStringRationalsSingleElems (line 267) | @Test
    method testToStringRationalsMultiplElems (line 273) | @Test
    method testToStringNaN (line 282) | @Test
    method testDegreeZero (line 291) | @Test // test degree is zero when it should be
    method testDegreeNonZero (line 298) | @Test
    method testDegreeNonZeroMultiTerm (line 304) | @Test // test degree for multi termed polynomial
    method testNegateZero (line 314) | @Test // test degree is zero when it should be
    method testNegateNaN (line 319) | @Test // test degree is zero when it should be
    method testNegatePosToNeg (line 324) | @Test // test degree is zero when it should be
    method testNegatNegToPos (line 331) | @Test // test degree is zero when it should be
    method testAddSingleTerm (line 342) | @Test
    method testAddMultipleTerm (line 351) | @Test
    method testAddSameDegree (line 364) | @Test // p1 + p2 = p3 , p1 != 0 && p2 != 0, p1.degree == p2.degree
    method testAddDifferentDegree (line 373) | @Test // p1 + p2 = p3 , p1 != 0 && p2 != 0, p1.degree != p2.degree
    method testAddWithItSelf (line 379) | @Test // p + p = 2p
    method testAddAssociativity (line 385) | @Test // Addition Associativity (p1 + p2) + p3 = p1 + (p2 + p3)
    method testAddCommutativity (line 396) | @Test // Addition Commutative Rule p1 + p2 = p2 + p1
    method testAddZeroToZero (line 402) | @Test // Zero Polynomial + Zero Polynomial == Zero Polynomial
    method testAddZeroToNonZero (line 407) | @Test // Additive Identity p + Zero Polynomial == p && Zero Polynomial...
    method testAddInverse (line 413) | @Test // Additive Inverse p + (-p) = 0
    method testAddNaNtoNaN (line 420) | @Test // NaN + NaN == NaN
    method testAddNaNtoNonNaN (line 425) | @Test // t + NaN == NaN
    method testSubtractSameDegree (line 437) | @Test // p1 - p2 = p3 , p1 != 0 && p2 != 0, p1.degree == p2.degree
    method testSubtractDiffDegree (line 446) | @Test // p1 - p2 = p3 , p1 != 0 && p2 != 0, p1.degree != p2.degree
    method testSubtractZeroFromZero (line 452) | @Test // Zero Polynomial - Zero Polynomial == Zero Polynomial
    method testSubtractZeroAndNonZero (line 458) | @Test // p - ZeroPolynomial == t && ZeroPolynomial - p == -p
    method testSubtractNaNtoNaN (line 464) | @Test // NaN - NaN == NaN
    method testSubtractNaNtoNonNaN (line 469) | @Test // p - NaN == NaN && NaN - p == NaN
    method testZeroElim (line 479) | @Test
    method testSmallCoeff (line 493) | @Test
    method testMultiplicationSameDegree (line 504) | @Test // p1 + p2 = p3 , p1 != 0 && p2 != 0, p1.degree == p2.degree
    method testMultiplicationDiffDegree (line 514) | @Test // p1 + p2 = p3 , p1 != 0 && p2 != 0, p1.degree != p2.degree
    method testMultiplicationAssociativity (line 521) | @Test // Multiplication Associativity
    method testMultiplicationCommutativity (line 529) | @Test // Multiplication Commutative
    method testMultiplicationZeroToZero (line 535) | @Test // ZeroPolynomial * ZeroPolynomial == ZeroPolynomial
    method testMultiplicationZeroToNonZero (line 540) | @Test // p * ZeroPolynomial == ZeroPolynomial && ZeroPolynomial * p ==...
    method testMultiplicationNaNtoNaN (line 546) | @Test // NaN * NaN == NaN
    method testMultiplicationNaNtoNonNaN (line 551) | @Test // p * NaN == NaN
    method testMultiplicationIdentity (line 557) | @Test // p * 1 == p
    method testMulMultiplElem (line 563) | @Test
    method testDivEvaltoSingleCoeff (line 572) | @Test
    method testDivtoSingleTerm (line 596) | @Test
    method testDivtoMultipleTerms (line 615) | @Test
    method testDivComplexI (line 641) | @Test
    method testDivComplexII (line 651) | @Test
    method testDivExamplesFromSpec (line 673) | @Test
    method testDivExampleFromPset (line 684) | @Test
    method testBigDiv (line 690) | @Test
    method testDivByZero (line 707) | @Test // p / 0 = NaN
    method testDivisionZeroFromZero (line 714) | @Test // Zero Polynomial / Zero Polynomial == NaN
    method testDivisionZeroAndNonZero (line 720) | @Test // p / Zero Polynomial == NaN && Zero Polynomial / p == 0
    method testDivisionNaNtoNaN (line 725) | @Test // NaN / NaN == NaN
    method testDivisionNaNtoNonNaN (line 730) | @Test // p / NaN == NaN && NaN / p == NaN
    method testDivisionByOne (line 736) | @Test // p / 1 == p
    method testImmutabilityOfOperations (line 745) | @Test
    method testEvalZero (line 802) | @Test
    method testEvalOne (line 810) | @Test
    method testEvalX (line 819) | @Test
    method testEval2X (line 828) | @Test
    method testEvalXsq (line 837) | @Test
    method testEvalXSq_minus_2X (line 845) | @Test
    method testGetTerm (line 861) | @Test
    method assertIsNaNanswer (line 878) | private void assertIsNaNanswer(RatPoly nanAnswer) {
    method testDifferentiateNaN (line 887) | @Test
    method testDifferentiateZero (line 893) | @Test
    method testDifferentiateConstantNonZero (line 899) | @Test
    method testDifferentiatetoOne (line 905) | @Test  //f(x) = x => f' = 1
    method testDifferentiateMultiplicationRule (line 911) | @Test
    method testDifferentiatePowerRule (line 921) | @Test
    method testDifferentiateSumRule (line 928) | @Test
    method testDifferentiateSubtractionRule (line 937) | @Test
    method testDifferentiateProductRule (line 946) | @Test
    method testDifferentiatetoMultipleTerms (line 963) | @Test
    method testAntiDifferentiate (line 977) | @Test //AntiDifferentiate Basic functionality
    method testAntiDifferentiateWithQuadPoly (line 983) | @Test
    method testAntiDifferentiateFromZero (line 990) | @Test // Constant Rule with zero f(x) = 0 => F = c
    method testAntiDifferentiateConstantRule (line 999) | @Test
    method testAntiDifferentiateConstantMultipleRule (line 1009) | @Test
    method testAntiDifferentiatePowerRule (line 1023) | @Test
    method testAntiDifferentiateSumRule (line 1030) | @Test
    method testAntiDifferentiateDifferenceRule (line 1041) | @Test
    method testAntiDifferentiateWithNaN (line 1053) | @Test
    method testIntegrateEqualBounds (line 1064) | @Test
    method testIntegrateBoundsDiffBy1 (line 1070) | @Test
    method testIntegrateLowBoundGreaterThanHigh (line 1076) | @Test
    method testIntegrateLargeBoundDiff (line 1082) | @Test
    method testIntegrateZero (line 1088) | @Test
    method testIntegrateOne (line 1093) | @Test
    method testIntegrateNaN (line 1098) | @Test

FILE: HW/hw3/test/RatTermTest.java
  class RatTermTest (line 13) | public final class RatTermTest {
    method num (line 16) | private static RatNum num(int i) {
    method num (line 20) | private static RatNum num(int i, int j) {
    method term (line 30) | private static RatTerm term(int coeff, int expt) {
    method term (line 35) | private static RatTerm term(int numer, int denom, int expt) {
    method testCtor (line 49) | @Test
    method testCtorZeroCoeff (line 57) | @Test
    method testCtorNaN (line 63) | @Test
    method testGetCoeffRegular (line 72) | @Test
    method testGetCoeffZero (line 79) | @Test
    method testGetCoeffNegative (line 85) | @Test
    method testGetCoeffNaN (line 91) | @Test
    method testGetExptRegular (line 101) | @Test
    method testGetExptZero (line 107) | @Test
    method testIsNaNZeroDenomRegNumer (line 118) | @Test
    method testIsNaNZeroDenomZeroNumer (line 124) | @Test
    method testIsNaNFalse (line 130) | @Test
    method testIsZeroNumAndDen (line 140) | @Test
    method testIsZeroNum (line 145) | @Test
    method testIsZeroFalsoPos (line 152) | @Test
    method testIsNaNNotTerm (line 158) | @Test
    method testEvalZero (line 168) | @Test
    method testEvalSmallFrac (line 174) | @Test
    method testEvalSmallWhole (line 179) | @Test
    method testEvalLarge (line 187) | @Test
    method testEvalNegative (line 193) | @Test
    method testEvalNaN (line 199) | @Test
    method testEquals (line 211) | @Test
    method testNotEqualsReg (line 217) | @Test
    method testEqualsZeroCoeff (line 222) | @Test
    method testEqualsNotZeroCoeff (line 228) | @Test
    method testEqualsNaNCoeff (line 233) | @Test
    method testEqualsNotNaNCoeff (line 239) | @Test
    method testValueOf (line 251) | private void testValueOf(String actual, RatTerm target) {
    method testValueOfSimple (line 255) | @Test
    method testValueOfConst (line 261) | @Test
    method testValueOfLeadingCoeff (line 269) | @Test
    method testValueOfPow (line 276) | @Test
    method testValueOfFull (line 282) | @Test
    method testValueOfNaN (line 289) | @Test
    method testValueOfZero (line 294) | @Test
    method testToString (line 303) | private void testToString(String target, RatTerm actual) {
    method testToStringSimple (line 307) | @Test
    method testToStringConst (line 313) | @Test
    method testToStringLeadingCoeff (line 321) | @Test
    method testToStringPow (line 328) | @Test
    method testToStringFull (line 334) | @Test
    method testToStringNaN (line 341) | @Test
    method testToStringZero (line 346) | @Test
    method testAddWholeNumCoeff (line 356) | @Test // Addition with Whole Number Coefficient
    method testAddFracNumCoeff (line 362) | @Test // Addition with Fractional Number Coefficient
    method testAddAssociativity (line 369) | @Test // Addition Associativity
    method testAddCommutativity (line 380) | @Test // Addition Commutative
    method testAddZeroToZero (line 386) | @Test // Zero Term + Zero Term == Zero Term
    method testAddZeroToNonZero (line 391) | @Test // t + Zero Term == t && Zero Term + t == t
    method testAddNaNtoNaN (line 398) | @Test // NaN + NaN == NaN
    method testAddNaNtoNonNaN (line 403) | @Test // t + NaN == NaN
    method testSubtractWholeNumCoeff (line 415) | @Test // Subtraction with Whole Number Coefficient
    method testSubtractFractionalNumCoeff (line 422) | @Test // Subtraction with Fractional Number Coefficient
    method testSubtractZeroFromZero (line 429) | @Test // Zero Term - Zero Term == Zero Term
    method testSubtractZeroAndNonZero (line 435) | @Test // t - Zero Term == t && Zero Term - t == -t
    method testSubtractNaNtoNaN (line 442) | @Test // NaN - NaN == NaN
    method testSubtractNaNtoNonNaN (line 447) | @Test // t - NaN == NaN && NaN - t == NaN
    method testMultiplicationWholeNumCoeff (line 457) | @Test // Multiplication with Whole Number Coefficient
    method testMultiplicationFracNumCoeff (line 463) | @Test // Multiplication with Fractional Number Coefficient
    method testMultiplicationDifferentExpVal (line 469) | @Test // Multiplication with different Exponent Values
    method testMultiplicationAssociativity (line 476) | @Test // Multiplication Associativity
    method testMultiplicationCommutativity (line 487) | @Test // Multiplication Commutative
    method testMultiplicationZeroToZero (line 496) | @Test // Zero Term * Zero Term == Zero Term
    method testMultiplicationZeroToNonZero (line 501) | @Test // t * Zero Term == Zero Term && Zero Term * t == Zero Term
    method testMultiplicationNaNtoNaN (line 508) | @Test // NaN * NaN == NaN
    method testMultiplicationNaNtoNonNaN (line 513) | @Test // t * NaN == NaN
    method testMultiplicationIdentity (line 519) | @Test // a * 1 == a
    method testDivisionWholeNumCoeff (line 528) | @Test // Division with Whole Number Coefficient
    method testDivisionFractionalNumCoeff (line 535) | @Test // Division with Fractional Number Coefficient
    method testDivisionZeroFromZero (line 542) | @Test // Zero Term / Zero Term == NaN
    method testDivisionZeroAndNonZero (line 548) | @Test // t / Zero Term == NaN && Zero Term / t == 0
    method testDivisionNaNtoNaN (line 555) | @Test // NaN / NaN == NaN
    method testDivisionNaNtoNonNaN (line 560) | @Test // t / NaN == NaN && NaN / t == NaN
    method testDivisionByOne (line 566) | @Test // a / 1 == a
    method testDifferentiateNaN (line 578) | @Test
    method testDifferentiateZero (line 585) | @Test
    method testDifferentiateConstantNonZero (line 591) | @Test
    method testDifferentiateMultiplicationRule (line 598) | @Test
    method testDifferentiatePowerRule (line 610) | @Test
    method testDifferentiateSumRule (line 619) | @Test
    method testDifferentiateSubtractionRule (line 631) | @Test
    method testDifferentiateProductRule (line 643) | @Test
    method testAntiDifferentiateConstantRule (line 668) | @Test
    method testAntiDifferentiateConstantMultipleRule (line 678) | @Test
    method testAntiDifferentiatePowerRule (line 690) | @Test
    method testAntiDifferentiateSumRule (line 697) | @Test
    method testAntiDifferentiateDifferenceRule (line 709) | @Test
    method testHashCodeSameObject (line 725) | @Test
    method testHashCodeEqualDiffObjects (line 734) | @Test
    method testHashCodeNonEqualObjects (line 742) | @Test

FILE: HW/hw3/test/SpecificationTests.java
  class SpecificationTests (line 12) | @RunWith(Suite.class)

FILE: HW/hw4/DGraph.java
  class DGraph (line 22) | public class DGraph<T, E extends Comparable<E>> {
    method DGraph (line 49) | public DGraph() {
    method addNode (line 63) | public boolean addNode(T n) {
    method addEdge (line 100) | public boolean addEdge(T from, T to, E label) {
    method containsNode (line 139) | public boolean containsNode(T n) {
    method getNodes (line 154) | public Set<T> getNodes() {
    method size (line 164) | public int size() {
    method isEmpty (line 174) | public boolean isEmpty() {
    method childrenOf (line 188) | public Set<LabeledEdge<T, E>> childrenOf(T n) {
    method numberOfEdges (line 213) | public int numberOfEdges(T node1, T node2) {
    method removeEdge (line 257) | public /*@Nullable*/ LabeledEdge<T, E> removeEdge(T from, T to,
    method entrySet (line 291) | public Set<Map.Entry<T, HashSet<LabeledEdge<T, E>>>> entrySet() {
    method toString (line 301) | public String toString() {
    method checkRep (line 309) | private void checkRep() throws RuntimeException {

FILE: HW/hw4/LabeledEdge.java
  class LabeledEdge (line 13) | public class LabeledEdge<T, E extends Comparable<E>>
    method LabeledEdge (line 35) | public LabeledEdge(T d, E l) {
    method getDest (line 49) | public T getDest() {
    method getLabel (line 59) | public E getLabel() {
    method toString (line 69) | @Override
    method equals (line 84) | @Override
    method hashCode (line 100) | @Override
    method compareTo (line 116) | @Override
    method checkRep (line 140) | private void checkRep() throws RuntimeException {

FILE: HW/hw4/nullness/NullnessExample.java
  class NullnessExample (line 16) | public class NullnessExample {
    method example (line 18) | public void example() {
    method exampleGenerics (line 31) | public /*@NonNull*/ String exampleGenerics() {

FILE: HW/hw4/nullness/NullnessExampleWithWarnings.java
  class NullnessExampleWithWarnings (line 16) | public class NullnessExampleWithWarnings {
    method example (line 18) | public void example() {
    method exampleGenerics (line 31) | public /*@NonNull*/ String exampleGenerics() {

FILE: HW/hw4/problem1/IntQueue1.java
  class IntQueue1 (line 23) | public class IntQueue1 {
    method IntQueue1 (line 36) | public IntQueue1() {
    method enqueue (line 48) | public void enqueue(Integer entry) {
    method dequeue (line 63) | public Integer dequeue() {
    method front (line 74) | public Integer front() {
    method size (line 82) | public int size() {
    method isEmpty (line 90) | public boolean isEmpty() {
    method checkRep (line 94) | public void checkRep() {

FILE: HW/hw4/problem1/IntQueue2.java
  class IntQueue2 (line 21) | public class IntQueue2 {
    method IntQueue2 (line 50) | public IntQueue2() {
    method enqueue (line 63) | public void enqueue(Integer entry) {
    method dequeue (line 88) | public Integer dequeue() {
    method front (line 100) | public Integer front() {
    method size (line 108) | public int size() {
    method isEmpty (line 116) | public boolean isEmpty() {
    method checkRep (line 120) | public void checkRep() {

FILE: HW/hw4/test/DGraphTest.java
  class DGraphTest (line 24) | public class DGraphTest {
    method setUp (line 39) | @Before
    method testIsEmptyWhenConstructed (line 46) | @Test(timeout = TIMEOUT)
    method testSizeWhenConstructed (line 51) | @Test(timeout = TIMEOUT)
    method testGetNodesWhenConstructed (line 56) | @Test(timeout = TIMEOUT)
    method testToStringWhenConstructed (line 61) | @Test(timeout = TIMEOUT)
    method testAddingNullNode (line 66) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testContainsNodeWithNullNode (line 71) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testChildrenOfWithNullNode (line 76) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testContainsNodeOnNodeAWithoutAddingNodeA (line 81) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeAWithoutAddingNodeA (line 86) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testAddEdgeWithFromToLabelNull (line 91) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testAddEdgeWithToLabelNull (line 96) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testAddEdgeWithLabelNull (line 101) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testRemoveEdgeWithFromToLabelNull (line 106) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testRemoveEdgeWithToLabelNull (line 111) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testRemoveEdgeWithLabelNull (line 116) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method tesNumberOfEdgesWithNode1Null (line 121) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method tesNumberOfEdgesWithNode2Null (line 126) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testAddingOneNode (line 131) | @Test(timeout = TIMEOUT)
    method testIsEmptyAfterAddingOneNode (line 136) | @Test(timeout = TIMEOUT)
    method testSizeAfterAddingOneNode (line 142) | @Test(timeout = TIMEOUT)
    method testToStringAfterAddingOneNode (line 148) | @Test(timeout = TIMEOUT)
    method testContainsNodeOnNodeAAfterAddingNodeA (line 154) | @Test(timeout = TIMEOUT)
    method testContainsNodeOnNodeBAfterAddingNodeA (line 160) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeAWithoutAddingEdge (line 166) | @Test(timeout = TIMEOUT)
    method testGetNodesAfterAddingOneNode (line 172) | @Test(timeout = TIMEOUT)
    method testAddEdgeABWithoutAddingNodeB (line 179) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testAddEdgeBAWithoutAddingNodeB (line 185) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testNumberOfEdgesFromNodeAToNodeBWithoutAddingNodeB (line 191) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testNumberOfEdgesFromNodeBToNodeAWithoutAddingNodeB (line 197) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testAddingSameNodeTwice (line 203) | @Test(timeout = TIMEOUT)
    method testSizeAfterAddingSameNodeTwice (line 209) | @Test(timeout = TIMEOUT)
    method testToStringAfterAddingSameNodeTwice (line 215) | @Test(timeout = TIMEOUT)
    method testAddingTwoDifferentNodes (line 221) | @Test(timeout = TIMEOUT)
    method testSizeAfterAddingTwoDifferentNodes (line 227) | @Test(timeout = TIMEOUT)
    method testGetNodesAfterAddingTwoDifferentNodes (line 233) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeAToNodeBWithoutAddingEdge (line 241) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeBToNodeAWithoutAddingEdge (line 247) | @Test(timeout = TIMEOUT)
    method testAddingReflexiveEdgeOnNodeA (line 253) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeAAfterAddingReflexiveEdgeOnNodeA (line 259) | @Test(timeout = TIMEOUT)
    method testToStringAfterAddingReflexiveEdgeOnNodeA (line 267) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeAToNodeAAfterAddingReflexiveEdge (line 273) | @Test(timeout = TIMEOUT)
    method testRemoveReflexiveEdgeOnNodeA (line 279) | @Test(timeout = TIMEOUT)
    method testRemoveEdgeOnNodeAWithNonExistingEdge (line 286) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testRemoveEdgeWithExistingEdgeButDifferentLabel (line 292) | @Test(timeout = TIMEOUT)
    method testChildrenOfAfterRemoveReflexiveEdgeOnNodeA (line 298) | @Test(timeout = TIMEOUT)
    method testToStringAfterRemoveReflexiveEdgeOnNodeA (line 304) | @Test(timeout = TIMEOUT)
    method testAddingOneEdgeBetweenTwoNodes (line 310) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeAAfterAddingOneEdgeBetweenNodeAAndNodeB (line 316) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeBAfterAddingOneEdgeBetweenNodeAAndNodeB (line 323) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeAToNodeBAfterAddingOneEdgeBetweenNodeAAndNodeB (line 329) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeBToNodeAAfterAddingOneEdgeBetweenNodeAAndNodeB (line 335) | @Test(timeout = TIMEOUT)
    method testAddingSameEdgeAfterAddingOneEdgeBetweenTwoNodes (line 341) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeAAfterAddingSameEdge (line 347) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeBAfterAddingSameEdge (line 354) | @Test(timeout = TIMEOUT)
    method testAddingTwoInverseDirectionsEdgesBetweenNodeAAndNodeB (line 361) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeAAfterAddingTwoInverseDirectionsEdges (line 367) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeBAfterAddingTwoInverseDirectionsEdges (line 374) | @Test(timeout = TIMEOUT)
    method testMakeCompleteGraphWithTwoNodes (line 381) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeAAfterMakingCompleteGraphWithTwoNodes (line 392) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeBAfterMakingCompleteGraphWithTwoNodes (line 400) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeAToNodeAAfterMakingCompleteGraph (line 408) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeAToNodeBAfterMakingCompleteGraph (line 414) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeBToNodeAAfterMakingCompleteGraph (line 420) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeBToNodeBAfterMakingCompleteGraph (line 426) | @Test(timeout = TIMEOUT)
    method testMakingMultigraphWithTwoNodes (line 432) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeAAfterMakingMultigraphWithTwoNodes (line 438) | @Test(timeout = TIMEOUT)
    method testChildrenOfNodeBAfterMakingMultigraphWithTwoNodes (line 447) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeAToNodeAAfterMakingMakingMultigraph (line 455) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeAToNodeBAfterMakingMakingMultigraph (line 461) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeBToNodeAAfterMakingMakingMultigraph (line 467) | @Test(timeout = TIMEOUT)
    method testNumberOfEdgesFromNodeBToNodeBAfterMakingMakingMultigraph (line 473) | @Test(timeout = TIMEOUT)
    method testEntrySetAfterMakingMultigraphWithTwoNodes (line 479) | @Test(timeout = TIMEOUT)

FILE: HW/hw4/test/HW4TestDriver.java
  class HW4TestDriver (line 13) | public class HW4TestDriver {
    method main (line 15) | public static void main(String args[]) {
    method printUsage (line 50) | private static void printUsage() {
    method HW4TestDriver (line 69) | public HW4TestDriver(Reader r, Writer w) {
    method runTests (line 78) | public void runTests()
    method executeCommand (line 107) | private void executeCommand(String command, List<String> arguments) {
    method createGraph (line 127) | private void createGraph(List<String> arguments) {
    method createGraph (line 136) | private void createGraph(String graphName) {
    method addNode (line 141) | private void addNode(List<String> arguments) {
    method addNode (line 152) | private void addNode(String graphName, String nodeName) {
    method addEdge (line 158) | private void addEdge(List<String> arguments) {
    method addEdge (line 171) | private void addEdge(String graphName, String parentName, String child...
    method listNodes (line 179) | private void listNodes(List<String> arguments) {
    method listNodes (line 188) | private void listNodes(String graphName) {
    method listChildren (line 199) | private void listChildren(List<String> arguments) {
    method listChildren (line 209) | private void listChildren(String graphName, String parentName) {
    class CommandException (line 240) | static class CommandException extends RuntimeException {
      method CommandException (line 242) | public CommandException() {
      method CommandException (line 245) | public CommandException(String s) {

FILE: HW/hw4/test/ImplementationTests.java
  class ImplementationTests (line 16) | @RunWith(Suite.class)

FILE: HW/hw4/test/LabeledEdgeTest.java
  class LabeledEdgeTest (line 18) | public class LabeledEdgeTest {
    method setUp (line 22) | @Before
    method testConstructEdgeWithNullDestination (line 27) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testConstructEdgeWithNullLabel (line 32) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetDestination (line 37) | @Test(timeout = TIMEOUT)
    method testGetLabel (line 42) | @Test(timeout = TIMEOUT)
    method testToString (line 47) | @Test(timeout = TIMEOUT)
    method testEqualsWithNonLabeledEdgeObject (line 52) | @Test(timeout = TIMEOUT)
    method testEqualsWithDifferentLabeledEdge (line 57) | @Test(timeout = TIMEOUT)
    method testEqualsWithSameLabeledEdge (line 62) | @Test(timeout = TIMEOUT)
    method testHashCodeForSameLabeledEdge (line 67) | @Test(timeout = TIMEOUT)
    method testCompareToLexicographicallyGreaterDestination (line 73) | @Test(timeout = TIMEOUT)
    method testCompareToLexicographicallyLessDestination (line 78) | @Test(timeout = TIMEOUT)
    method testCompareToLexicographicallyGreaterLabel (line 83) | @Test(timeout = TIMEOUT)
    method testCompareToLexicographicallyLessLabel (line 88) | @Test(timeout = TIMEOUT)
    method testCompareToSameLabeledEdge (line 93) | @Test(timeout = TIMEOUT)

FILE: HW/hw4/test/ScriptFileTests.java
  class ScriptFileTests (line 29) | @RunWith(LabelledParameterized.class)
    method accept (line 34) | @Override
    method calculateTestFiles (line 50) | public static void calculateTestFiles() {
    method getTestFiles (line 81) | @Parameters
    method getTestLabels (line 106) | @Labels
    method ScriptFileTests (line 119) | public ScriptFileTests(File testScriptFile) {
    method fileContents (line 129) | private String fileContents(File f) throws IOException {
    method runScriptFile (line 158) | private String runScriptFile() throws IOException {
    method fileWithSuffix (line 179) | private File fileWithSuffix(String newSuffix) {
    method checkAgainstExpectedOutput (line 191) | @Test

FILE: HW/hw4/test/SpecificationTests.java
  class SpecificationTests (line 18) | @RunWith(Suite.class)

FILE: HW/hw5/MarvelParser.java
  class MarvelParser (line 8) | public class MarvelParser {
    method parseData (line 28) | public static void parseData(String filename, Set <String> characters,

FILE: HW/hw5/MarvelPaths.java
  class MarvelPaths (line 24) | public class MarvelPaths {
    method buildGraph (line 35) | public static DGraph<String, String> buildGraph(String filename) throw...
    method BFS (line 87) | public static /*@Nullable*/ List<LabeledEdge<String, String>> BFS(
    method main (line 174) | public static void main(String[] args) throws Exception {

FILE: HW/hw5/test/HW5TestDriver.java
  class HW5TestDriver (line 16) | public class HW5TestDriver {
    method main (line 17) | public static void main(String args[]) {
    method printUsage (line 52) | private static void printUsage() {
    method HW5TestDriver (line 70) | public HW5TestDriver(Reader r, Writer w) {
    method runTests (line 78) | public void runTests()
    method executeCommand (line 108) | private void executeCommand(String command, List<String> arguments) {
    method createGraph (line 132) | private void createGraph(List<String> arguments) {
    method createGraph (line 141) | private void createGraph(String graphName) {
    method addNode (line 146) | private void addNode(List<String> arguments) {
    method addNode (line 157) | private void addNode(String graphName, String nodeName) {
    method addEdge (line 163) | private void addEdge(List<String> arguments) {
    method addEdge (line 176) | private void addEdge(String graphName, String parentName, String child...
    method listNodes (line 184) | private void listNodes(List<String> arguments) {
    method listNodes (line 193) | private void listNodes(String graphName) {
    method listChildren (line 204) | private void listChildren(List<String> arguments) {
    method listChildren (line 214) | private void listChildren(String graphName, String parentName) {
    method loadGraph (line 242) | private void loadGraph(List<String> arguments) throws Exception {
    method loadGraph (line 253) | private void loadGraph(String graphName, String filename) throws Excep...
    method findPath (line 259) | private void findPath(List<String> arguments) {
    method findPath (line 271) | private void findPath(String graphName, String node1Name, String node2...
    class CommandException (line 304) | static class CommandException extends RuntimeException {
      method CommandException (line 306) | public CommandException() {
      method CommandException (line 309) | public CommandException(String s) {

FILE: HW/hw5/test/ImplementationTests.java
  class ImplementationTests (line 16) | @RunWith(Suite.class)

FILE: HW/hw5/test/ScriptFileTests.java
  class ScriptFileTests (line 29) | @RunWith(LabelledParameterized.class)
    method accept (line 34) | @Override
    method calculateTestFiles (line 50) | public static void calculateTestFiles() {
    method getTestFiles (line 81) | @Parameters
    method getTestLabels (line 106) | @Labels
    method ScriptFileTests (line 119) | public ScriptFileTests(File testScriptFile) {
    method fileContents (line 129) | private String fileContents(File f) throws IOException {
    method runScriptFile (line 158) | private String runScriptFile() throws IOException {
    method fileWithSuffix (line 179) | private File fileWithSuffix(String newSuffix) {
    method checkAgainstExpectedOutput (line 191) | @Test(timeout=30000)

FILE: HW/hw5/test/SpecificationTests.java
  class SpecificationTests (line 18) | @RunWith(Suite.class)

FILE: HW/hw5/test/TestMarvelPaths.java
  class TestMarvelPaths (line 10) | public class TestMarvelPaths {
    method setUp (line 14) | @Before
    method testBuildGraphWithNullInput (line 19) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testBFSWithNullGraph (line 24) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testBFSWithNullStartOfPath (line 29) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testBFSWithNullEndOfPath (line 34) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testBFSWithStartNotInGraph (line 39) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testBFSWithEndNotInGraph (line 44) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)

FILE: HW/hw6/MarvelParser2.java
  class MarvelParser2 (line 11) | public class MarvelParser2 {
    method parseData (line 30) | public static void parseData(String filename,

FILE: HW/hw6/MarvelPaths2.java
  class MarvelPaths2 (line 23) | public class MarvelPaths2 {
    method buildGraph (line 34) | public static DGraph<String, Double> buildGraph(String filename) throw...
    method minimumCostPath (line 78) | public static <T> /*@Nullable*/ List<LabeledEdge<T, Double>> minimumCo...
    method main (line 174) | public static void main(String[] args) throws Exception {

FILE: HW/hw6/test/HW6TestDriver.java
  class HW6TestDriver (line 17) | public class HW6TestDriver {
    method main (line 19) | public static void main(String args[]) {
    method printUsage (line 54) | private static void printUsage() {
    method HW6TestDriver (line 72) | public HW6TestDriver(Reader r, Writer w) {
    method runTests (line 81) | public void runTests() throws IOException {
    method executeCommand (line 108) | private void executeCommand(String command, List<String> arguments) {
    method createGraph (line 132) | private void createGraph(List<String> arguments) {
    method createGraph (line 141) | private void createGraph(String graphName) {
    method addNode (line 146) | private void addNode(List<String> arguments) {
    method addNode (line 157) | private void addNode(String graphName, String nodeName) {
    method addEdge (line 163) | private void addEdge(List<String> arguments) {
    method addEdge (line 182) | private void addEdge(String graphName, String parentName, String child...
    method listNodes (line 190) | private void listNodes(List<String> arguments) {
    method listNodes (line 199) | private void listNodes(String graphName) {
    method listChildren (line 210) | private void listChildren(List<String> arguments) {
    method listChildren (line 220) | private void listChildren(String graphName, String parentName) {
    method loadGraph (line 232) | private void loadGraph(List<String> arguments) throws Exception {
    method loadGraph (line 243) | private void loadGraph(String graphName, String filename) throws Excep...
    method findPath (line 249) | private void findPath(List<String> arguments) {
    method findPath (line 261) | private void findPath(String graphName, String node1Name, String node2...
    class CommandException (line 299) | static class CommandException extends RuntimeException {
      method CommandException (line 301) | public CommandException() {
      method CommandException (line 304) | public CommandException(String s) {

FILE: HW/hw6/test/ImplementationTests.java
  class ImplementationTests (line 16) | @RunWith(Suite.class)

FILE: HW/hw6/test/ScriptFileTests.java
  class ScriptFileTests (line 32) | @RunWith(LabelledParameterized.class)
    method accept (line 37) | public boolean accept(File file) {
    method calculateTestFiles (line 52) | public static void calculateTestFiles() {
    method getTestFiles (line 83) | @Parameters
    method getTestLabels (line 107) | @Labels
    method ScriptFileTests (line 119) | public ScriptFileTests(File testScriptFile) {
    method fileContents (line 129) | private String fileContents(File f) throws IOException {
    method runScriptFile (line 157) | private String runScriptFile() throws IOException {
    method fileWithSuffix (line 177) | private File fileWithSuffix(String newSuffix) {
    method checkAgainstExpectedOutput (line 189) | @Test(timeout=30000)

FILE: HW/hw6/test/SpecificationTests.java
  class SpecificationTests (line 18) | @RunWith(Suite.class)

FILE: HW/hw6/test/TestMarvelPaths2.java
  class TestMarvelPaths2 (line 10) | public class TestMarvelPaths2 {
    method setUp (line 14) | @Before
    method testBuildGraphWithNullInput (line 19) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testminimumCostPathWithNullGraph (line 24) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testminimumCostPathWithNullStartOfPath (line 29) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testminimumCostPathWithNullEndOfPath (line 34) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testminimumCostPathWithStartNotInGraph (line 39) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testminimumCostPathWithEndNotInGraph (line 44) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)

FILE: HW/hw7/CampusDataParser.java
  class CampusDataParser (line 14) | public class CampusDataParser {
    method parseBuildingData (line 36) | public static void parseBuildingData(String buildings,
    method buildCampusPaths (line 107) | public static void buildCampusPaths(String paths,

FILE: HW/hw7/CampusRouteFindingModel.java
  class CampusRouteFindingModel (line 26) | public class CampusRouteFindingModel {
    method CampusRouteFindingModel (line 78) | public CampusRouteFindingModel(String buildings, String paths) throws ...
    method getBuildings (line 111) | public Map<String, String> getBuildings() {
    method getFullNameOfBuilding (line 124) | public String getFullNameOfBuilding(String buildingName) {
    method getAbbreviatedNameOfBuilding (line 146) | public String getAbbreviatedNameOfBuilding(String buildingName) {
    method getLocationOfBuilding (line 169) | public /*@Nullable*/ Coordinates getLocationOfBuilding(String building...
    method findShortestWalkingRoute (line 188) | public /*@Nullable*/ Map<Coordinates, Double> findShortestWalkingRoute(
    method checkRep (line 209) | private void checkRep() {

FILE: HW/hw7/CampusRouteFindingTool.java
  class CampusRouteFindingTool (line 19) | public class CampusRouteFindingTool {
    method getAllBuildings (line 36) | public static void getAllBuildings(CampusRouteFindingModel model) {
    method getShortestWalkingRoute (line 63) | public static void getShortestWalkingRoute(CampusRouteFindingModel model,
    method determineDirection (line 138) | private static String determineDirection(double theta) {
    method main (line 171) | public static void main(String[] args) {

FILE: HW/hw7/Coordinates.java
  class Coordinates (line 12) | public class Coordinates {
    method Coordinates (line 32) | public Coordinates(double x, double y) {
    method getX (line 43) | public double getX() {
    method getY (line 53) | public double getY() {
    method equals (line 64) | @Override
    method hashCode (line 82) | @Override
    method checkRep (line 91) | private void checkRep() {

FILE: HW/hw7/test/CampusDataParserTest.java
  class CampusDataParserTest (line 22) | public class CampusDataParserTest {
    method setUp (line 29) | @Before
    method testParseEmptyBuildingData (line 37) | @Test(timeout = TIMEOUT)
    method testBuildEmptyCampusPaths (line 44) | @Test(timeout = TIMEOUT)
    method testParseBuildingDataTwoBuildings (line 50) | @Test(timeout = TIMEOUT)
    method testBuildCampusPathsTwoPaths (line 63) | @Test(timeout = TIMEOUT)
    method testParseBuildingDataTwoBuildingsWithComments (line 76) | @Test(timeout = TIMEOUT)
    method testBuildCampusPathsTwoPathsWithComments (line 89) | @Test(timeout = TIMEOUT)
    method testParseBadFormatedBuildingData (line 103) | @Test(timeout = TIMEOUT, expected = Exception.class)
    method testBuildBadFormatedPaths (line 109) | @Test(timeout = TIMEOUT, expected = Exception.class)
    method testBuildBadFormatedPaths2 (line 115) | @Test(timeout = TIMEOUT, expected = Exception.class)
    method testParseSportsBuildingData (line 120) | @Test(timeout = TIMEOUT)
    method testBuildSportsPaths (line 141) | @Test(timeout = TIMEOUT)

FILE: HW/hw7/test/CampusRouteFindingModelTest.java
  class CampusRouteFindingModelTest (line 25) | public class CampusRouteFindingModelTest {
    method testConstructModelSuccessWithNoException (line 28) | @Test(timeout = TIMEOUT)
    method testConstructModelThrowsExceptionBadBuildingsData (line 34) | @Test(timeout = TIMEOUT, expected = Exception.class)
    method testConstructModelThrowsExceptionBadPathsData (line 40) | @Test(timeout = TIMEOUT, expected = Exception.class)
    method testConstructModelWithBothArgumentsNull (line 46) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testConstructModelWithPathsNull (line 51) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testConstructModelWithBuldingsNull (line 56) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetBuildingsEmptyBuildings (line 61) | @Test(timeout = TIMEOUT)
    method testGetFullNameOfBuildingWithNullArgument (line 69) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetAbbreviatedNameOfBuildingWithNullArgument (line 77) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetFullNameOfBuildingWithNonExistingBuilding (line 85) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetAbbreviatedNameOfBuildingWithNonExistingBuilding (line 93) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetLocationOfBuildingWithNullArgument (line 101) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetLocationOfBuildingWithNonExistingBuilding (line 109) | @Test(timeout = TIMEOUT)
    method testFindShortestWalkingRouteWithBothArgumentNull (line 117) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testFindShortestWalkingRouteWithStartingLocationNull (line 125) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testFindShortestWalkingRouteWithEndingLocationNull (line 133) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetBuildingsTwoBuildings (line 141) | @Test(timeout = TIMEOUT)
    method testGetFullNameOfBuildingTwoBuildingsWithNonExistingBuilding (line 151) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetAbbreviatedNameOfBuildingTwoBuildingsWithNonExistingBuilding (line 159) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testGetFullNameOfBuildingTwoBuildingsWithAA (line 167) | @Test(timeout = TIMEOUT)
    method testGetAbbreviatedNameOfBuildingTwoBuildingsWithApartmentA (line 175) | @Test(timeout = TIMEOUT)
    method testGetFullNameOfBuildingTwoBuildingsWithAB (line 183) | @Test(timeout = TIMEOUT)
    method testGetAbbreviatedNameOfBuildingTwoBuildingsWithApartmentB (line 191) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingTwoBuildingsWithNonExistingBuilding (line 199) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingTwoBuildingsWithAA (line 207) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingTwoBuildingsWithAB (line 215) | @Test(timeout = TIMEOUT)
    method testFindShortestWalkingRouteWithBothNonExistingLocations (line 223) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testFindShortestWalkingRouteWithNonExistingStartingLocation (line 231) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testFindShortestWalkingRouteWithNonExistingEndingLocation (line 239) | @Test(timeout = TIMEOUT, expected = IllegalArgumentException.class)
    method testFindShortestWalkingRouteWithBothExistingLocations (line 247) | @Test(timeout = TIMEOUT)
    method testFindShortestWalkingRouteWithBothExistingLocationsReverseOrder (line 260) | @Test(timeout = TIMEOUT)
    method testGetSportsBuildings (line 273) | @Test(timeout = TIMEOUT)
    method testGetFullNameOfBuildingSportsBuildingsWithNBA (line 288) | @Test(timeout = TIMEOUT)
    method testGetAbbreviatedNameOfBuildingSportsBuildingsWithNBA (line 296) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingSportsBuildingsWithNBA (line 304) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingSportsBuildingsWithNFL (line 312) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingSportsBuildingsWithNHL (line 320) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingSportsBuildingsWithMLB (line 328) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingSportsBuildingsWithPGA (line 336) | @Test(timeout = TIMEOUT)
    method testGetLocationOfBuildingSportsBuildingsWithATP (line 344) | @Test(timeout = TIMEOUT)
    method testFindShortestWalkingRouteFromNBAToPGA (line 352) | @Test(timeout = TIMEOUT)
    method testFindShortestWalkingRouteFromPGAToNBA (line 362) | @Test(timeout = TIMEOUT)
    method testFindShortestWalkingRouteFromNBAToNHL (line 372) | @Test(timeout = TIMEOUT)
    method testFindShortestWalkingRouteFromMLBToNFL (line 387) | @Test(timeout = TIMEOUT)

FILE: HW/hw7/test/CoordinatesTest.java
  class CoordinatesTest (line 16) | public class CoordinatesTest {
    method setUp (line 21) | @Before
    method testGetX (line 26) | @Test(timeout = TIMEOUT)
    method testGetY (line 31) | @Test(timeout = TIMEOUT)
    method testEqualsWithNull (line 36) | @Test(timeout = TIMEOUT)
    method testEqualsWithNonCoordinatesObject (line 41) | @Test(timeout = TIMEOUT)
    method testEqualsWithSameCoordinates (line 46) | @Test(timeout = TIMEOUT)
    method testHashCode (line 51) | @Test(timeout = TIMEOUT)

FILE: HW/hw7/test/HW7TestDriver.java
  class HW7TestDriver (line 17) | public class HW7TestDriver {
    method HW7TestDriver (line 28) | public HW7TestDriver(File in, File out) {
    method runTests (line 33) | public void runTests() throws FileNotFoundException {

FILE: HW/hw7/test/ImplementationTests.java
  class ImplementationTests (line 16) | @RunWith(Suite.class)

FILE: HW/hw7/test/ScriptFileTests.java
  class ScriptFileTests (line 33) | @RunWith(LabelledParameterized.class)
    method accept (line 38) | public boolean accept(File file) {
    method calculateTestFiles (line 53) | public static void calculateTestFiles() {
    method getTestFiles (line 84) | @Parameters
    method getTestLabels (line 108) | @Labels
    method ScriptFileTests (line 120) | public ScriptFileTests(File testScriptFile) {
    method fileContents (line 130) | private String fileContents(File f) throws IOException {
    method runScriptFile (line 158) | private String runScriptFile() throws IOException {
    method fileWithSuffix (line 175) | private File fileWithSuffix(String newSuffix) {
    method checkAgainstExpectedOutput (line 187) | @Test(timeout=30000)

FILE: HW/hw7/test/SpecificationTests.java
  class SpecificationTests (line 18) | @RunWith(Suite.class)

FILE: HW/hw8/CampusPathsMain.java
  class CampusPathsMain (line 14) | public class CampusPathsMain {
    method main (line 23) | public static void main(String[] args) throws Exception {

FILE: HW/hw8/CampusRouteFindingGUI.java
  class CampusRouteFindingGUI (line 17) | public class CampusRouteFindingGUI {
    method CampusRouteFindingGUI (line 28) | public CampusRouteFindingGUI(CampusRouteFindingModel m) {

FILE: HW/hw8/CampusRouteFindingGUIController.java
  class CampusRouteFindingGUIController (line 21) | public class CampusRouteFindingGUIController extends JPanel {
    method CampusRouteFindingGUIController (line 55) | public CampusRouteFindingGUIController(CampusRouteFindingModel m, Camp...
    class UpdateActionListener (line 134) | private class UpdateActionListener implements ActionListener {
      method actionPerformed (line 140) | @Override

FILE: HW/hw8/CampusRouteFindingMapView.java
  class CampusRouteFindingMapView (line 25) | public class CampusRouteFindingMapView extends JComponent {
    method CampusRouteFindingMapView (line 60) | public CampusRouteFindingMapView(CampusRouteFindingModel m) {
    method getShortestWalkingRoute (line 96) | public Double getShortestWalkingRoute(String start, String end) {
    method reset (line 112) | public void reset() {
    method paintComponent (line 126) | @Override

FILE: Week 03/Section/Circle1.java
  class Circle1 (line 16) | public class Circle1 {

FILE: Week 03/Section/Circle2.java
  class Circle2 (line 16) | public class Circle2 {

FILE: Week 03/Section/Circle3.java
  class Circle3 (line 16) | public class Circle3 {

FILE: Week 03/Section/IntMapUncommented.java
  type IntMap (line 45) | public interface IntMap {
    method add (line 47) | public boolean add(int key, Object val);
    method get (line 49) | public Object get(int key);
    method contains (line 51) | public boolean contains(int key);
    method remove (line 53) | public Object remove(int key);

FILE: Week 03/Section/IntTreeMapCommented.java
  class IntTreeMap (line 17) | public class IntTreeMap {

FILE: Week 03/Section/IntTreeMapUncommented.java
  class IntTreeMap (line 8) | public class IntTreeMap implements IntMap {

FILE: Week 07/Section/generics/ArrayList.java
  class ArrayList (line 8) | public class ArrayList<E> implements List<E> {
    method ArrayList (line 17) | public ArrayList() {
    method ArrayList (line 24) | @SuppressWarnings("unchecked")
    method add (line 35) | public void add(E value) {
    method add (line 42) | public void add(int index, E value) {
    method clear (line 53) | public void clear() {
    method contains (line 58) | public boolean contains(E value) {
    method ensureCapacity (line 65) | public void ensureCapacity(int capacity) {
    method get (line 74) | public E get(int index) {
    method indexOf (line 81) | public int indexOf(E value) {
    method isEmpty (line 91) | public boolean isEmpty() {
    method remove (line 98) | public void remove(int index) {
    method set (line 109) | public void set(int index, E value) {
    method size (line 115) | public int size() {
    method toString (line 122) | public String toString() {
    method checkIndex (line 137) | private void checkIndex(int index, int min, int max) {

FILE: Week 07/Section/generics/GenericsTest.java
  class GenericsTest (line 6) | public class GenericsTest {
    method main (line 8) | public static void main(String[] args) {

FILE: Week 07/Section/generics/SetUtils.java
  class SetUtils (line 7) | public class SetUtils {
    method union (line 9) | public static <E> Set<E> union(Set<E> s1, Set<E> s2) {
    method intersectionCount (line 20) | public static int intersectionCount(Set<?> s1, Set<?> s2) {
    method addAll (line 34) | public static <E> void addAll(Set<E> source, Set<E> dest) {
    method unionBetter (line 41) | public static <E> Set<E> unionBetter(Set<? extends E> s1,
    method addAllBetter (line 50) | public static <E> void addAllBetter(Set<E> source, Set<? super E> dest) {

FILE: Week 07/Section/generics/TypeBreaker.java
  class TypeBreaker (line 7) | public class TypeBreaker {
    method main (line 9) | public static void main(String[] args) {
    method breakArrays (line 13) | public static void breakArrays() {
    method genericType (line 28) | public static void genericType() {

FILE: Week 09/Section/section9-src/WeatherReportSolution/src/Thermometer.java
  class Thermometer (line 11) | public class Thermometer extends JComponent {
    method Thermometer (line 26) | public Thermometer() {
    method setPercentFull (line 39) | public void setPercentFull(int percent) {
    method paintComponent (line 54) | @Override

FILE: Week 09/Section/section9-src/WeatherReportSolution/src/WeatherIcon.java
  class WeatherIcon (line 16) | public class WeatherIcon extends JComponent {
    method WeatherIcon (line 27) | public WeatherIcon() {
    method setState (line 37) | public void setState(WeatherReportModel.WeatherState state) {
    method paintComponent (line 50) | @Override

FILE: Week 09/Section/section9-src/WeatherReportSolution/src/WeatherPanel.java
  class WeatherPanel (line 10) | public class WeatherPanel extends JPanel {
    method WeatherPanel (line 22) | public WeatherPanel() {
    method displayCity (line 64) | public void displayCity(String city, WeatherReportModel model) {

FILE: Week 09/Section/section9-src/WeatherReportSolution/src/WeatherReportGUI.java
  class WeatherReportGUI (line 16) | public class WeatherReportGUI {
    method WeatherReportGUI (line 44) | public WeatherReportGUI(WeatherReportModel model, List<String> cities) {
    class UpdateActionListener (line 93) | class UpdateActionListener implements ActionListener {
      method actionPerformed (line 94) | @Override

FILE: Week 09/Section/section9-src/WeatherReportSolution/src/WeatherReportMain.java
  class WeatherReportMain (line 4) | public class WeatherReportMain {
    method main (line 10) | public static void main(String[] args) {

FILE: Week 09/Section/section9-src/WeatherReportSolution/src/WeatherReportModel.java
  class WeatherReportModel (line 10) | public class WeatherReportModel {
    type WeatherState (line 16) | public enum WeatherState {
      method toString (line 22) | public String toString() {
    method WeatherReportModel (line 40) | public WeatherReportModel() {
    method getTemperature (line 51) | public int getTemperature(String city) {
    method getState (line 63) | public WeatherState getState(String city) {
    method getTime (line 78) | public String getTime(String city) {

FILE: Week 09/Section/section9-src/WeatherReportStarter/src/Thermometer.java
  class Thermometer (line 11) | public class Thermometer extends JComponent {
    method Thermometer (line 26) | public Thermometer() {
    method setPercentFull (line 39) | public void setPercentFull(int percent) {
    method paintComponent (line 54) | @Override

FILE: Week 09/Section/section9-src/WeatherReportStarter/src/WeatherIcon.java
  class WeatherIcon (line 16) | public class WeatherIcon extends JComponent {
    method WeatherIcon (line 27) | public WeatherIcon() {
    method setState (line 37) | public void setState(WeatherReportModel.WeatherState state) {
    method paintComponent (line 50) | @Override

FILE: Week 09/Section/section9-src/WeatherReportStarter/src/WeatherPanel.java
  class WeatherPanel (line 9) | public class WeatherPanel extends JPanel {
    method WeatherPanel (line 21) | public WeatherPanel() {
    method displayCity (line 39) | public void displayCity(String city, WeatherReportModel model) {

FILE: Week 09/Section/section9-src/WeatherReportStarter/src/WeatherReportGUI.java
  class WeatherReportGUI (line 16) | public class WeatherReportGUI {
    method WeatherReportGUI (line 44) | public WeatherReportGUI(WeatherReportModel model, List<String> cities) {
    class UpdateActionListener (line 67) | class UpdateActionListener implements ActionListener {
      method actionPerformed (line 68) | @Override

FILE: Week 09/Section/section9-src/WeatherReportStarter/src/WeatherReportMain.java
  class WeatherReportMain (line 4) | public class WeatherReportMain {
    method main (line 10) | public static void main(String[] args) {

FILE: Week 09/Section/section9-src/WeatherReportStarter/src/WeatherReportModel.java
  class WeatherReportModel (line 10) | public class WeatherReportModel {
    type WeatherState (line 16) | public enum WeatherState {
      method toString (line 22) | public String toString() {
    method WeatherReportModel (line 40) | public WeatherReportModel() {
    method getTemperature (line 51) | public int getTemperature(String city) {
    method getState (line 63) | public WeatherState getState(String city) {
    method getTime (line 78) | public String getTime(String city) {

FILE: Week 09/lect23-graphics-code/Face.java
  class Face (line 5) | public class Face extends JPanel {
    method paintComponent (line 10) | public void paintComponent(Graphics g) {

FILE: Week 09/lect23-graphics-code/FaceMain.java
  class FaceMain (line 7) | public class FaceMain {
    method main (line 9) | public static void main(String[] args) {

FILE: Week 09/lect23-graphics-code/SimpleFrameMain.java
  class SimpleFrameMain (line 7) | public class SimpleFrameMain {
    method main (line 9) | public static void main(String[] args) {
  class SimpleFrame (line 16) | class SimpleFrame extends JFrame {
    method SimpleFrame (line 17) | public SimpleFrame(String title) {

FILE: Week 09/lect23-graphics-code/SimpleLayoutMain.java
  class SimpleLayoutMain (line 8) | public class SimpleLayoutMain {
    method main (line 11) | public static void main(String[] args) {

FILE: Week 09/lect23-graphics-code/SimplePaintMain.java
  class SimplePaintMain (line 7) | public class SimplePaintMain {
    method main (line 10) | public static void main(String[] args) {
  class SimplePainting (line 24) | class SimplePainting extends JPanel {
    method paintComponent (line 27) | public void paintComponent(Graphics g) {

FILE: Week 09/lect24-events-code/ButtonDemo1.java
  class ButtonDemo1 (line 10) | public class ButtonDemo1 {
    class MyButtonListener (line 13) | private static class MyButtonListener implements ActionListener {
      method MyButtonListener (line 18) | public MyButtonListener(String id) {
      method actionPerformed (line 27) | public void actionPerformed(ActionEvent e) {
    method main (line 34) | public static void main(String[] args) {

FILE: Week 09/lect24-events-code/ButtonDemo2.java
  class ButtonDemo2 (line 10) | public class ButtonDemo2 {
    method main (line 12) | public static void main(String[] args) {

FILE: Week 09/lect24-events-code/ballsim/Ball.java
  class Ball (line 8) | public class Ball implements SimThing {
    method Ball (line 29) | public Ball(int x, int y, int dx, int dy,
    method action (line 46) | public void action() {
    method paintThing (line 61) | public void paintThing(Graphics g) {

FILE: Week 09/lect24-events-code/ballsim/BallGraphicsView.java
  class BallGraphicsView (line 13) | public class BallGraphicsView extends JPanel implements SimView {
    method BallGraphicsView (line 21) | public BallGraphicsView(SimModel model) {
    method notifyViewer (line 28) | public void notifyViewer() {
    method paintComponent (line 36) | public void paintComponent(Graphics g) {

FILE: Week 09/lect24-events-code/ballsim/BallSimControl.java
  class BallSimControl (line 13) | public class BallSimControl extends JPanel {
    method BallSimControl (line 25) | public BallSimControl(SimModel w) {
    method randomBall (line 81) | private Ball randomBall(int x, int y) {
    class SimButtonListener (line 98) | class SimButtonListener implements ActionListener {
      method actionPerformed (line 104) | public void actionPerformed(ActionEvent e) {

FILE: Week 09/lect24-events-code/ballsim/BallSimMain.java
  class BallSimMain (line 8) | public class BallSimMain {
    method main (line 16) | public static void main(String[] args) {

FILE: Week 09/lect24-events-code/ballsim/SimModel.java
  class SimModel (line 34) | public class SimModel {
    method SimModel (line 60) | public SimModel(int width, int height) {
    method add (line 79) | public void add(SimThing t) {
    method addView (line 88) | public void addView(SimView v) {
    method getThings (line 97) | public List<SimThing> getThings() {
    method getWidth (line 105) | public int getWidth() {
    method getHeight (line 113) | public int getHeight() {
    method go (line 121) | public void go(int nCycles) {
    method go (line 129) | public void go() {
    method pause (line 136) | public void pause() {
    method resume (line 143) | public void resume() {
    method stop (line 150) | public void stop() {
    method runSim (line 158) | private void runSim() {
    method cycle (line 172) | private void cycle() {

FILE: Week 09/lect24-events-code/ballsim/SimThing.java
  type SimThing (line 9) | public interface SimThing {
    method action (line 13) | public void action( );
    method paintThing (line 19) | public void paintThing(Graphics g);

FILE: Week 09/lect24-events-code/ballsim/SimView.java
  type SimView (line 8) | public interface SimView {
    method notifyViewer (line 12) | public void notifyViewer();
Condensed preview — 345 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (7,759K chars).
[
  {
    "path": "HW/hw0/Adder.java",
    "chars": 787,
    "preview": "package hw0;\n\nimport java.util.Scanner;\n\n/**\n * Adder asks the user for two ints and computes their sum.\n * \n * This is "
  },
  {
    "path": "HW/hw0/Ball.java",
    "chars": 681,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0;\n\n/**\n * This is a simp"
  },
  {
    "path": "HW/hw0/BallContainer.java",
    "chars": 4219,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0;\n\nimport java.lang.Iter"
  },
  {
    "path": "HW/hw0/Box.java",
    "chars": 4867,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0;\n\nimport java.lang.Iter"
  },
  {
    "path": "HW/hw0/Fibonacci.java",
    "chars": 975,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0;\n\n/**\n * Fibonacci calc"
  },
  {
    "path": "HW/hw0/HelloWorld.java",
    "chars": 789,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0;\n\n/**\n * HelloWorld is "
  },
  {
    "path": "HW/hw0/HolaWorld.java",
    "chars": 951,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0;\n\n/**\n * HolaWorld is l"
  },
  {
    "path": "HW/hw0/RandomHello.java",
    "chars": 910,
    "preview": "package hw0;\n/** \n * Import the class Random.\n */\nimport java.util.Random;\n\n/**\n * RandomHello selects a random greeting"
  },
  {
    "path": "HW/hw0/answers/problem6.txt",
    "chars": 562,
    "preview": "Chun-Wei Chen\nCSE 331\n04/01/13\n\n1. Input 0 to getFibTerm method is expected to return 1, but it throws exception. I chan"
  },
  {
    "path": "HW/hw0/answers/problem7.txt",
    "chars": 2000,
    "preview": "Chun-Wei Chen\nCSE 331\n04/02/13\n\na. In the constructor, it assign the formal parameter (volume) to the formal parameter i"
  },
  {
    "path": "HW/hw0/build.xml",
    "chars": 597,
    "preview": "<!--Minimal ant build file that needs to be created per pset.  You\n mostly just have to use this as an example, and modi"
  },
  {
    "path": "HW/hw0/hw0-comments.txt",
    "chars": 5861,
    "preview": "====================================\nA note about efficiency\n====================================\n\nWhen we ask about dif"
  },
  {
    "path": "HW/hw0/optional/Card.java",
    "chars": 5053,
    "preview": "package hw0.optional;\n\n/**\n * Card is a class representing single playing card consisting of a value and a\n * suit (e.g."
  },
  {
    "path": "HW/hw0/optional/CardSuit.java",
    "chars": 472,
    "preview": "package hw0.optional;\n\n\n/**\n * Represents one of the four suits (Hearts, Spades, Diamonds, Clubs) that appear\n * on a pl"
  },
  {
    "path": "HW/hw0/optional/CardValue.java",
    "chars": 3267,
    "preview": "package hw0.optional;\n\n\n/**\n * Represents one of 13 values (2-10, Jack, Queen, King, Ace) that appear\n * on a playing ca"
  },
  {
    "path": "HW/hw0/optional/FinancialCalc.java",
    "chars": 641,
    "preview": "package hw0.optional;\n\npublic class FinancialCalc {\n\n    public static void main(String[] args) {\n        double princip"
  },
  {
    "path": "HW/hw0/optional/MyHand.java",
    "chars": 2213,
    "preview": "package hw0.optional;\n\nimport java.util.Collection;\nimport java.util.LinkedList;\n\npublic class MyHand {\n    LinkedList<C"
  },
  {
    "path": "HW/hw0/optional/Point.java",
    "chars": 190,
    "preview": "package hw0.optional;\n\nclass Point {\n\n    double x;\n    double y;\n\n\n    // Create a point from coordinates\n    Point(dou"
  },
  {
    "path": "HW/hw0/optional/Primes.java",
    "chars": 2954,
    "preview": "package hw0.optional;\n\npublic class Primes {\n\n    private static void findPrimes(int nValues) {\n        boolean isPrime "
  },
  {
    "path": "HW/hw0/optional/StringScrambler.java",
    "chars": 707,
    "preview": "package hw0.optional;\n\npublic class StringScrambler {\n\n    public String reverseWordOrder(String input) {\n\n        // PL"
  },
  {
    "path": "HW/hw0/required.properties",
    "chars": 143,
    "preview": "required.files = HolaWorld.java,RandomHello.java,Fibonacci.java,Ball.java,BallContainer.java,Box.java,answers/problem6.t"
  },
  {
    "path": "HW/hw0/test/BallContainerTest.java",
    "chars": 7403,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0.test;\nimport hw0.*;\n\nim"
  },
  {
    "path": "HW/hw0/test/BallTest.java",
    "chars": 818,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0.test;\nimport hw0.*;\n\nim"
  },
  {
    "path": "HW/hw0/test/BoxTest.java",
    "chars": 8614,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0.test;\nimport hw0.*;\n\nim"
  },
  {
    "path": "HW/hw0/test/FibonacciTest.java",
    "chars": 2573,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0.test;\nimport hw0.*;\n\nim"
  },
  {
    "path": "HW/hw0/test/HolaWorldTest.java",
    "chars": 1728,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0.test;\nimport static org"
  },
  {
    "path": "HW/hw0/test/ImplementationTests.java",
    "chars": 437,
    "preview": "package hw0.test;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.Suite"
  },
  {
    "path": "HW/hw0/test/RandomHelloTest.java",
    "chars": 1628,
    "preview": "/**\n * This is part of HW0: Environment Setup and Java Introduction for CSE 331.\n */\npackage hw0.test;\nimport hw0.Random"
  },
  {
    "path": "HW/hw0/test/SpecificationTests.java",
    "chars": 602,
    "preview": "package hw0.test;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.Suite"
  },
  {
    "path": "HW/hw2/hw2_answers.txt",
    "chars": 6744,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 2\n04/12/13\n\nProblem 1\n{pre: size > 0} \nk = 0; \nmax = items[0];\n{loop-inv: max = largest i"
  },
  {
    "path": "HW/hw2/hw3_problem0.txt",
    "chars": 5732,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 3 - Problem 0\n04/12/13\n\na. \nr = p - q: \n  set r = q by making a term-by-term copy of all "
  },
  {
    "path": "HW/hw3/CalculatorFrame.java",
    "chars": 32680,
    "preview": "package hw3;\n\nimport java.awt.*;\nimport java.awt.event.*;\n\nimport javax.swing.*;\nimport javax.swing.border.BevelBorder;\n"
  },
  {
    "path": "HW/hw3/HW3_comment_key.txt",
    "chars": 1609,
    "preview": "Written response:\n\n  CHECKREP - any changes in the rep invariant must be reflected by changes in the checkrep() method.\n"
  },
  {
    "path": "HW/hw3/PolyGraph.java",
    "chars": 9762,
    "preview": "package hw3;\n\nimport java.awt.*;\n\n/**\n * <b>PolyGraph</b> is part of the graphical calculator that utilizes all of\n * th"
  },
  {
    "path": "HW/hw3/RatNum.java",
    "chars": 12153,
    "preview": "package hw3;\n\n/** <b>RatNum</b> represents an <b>immutable</b> rational number.\n    It includes all of the elements in t"
  },
  {
    "path": "HW/hw3/RatPoly.java",
    "chars": 23639,
    "preview": "package hw3;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\n/**\n * <b>RatPoly</b"
  },
  {
    "path": "HW/hw3/RatPolyStack.java",
    "chars": 7430,
    "preview": "package hw3;\n\nimport java.util.Iterator;\nimport java.util.Stack;\n\n/**\n * <b>RatPolyStack</B> is a mutable finite sequenc"
  },
  {
    "path": "HW/hw3/RatTerm.java",
    "chars": 14333,
    "preview": "package hw3;\n\n/**\n * <b>RatTerm</b> is an immutable representation of a term in a single-variable\n * polynomial expressi"
  },
  {
    "path": "HW/hw3/answers/problem1.txt",
    "chars": 2185,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 3\n04/19/13\n\na. Explain what the return statement, which is creating a new RatNum \n   obje"
  },
  {
    "path": "HW/hw3/answers/problem2.txt",
    "chars": 1239,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 3\n04/19/13\n\na. I only included a call to checkRep at the end of constructor since there's"
  },
  {
    "path": "HW/hw3/answers/problem5.txt",
    "chars": 151,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 3\n04/19/13\n\nMy four favorite polynomial equations:\nx^3-1\n6*x^5+5*x^4+4*x^3+3*x^2+2*x+1\nx^"
  },
  {
    "path": "HW/hw3/answers/problem6.txt",
    "chars": 910,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 3\n04/19/13\n\na. No, they are different. The rep invariant generated by Daikon is \n   this."
  },
  {
    "path": "HW/hw3/build.xml",
    "chars": 3209,
    "preview": "<!--Minimal ant build file that needs to be created per hw.  You\n mostly just have to use this as an example, and modify"
  },
  {
    "path": "HW/hw3/daikon-RatNumSmallTest.inv.txt",
    "chars": 20355,
    "preview": "===========================================================================\ncom.sun.proxy.$Proxy4:::CLASS\ncom.sun.proxy."
  },
  {
    "path": "HW/hw3/daikon-RatNumTest.inv.txt",
    "chars": 21188,
    "preview": "===========================================================================\ncom.sun.proxy.$Proxy4:::CLASS\ncom.sun.proxy."
  },
  {
    "path": "HW/hw3/required.properties",
    "chars": 193,
    "preview": "required.files = answers/problem1.txt,RatTerm.java,answers/problem2.txt,RatPoly.java,RatPolyStack.java,answers/problem5."
  },
  {
    "path": "HW/hw3/test/ImplementationTests.java",
    "chars": 514,
    "preview": "package hw3.test;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.Suite"
  },
  {
    "path": "HW/hw3/test/RatNumSmallTest.java",
    "chars": 27143,
    "preview": "package hw3.test;\n\nimport hw3.*;\n\nimport org.junit.Test;\nimport org.junit.BeforeClass;\nimport static org.junit.Assert.*;"
  },
  {
    "path": "HW/hw3/test/RatNumTest.java",
    "chars": 34724,
    "preview": "package hw3.test;\n\nimport hw3.*;\n\nimport org.junit.Test;\nimport org.junit.BeforeClass;\nimport static org.junit.Assert.*;"
  },
  {
    "path": "HW/hw3/test/RatPolyStackTest.java",
    "chars": 11601,
    "preview": "package hw3.test;\n\nimport hw3.*;\n\nimport org.junit.Test;\nimport org.junit.BeforeClass;\nimport static org.junit.Assert.*;"
  },
  {
    "path": "HW/hw3/test/RatPolyTest.java",
    "chars": 38066,
    "preview": "package hw3.test;\n\nimport hw3.*;\nimport org.junit.BeforeClass;\nimport static org.junit.Assert.assertEquals;\nimport stati"
  },
  {
    "path": "HW/hw3/test/RatTermTest.java",
    "chars": 25821,
    "preview": "package hw3.test;\n\nimport hw3.*;\nimport org.junit.Test;\nimport org.junit.BeforeClass;\nimport static org.junit.Assert.*;\n"
  },
  {
    "path": "HW/hw3/test/SpecificationTests.java",
    "chars": 634,
    "preview": "package hw3.test;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.Suite"
  },
  {
    "path": "HW/hw4/DGraph.java",
    "chars": 9644,
    "preview": "package hw4;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nim"
  },
  {
    "path": "HW/hw4/LabeledEdge.java",
    "chars": 3466,
    "preview": " package hw4;\n\n/**\n * <b>LabeledEdge</b> represents an outgoing edge with label of a node and \n * the destination of the"
  },
  {
    "path": "HW/hw4/answers/problem1.txt",
    "chars": 1924,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 4 - Problem 1\n05/05/13\n\na.\nIntQueue1:\nRep invariant:\nentries != null and entries has no n"
  },
  {
    "path": "HW/hw4/answers/problem2.txt",
    "chars": 528,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 4 - Problem 2\n05/07/13\n\naddNode and addEdge are needed in order to build the graph. conta"
  },
  {
    "path": "HW/hw4/answers/problem3.txt",
    "chars": 735,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 4 - Problem 3\n05/07/13\n\nI used \"0, 1, 2\" case analysis mentioned in hints section \nto com"
  },
  {
    "path": "HW/hw4/answers/problem4.txt",
    "chars": 663,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 4 - Problem 4\n05/07/13\n\nThe advantages of using collection of edges is O(1) time complexi"
  },
  {
    "path": "HW/hw4/build.xml",
    "chars": 1124,
    "preview": "<!--Minimal ant build file that needs to be created per pset.  You\n mostly just have to use this as an example, and modi"
  },
  {
    "path": "HW/hw4/hw4-grading-key.txt",
    "chars": 8090,
    "preview": "HOMEWORK 4 GRADING KEY\n\nProblem 1 - Written Exercises\n#1A (IntQueue1)\n\n    1-AF-O: Not describing ordering of input with"
  },
  {
    "path": "HW/hw4/nullness/NullnessExample.java",
    "chars": 1173,
    "preview": "package hw4.nullness;\n\nimport java.util.*;\n\n/**\n * This class illustrates use of nullness type annotations.\n * The class"
  },
  {
    "path": "HW/hw4/nullness/NullnessExampleWithWarnings.java",
    "chars": 1140,
    "preview": "package hw4.nullness;\n\nimport java.util.*;\n\n/**\n * This class illustrates use of nullness type annotations.\n * The class"
  },
  {
    "path": "HW/hw4/problem1/IntQueue1.java",
    "chars": 2582,
    "preview": "package hw4.problem1;\n\nimport java.util.LinkedList;\nimport java.util.List;\n\n/**\n * IntQueue1 is our first implementation"
  },
  {
    "path": "HW/hw4/problem1/IntQueue2.java",
    "chars": 3504,
    "preview": "package hw4.problem1;\n\n\n/**\n * IntQueue2 is our second implementation of a basic first-in, first-out queue\n * for Intege"
  },
  {
    "path": "HW/hw4/required.properties",
    "chars": 258,
    "preview": "required.files = answers/problem1.txt,answers/problem2.txt,answers/problem3.txt,answers/problem4.txt,answers/reflection."
  },
  {
    "path": "HW/hw4/test/DGraphTest.java",
    "chars": 15724,
    "preview": "package hw4.test;\n\nimport java.util.HashSet;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedHashSet;\nimport java"
  },
  {
    "path": "HW/hw4/test/HW4TestDriver.java",
    "chars": 8162,
    "preview": "package hw4.test;\n\nimport java.io.*;\nimport java.util.*;\n\nimport hw4.*;\n\n\n/**\n * This class implements a testing driver "
  },
  {
    "path": "HW/hw4/test/ImplementationTests.java",
    "chars": 536,
    "preview": "package hw4.test;\n\nimport org.junit.*;\nimport org.junit.runner.*;\nimport org.junit.runners.*;\nimport org.junit.runners.S"
  },
  {
    "path": "HW/hw4/test/LabeledEdgeTest.java",
    "chars": 2684,
    "preview": "package hw4.test;\n\nimport hw4.*;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse"
  },
  {
    "path": "HW/hw4/test/ScriptFileTests.java",
    "chars": 6704,
    "preview": "package hw4.test;\n\nimport static org.junit.Assert.assertEquals;\n\nimport java.io.*;\nimport java.net.URISyntaxException;\ni"
  },
  {
    "path": "HW/hw4/test/SpecificationTests.java",
    "chars": 784,
    "preview": "package hw4.test;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.Suite"
  },
  {
    "path": "HW/hw4/test/emptyGraph.expected",
    "chars": 134,
    "preview": "# Tests that a graph can be created.\n\n# Create a graph\ncreated graph empty_graph\n\n# Print the nodes in the graph\nempty_g"
  },
  {
    "path": "HW/hw4/test/emptyGraph.test",
    "chars": 132,
    "preview": "# Tests that a graph can be created.\n\n# Create a graph\nCreateGraph empty_graph\n\n# Print the nodes in the graph\nListNodes"
  },
  {
    "path": "HW/hw4/test/exampleTestVariousCases1.expected",
    "chars": 824,
    "preview": "# Sample testing file.\n# Tests that a graph can be created, a pair of nodes and\n# an edge between them can be added, and"
  },
  {
    "path": "HW/hw4/test/exampleTestVariousCases1.test",
    "chars": 772,
    "preview": "# Sample testing file.\n# Tests that a graph can be created, a pair of nodes and\n# an edge between them can be added, and"
  },
  {
    "path": "HW/hw4/test/oneNodeGraph.expected",
    "chars": 265,
    "preview": "# Tests if a node can be added to the graph\n\n# Create a graph\ncreated graph one_node_graph\n\n# Add a node\nadded node a to"
  },
  {
    "path": "HW/hw4/test/oneNodeGraph.test",
    "chars": 244,
    "preview": "# Tests if a node can be added to the graph\n\n# Create a graph\nCreateGraph one_node_graph\n\n# Add a node\nAddNode one_node_"
  },
  {
    "path": "HW/hw4/test/oneNodeReflexiveEdgeGraph.expected",
    "chars": 380,
    "preview": "# Tests adding one node, reflexive edge to graph\n\n# Create a graph\ncreated graph one_node_one_edge_graph\n\n# Add a node\na"
  },
  {
    "path": "HW/hw4/test/oneNodeReflexiveEdgeGraph.test",
    "chars": 339,
    "preview": "# Tests adding one node, reflexive edge to graph\n\n# Create a graph\nCreateGraph one_node_one_edge_graph\n\n# Add a node\nAdd"
  },
  {
    "path": "HW/hw4/test/twoNodesCompleteGraph.expected",
    "chars": 756,
    "preview": "# Test adding two nodes, two reflexive edges \n# and two edges between two nodes.\n\n# Create a graph\ncreated graph two_nod"
  },
  {
    "path": "HW/hw4/test/twoNodesCompleteGraph.test",
    "chars": 636,
    "preview": "# Test adding two nodes, two reflexive edges \n# and two edges between two nodes.\n\n# Create a graph\nCreateGraph two_nodes"
  },
  {
    "path": "HW/hw4/test/twoNodesGraph.expected",
    "chars": 369,
    "preview": "# Tests adding two nodes to the graph\n\n# Create a graph\ncreated graph two_nodes_graph\n\n# Add two nodes\nadded node a to t"
  },
  {
    "path": "HW/hw4/test/twoNodesGraph.test",
    "chars": 329,
    "preview": "# Tests adding two nodes to the graph\n\n# Create a graph\nCreateGraph two_nodes_graph\n\n# Add two nodes\nAddNode two_nodes_g"
  },
  {
    "path": "HW/hw4/test/twoNodesGraphAlphabetical.expected",
    "chars": 558,
    "preview": "# Same as twoNodeGraph.test, but reverse the \n# order of node adding to test if it prints \n# out in alphabetical order\n\n"
  },
  {
    "path": "HW/hw4/test/twoNodesGraphAlphabetical.test",
    "chars": 518,
    "preview": "# Same as twoNodeGraph.test, but reverse the \n# order of node adding to test if it prints \n# out in alphabetical order\n\n"
  },
  {
    "path": "HW/hw4/test/twoNodesMultipleEdgesGraph.expected",
    "chars": 824,
    "preview": "# Tests adding two nodes, multiple edges to graph.\n\n# Create a graph\ncreated graph two_nodes_multiple_edges_graph\n\n# Add"
  },
  {
    "path": "HW/hw4/test/twoNodesMultipleEdgesGraph.test",
    "chars": 682,
    "preview": "# Tests adding two nodes, multiple edges to graph.\n\n# Create a graph\nCreateGraph two_nodes_multiple_edges_graph\n\n# Add t"
  },
  {
    "path": "HW/hw4/test/twoNodesMutipleEdgesGraphAlphabetical.expected",
    "chars": 1135,
    "preview": "# Same as twoNodesMultipleEdgesGraph.test, but \n# adding nodes in reverse order and adding edges \n# in non-alphabetical "
  },
  {
    "path": "HW/hw4/test/twoNodesMutipleEdgesGraphAlphabetical.test",
    "chars": 993,
    "preview": "# Same as twoNodesMultipleEdgesGraph.test, but \n# adding nodes in reverse order and adding edges \n# in non-alphabetical "
  },
  {
    "path": "HW/hw4/test/twoNodesTwoEdgesGraph1.expected",
    "chars": 658,
    "preview": "# Tests adding two nodes, one reflexive edge \n# and one edge between two nodes to graph.\n\n# Create a graph\ncreated graph"
  },
  {
    "path": "HW/hw4/test/twoNodesTwoEdgesGraph1.test",
    "chars": 578,
    "preview": "# Tests adding two nodes, one reflexive edge \n# and one edge between two nodes to graph.\n\n# Create a graph\nCreateGraph t"
  },
  {
    "path": "HW/hw4/test/twoNodesTwoEdgesGraph2.expected",
    "chars": 602,
    "preview": "# Tests adding two nodes, two edges between two nodes to graph.\n\n# Create a graph\ncreated graph two_nodes_two_edges_grap"
  },
  {
    "path": "HW/hw4/test/twoNodesTwoEdgesGraph2.test",
    "chars": 522,
    "preview": "# Tests adding two nodes, two edges between two nodes to graph.\n\n# Create a graph\nCreateGraph two_nodes_two_edges_graph2"
  },
  {
    "path": "HW/hw5/MarvelParser.java",
    "chars": 2830,
    "preview": "package hw5;\nimport java.io.*;\nimport java.util.*;\n\n/**\n * Parser utility to load the Marvel Comics dataset.\n */\npublic "
  },
  {
    "path": "HW/hw5/MarvelPaths.java",
    "chars": 7698,
    "preview": "package hw5;\n\nimport hw4.DGraph;\nimport hw4.LabeledEdge;\n\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimpor"
  },
  {
    "path": "HW/hw5/build.xml",
    "chars": 696,
    "preview": "<!--Minimal ant build file that needs to be created per pset.  You\n mostly just have to use this as an example, and modi"
  },
  {
    "path": "HW/hw5/changes.txt",
    "chars": 364,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 5\n05/13/13\n\nI changed my implementation of graph from TreeMap<String, TreeSet<LabeledEdge"
  },
  {
    "path": "HW/hw5/data/empty.tsv",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "HW/hw5/data/marvel.tsv",
    "chars": 2740044,
    "preview": "\"FROST, CARMILLA\"\t\"AA2 35\"\n\"KILLRAVEN/JONATHAN R\"\t\"AA2 35\"\n\"M'SHULLA\"\t\"AA2 35\"\n\"24-HOUR MAN/EMMANUEL\"\t\"AA2 35\"\n\"OLD SKUL"
  },
  {
    "path": "HW/hw5/data/oneNodeGraph.tsv",
    "chars": 13,
    "preview": "onlyNode\tedge"
  },
  {
    "path": "HW/hw5/data/sports.tsv",
    "chars": 81,
    "preview": "Jeff\tNBA\nJeff\tMLB\nJeff\tNHL\nJeff\tNFL\nHoward\tNFL\nHoward\tNHL\nMichael\tNBA\nMichael\tMLB"
  },
  {
    "path": "HW/hw5/data/staffSuperheroes.tsv",
    "chars": 235,
    "preview": "Ernst-the-Bicycling-Wizard\tCSE331\nErnst-the-Bicycling-Wizard\tCSE403\nNotkin-of-the-Superhuman-Beard\tCSE331\nNotkin-of-the-"
  },
  {
    "path": "HW/hw5/data/threeNodesWithReflexiveEdge.tsv",
    "chars": 24,
    "preview": "a\tAB\nb\tAB\nb\tBB\nb\tBC\nc\tBC"
  },
  {
    "path": "HW/hw5/data/twoNodesGraph.tsv",
    "chars": 23,
    "preview": "node1\tedge1\nnode2\tedge2"
  },
  {
    "path": "HW/hw5/data/zoos.tsv",
    "chars": 97,
    "preview": "Monkey\tZoo1\nTiger\tZoo1\nKoala\tZoo1\nPenguin\tZoo2\nElephant\tZoo2\nMonkey\tZoo2\nElephant\tZoo3\nKoala\tZoo3"
  },
  {
    "path": "HW/hw5/hw5-comment-key.txt",
    "chars": 2821,
    "preview": "----- Test Quality ------\n\nTest Coverage: Does not cover an adequate domain of inputs, including common cases for the pa"
  },
  {
    "path": "HW/hw5/required.properties",
    "chars": 229,
    "preview": "required.files = MarvelParser.java,MarvelPaths.java,answers/changes.txt,answers/reflection.txt,answers/collaboration.txt"
  },
  {
    "path": "HW/hw5/test/HW5TestDriver.java",
    "chars": 10645,
    "preview": "package hw5.test;\n\nimport java.io.*;\nimport java.net.URISyntaxException;\nimport java.util.*;\n\nimport hw4.*;\nimport hw5.*"
  },
  {
    "path": "HW/hw5/test/ImplementationTests.java",
    "chars": 518,
    "preview": "package hw5.test;\n\nimport org.junit.*;\nimport org.junit.runner.*;\nimport org.junit.runners.*;\nimport org.junit.runners.S"
  },
  {
    "path": "HW/hw5/test/ScriptFileTests.java",
    "chars": 6749,
    "preview": "package hw5.test;\n\nimport static org.junit.Assert.assertEquals;\n\nimport java.io.*;\nimport java.net.URISyntaxException;\ni"
  },
  {
    "path": "HW/hw5/test/SpecificationTests.java",
    "chars": 784,
    "preview": "package hw5.test;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.Suite"
  },
  {
    "path": "HW/hw5/test/TestMarvelPaths.java",
    "chars": 1297,
    "preview": "package hw5.test;\n\nimport org.junit.*;\nimport hw4.DGraph;\nimport hw5.MarvelPaths;\n\nimport org.junit.Before;\nimport org.j"
  },
  {
    "path": "HW/hw5/test/exampleTestMarvelOneHop.expected",
    "chars": 565,
    "preview": "# Find a path with only one \"hop\" (edge) using the full Marvel dataset.\n# This test exercises both the parser and BFS al"
  },
  {
    "path": "HW/hw5/test/exampleTestMarvelOneHop.test",
    "chars": 525,
    "preview": "# Find a path with only one \"hop\" (edge) using the full Marvel dataset.\n# This test exercises both the parser and BFS al"
  },
  {
    "path": "HW/hw5/test/exampleTestParserSmallishGraph.expected",
    "chars": 283,
    "preview": "# Test the parser on a graph that contains several nodes\n# with two edges each.\n\nloaded graph heroes\nthe children of Ern"
  },
  {
    "path": "HW/hw5/test/exampleTestParserSmallishGraph.test",
    "chars": 165,
    "preview": "# Test the parser on a graph that contains several nodes\n# with two edges each.\n\nLoadGraph heroes staffSuperheroes.tsv\nL"
  },
  {
    "path": "HW/hw5/test/exampleTestSimpleBFSTwoHops.expected",
    "chars": 779,
    "preview": "# Simple test of breadth-first search algorithm.\n# Verifies that it can find a path with two \"hops\" (edges) when there a"
  },
  {
    "path": "HW/hw5/test/exampleTestSimpleBFSTwoHops.test",
    "chars": 672,
    "preview": "# Simple test of breadth-first search algorithm.\n# Verifies that it can find a path with two \"hops\" (edges) when there a"
  },
  {
    "path": "HW/hw5/test/testAddingReflexiveEdge.expected",
    "chars": 542,
    "preview": "# Test MarvelPaths doesn't allow adding reflexive edge\n\n# Parse through the data and build the graph\nloaded graph three_"
  },
  {
    "path": "HW/hw5/test/testAddingReflexiveEdge.test",
    "chars": 478,
    "preview": "# Test MarvelPaths doesn't allow adding reflexive edge\n\n# Parse through the data and build the graph\nLoadGraph three_nod"
  },
  {
    "path": "HW/hw5/test/testFindPathSportsGraph.expected",
    "chars": 322,
    "preview": "# Test BFS on sports graph\n\n# build the graph\nloaded graph sports\n\n# test BFS order\n# find the shortest path Howard to M"
  },
  {
    "path": "HW/hw5/test/testFindPathSportsGraph.test",
    "chars": 240,
    "preview": "# Test BFS on sports graph\n\n# build the graph\nLoadGraph sports sports.tsv\n\n# test BFS order\n# find the shortest path How"
  },
  {
    "path": "HW/hw5/test/testFindPathZooGraph.expected",
    "chars": 506,
    "preview": "# Test BFS on zoo graph\n\n# Parse through the data and build the graph\nloaded graph zoos\n\n# Find the shortest path Elepha"
  },
  {
    "path": "HW/hw5/test/testFindPathZooGraph.test",
    "chars": 383,
    "preview": "# Test BFS on zoo graph\n\n# Parse through the data and build the graph\nLoadGraph zoos zoos.tsv\n\n# Find the shortest path "
  },
  {
    "path": "HW/hw5/test/testParserAndBFSEmptyGraph.expected",
    "chars": 127,
    "preview": "# Test the parser and BFS on empty file\n\nloaded graph empty\n\nempty contains:\n\nunknown character node a\nunknown character"
  },
  {
    "path": "HW/hw5/test/testParserAndBFSEmptyGraph.test",
    "chars": 113,
    "preview": "# Test the parser and BFS on empty file\n\nLoadGraph empty empty.tsv\n\nListNodes empty\n\nFindPath empty node_a node_b"
  },
  {
    "path": "HW/hw5/test/testParserAndBFSOneNodeGraph.expected",
    "chars": 285,
    "preview": "# test parser and BFS on one node graph\n\n# build graph\nloaded graph oneNodeGraph\n\n# check graph is built correctly\noneNo"
  },
  {
    "path": "HW/hw5/test/testParserAndBFSOneNodeGraph.test",
    "chars": 313,
    "preview": "# test parser and BFS on one node graph\n\n# build graph\nLoadGraph oneNodeGraph oneNodeGraph.tsv\n\n# check graph is built c"
  },
  {
    "path": "HW/hw5/test/testParserAndBFSTwoNodesGraph.expected",
    "chars": 293,
    "preview": "# test parser and BFS on two nodes graph\n\n# build graph\nloaded graph twoNodesGraph\n\n# check graph is built correctly\ntwo"
  },
  {
    "path": "HW/hw5/test/testParserAndBFSTwoNodesGraph.test",
    "chars": 269,
    "preview": "# test parser and BFS on two nodes graph\n\n# build graph\nLoadGraph twoNodesGraph twoNodesGraph.tsv\n\n# check graph is buil"
  },
  {
    "path": "HW/hw5/test/testParserSportsGraph.expected",
    "chars": 446,
    "preview": "# Test the parser on sports data to see \n# if the graph is built correctly\n\n# Parse through the data and build the graph"
  },
  {
    "path": "HW/hw5/test/testParserSportsGraph.test",
    "chars": 311,
    "preview": "# Test the parser on sports data to see \n# if the graph is built correctly\n\n# Parse through the data and build the graph"
  },
  {
    "path": "HW/hw5/test/testParserZooGraph.expected",
    "chars": 620,
    "preview": "# Test the parser on zoos' data to see \n# if the graph is built correctly\n\n# Parse through the data and build the graph\n"
  },
  {
    "path": "HW/hw5/test/testParserZooGraph.test",
    "chars": 350,
    "preview": "# Test the parser on zoos' data to see \n# if the graph is built correctly\n\n# Parse through the data and build the graph\n"
  },
  {
    "path": "HW/hw6/MarvelParser2.java",
    "chars": 3893,
    "preview": "package hw6;\nimport java.io.*;\nimport java.util.*;\n\n/**\n * Parser utility to load the Marvel Comics dataset.\n * \n * @aut"
  },
  {
    "path": "HW/hw6/MarvelPaths2.java",
    "chars": 8103,
    "preview": "package hw6;\n\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nim"
  },
  {
    "path": "HW/hw6/build.xml",
    "chars": 710,
    "preview": "<!--Minimal ant build file that needs to be created per pset.  You\n mostly just have to use this as an example, and modi"
  },
  {
    "path": "HW/hw6/data/empty.tsv",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "HW/hw6/data/marvel.tsv",
    "chars": 2740044,
    "preview": "\"FROST, CARMILLA\"\t\"AA2 35\"\n\"KILLRAVEN/JONATHAN R\"\t\"AA2 35\"\n\"M'SHULLA\"\t\"AA2 35\"\n\"24-HOUR MAN/EMMANUEL\"\t\"AA2 35\"\n\"OLD SKUL"
  },
  {
    "path": "HW/hw6/data/oneNodeGraph.tsv",
    "chars": 13,
    "preview": "onlyNode\tedge"
  },
  {
    "path": "HW/hw6/data/sports.tsv",
    "chars": 153,
    "preview": "Michael\tNBA\nJeff\tNBA\nMichael\tWWE\nHoward\tWWE\nMichael\tNFL\nJeff\tNFL\nMichael\tTennis\nJeff\tTennis\nJeff\tGolf\nHoward\tGolf\nJeff\tN"
  },
  {
    "path": "HW/hw6/data/threeNodesTwoEdgesGraph.tsv",
    "chars": 35,
    "preview": "node1\tedge1\nnode2\tedge1\nnode3\tedge2"
  },
  {
    "path": "HW/hw6/required.properties",
    "chars": 192,
    "preview": "required.files = MarvelPaths2.java,answers/reflection.txt,answers/collaboration.txt,test/ImplementationTests.java,test/S"
  },
  {
    "path": "HW/hw6/test/HW6TestDriver.java",
    "chars": 10554,
    "preview": "package hw6.test;\n\nimport java.io.*;\nimport java.net.URISyntaxException;\nimport java.util.*;\n\nimport hw4.*;\nimport hw5.*"
  },
  {
    "path": "HW/hw6/test/ImplementationTests.java",
    "chars": 520,
    "preview": "package hw6.test;\n\nimport org.junit.*;\nimport org.junit.runner.*;\nimport org.junit.runners.*;\nimport org.junit.runners.S"
  },
  {
    "path": "HW/hw6/test/ScriptFileTests.java",
    "chars": 7210,
    "preview": "package hw6.test;\n\nimport static org.junit.Assert.assertEquals;\n\nimport java.io.*;\nimport java.net.URISyntaxException;\ni"
  },
  {
    "path": "HW/hw6/test/SpecificationTests.java",
    "chars": 784,
    "preview": "package hw6.test;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.Suite"
  },
  {
    "path": "HW/hw6/test/TestMarvelPaths2.java",
    "chars": 1440,
    "preview": "package hw6.test;\n\nimport static org.junit.Assert.*;\nimport hw4.DGraph;\nimport hw6.MarvelPaths2;\n\nimport org.junit.Befor"
  },
  {
    "path": "HW/hw6/test/emptyGraph.expected",
    "chars": 123,
    "preview": "# Tests build emptyrGraph.\n\n# Load empty.tsv\nloaded graph empty_graph\n\n# Print the nodes in the graph\nempty_graph contai"
  },
  {
    "path": "HW/hw6/test/emptyGraph.test",
    "chars": 130,
    "preview": "# Tests build emptyrGraph.\n\n# Load empty.tsv\nLoadGraph empty_graph empty.tsv\n\n# Print the nodes in the graph\nListNodes e"
  },
  {
    "path": "HW/hw6/test/emptyGraphFindPath.expected",
    "chars": 165,
    "preview": "# Tests find path on empty graph.\n\n# Create a graph\ncreated graph empty_graph\n\n# Find minimum-cost path on non-existing "
  },
  {
    "path": "HW/hw6/test/emptyGraphFindPath.test",
    "chars": 148,
    "preview": "# Tests find path on empty graph.\n\n# Create a graph\nCreateGraph empty_graph\n\n# Find minimum-cost path on non-existing no"
  },
  {
    "path": "HW/hw6/test/exampleFindOnlyPossiblePath.expected",
    "chars": 440,
    "preview": "# Find a path with Dijkstra's algorithm when there is only one possible path\n\ncreated graph characters\nadded node GORILL"
  },
  {
    "path": "HW/hw6/test/exampleFindOnlyPossiblePath.test",
    "chars": 301,
    "preview": "# Find a path with Dijkstra's algorithm when there is only one possible path\n\nCreateGraph characters\nAddNode characters "
  },
  {
    "path": "HW/hw6/test/exampleMarvelBasicSearch.expected",
    "chars": 387,
    "preview": "# Load the Marvel dataset and search for an existing path.\n# To run this test, you will need to have downloaded the marv"
  },
  {
    "path": "HW/hw6/test/exampleMarvelBasicSearch.test",
    "chars": 247,
    "preview": "# Load the Marvel dataset and search for an existing path.\n# To run this test, you will need to have downloaded the marv"
  },
  {
    "path": "HW/hw6/test/oneNodeGraph.expected",
    "chars": 231,
    "preview": "# Tests build oneNodeGraph.\n\n# Load oneNodeGraph.tsv\nloaded graph one_node_graph\n\n# Print the nodes in the graph and the"
  },
  {
    "path": "HW/hw6/test/oneNodeGraph.test",
    "chars": 225,
    "preview": "# Tests build oneNodeGraph.\n\n# Load oneNodeGraph.tsv\nLoadGraph one_node_graph oneNodeGraph.tsv\n\n# Print the nodes in the"
  },
  {
    "path": "HW/hw6/test/oneNodeGraphFindPathOnNonExistingNode.expected",
    "chars": 177,
    "preview": "# Tests find path on one_node_graph\n\n# Load oneNodeGraph.tsv\nloaded graph one_node_graph\n\n# Find minimum-cost path with "
  },
  {
    "path": "HW/hw6/test/oneNodeGraphFindPathOnNonExistingNode.test",
    "chars": 222,
    "preview": "# Tests find path on one_node_graph\n\n# Load oneNodeGraph.tsv\nLoadGraph one_node_graph oneNodeGraph.tsv\n\n# Find minimum-c"
  },
  {
    "path": "HW/hw6/test/oneNodeGraphFindPathOnOnlyNode.expected",
    "chars": 176,
    "preview": "# Tests find path on one_node_graph\n\n# Load oneNodeGraph.tsv\nloaded graph one_node_graph\n\n# Find minimum-cost path on on"
  },
  {
    "path": "HW/hw6/test/oneNodeGraphFindPathOnOnlyNode.test",
    "chars": 182,
    "preview": "# Tests find path on one_node_graph\n\n# Load oneNodeGraph.tsv\nLoadGraph one_node_graph oneNodeGraph.tsv\n\n# Find minimum-c"
  },
  {
    "path": "HW/hw6/test/sportsGraphFindPath.expected",
    "chars": 249,
    "preview": "# Tests find minimum-cost path on sports graph.\n\n# Load sports.tsv\nloaded graph sports\n\n# Test find minimum-cost path no"
  },
  {
    "path": "HW/hw6/test/sportsGraphFindPath.test",
    "chars": 174,
    "preview": "# Tests find minimum-cost path on sports graph.\n\n# Load sports.tsv\nLoadGraph sports sports.tsv\n\n# Test find minimum-cost"
  },
  {
    "path": "HW/hw6/test/threeNodesTwoEdgesGraph.expected",
    "chars": 405,
    "preview": "# Tests build threeNodesTwoEdgesGraph\n\n# Load threeNodesTwoEdgesGraph.tsv\nloaded graph three_nodes_two_edges_graph\n\n# Ch"
  },
  {
    "path": "HW/hw6/test/threeNodesTwoEdgesGraph.test",
    "chars": 353,
    "preview": "# Tests build threeNodesTwoEdgesGraph\n\n# Load threeNodesTwoEdgesGraph.tsv\nLoadGraph three_nodes_two_edges_graph threeNod"
  },
  {
    "path": "HW/hw6/test/threeNodesTwoEdgesGraphFindExistingPath.expected",
    "chars": 350,
    "preview": "# Tests find path on three_nodes_two_edges_graph.\n\n# Load threeNodesTwoEdgesGraph.tsv\nloaded graph three_nodes_two_edges"
  },
  {
    "path": "HW/hw6/test/threeNodesTwoEdgesGraphFindExistingPath.test",
    "chars": 319,
    "preview": "# Tests find path on three_nodes_two_edges_graph.\n\n# Load threeNodesTwoEdgesGraph.tsv\nLoadGraph three_nodes_two_edges_gr"
  },
  {
    "path": "HW/hw6/test/threeNodesTwoEdgesGraphFindNonExistingPath.expected",
    "chars": 212,
    "preview": "# Tests find path on three_nodes_two_edges_graph.\n\n# Load threeNodesTwoEdgesGraph.tsv\nloaded graph three_nodes_two_edges"
  },
  {
    "path": "HW/hw6/test/threeNodesTwoEdgesGraphFindNonExistingPath.test",
    "chars": 246,
    "preview": "# Tests find path on three_nodes_two_edges_graph.\n\n# Load threeNodesTwoEdgesGraph.tsv\nLoadGraph three_nodes_two_edges_gr"
  },
  {
    "path": "HW/hw6/test/twoNodesTwoEdgesGraphFindPath.expected",
    "chars": 393,
    "preview": "# Tests find minimum-cost path if two paths exist.\n\ncreated graph two_nodes_two_edges_graph\nadded node node1 to two_node"
  },
  {
    "path": "HW/hw6/test/twoNodesTwoEdgesGraphFindPath.test",
    "chars": 317,
    "preview": "# Tests find minimum-cost path if two paths exist.\n\nCreateGraph two_nodes_two_edges_graph\nAddNode two_nodes_two_edges_gr"
  },
  {
    "path": "HW/hw7/CampusDataParser.java",
    "chars": 6589,
    "preview": "package hw7;\n\nimport hw4.DGraph;\n\nimport java.io.*;\nimport java.util.*;\n\n/**\n * Parser utility to load the campus buildi"
  },
  {
    "path": "HW/hw7/CampusRouteFindingModel.java",
    "chars": 8707,
    "preview": "package hw7;\n\nimport hw4.DGraph;\nimport hw4.LabeledEdge;\nimport hw6.MarvelPaths2;\n\nimport java.util.HashMap;\nimport java"
  },
  {
    "path": "HW/hw7/CampusRouteFindingTool.java",
    "chars": 7668,
    "preview": "package hw7;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Scanner;\nimport "
  },
  {
    "path": "HW/hw7/Coordinates.java",
    "chars": 1925,
    "preview": "package hw7;\n\n/**\n * This class represents coordinates of a point.\n * \n * @specfield x_coordinate : double\n * @specfield"
  },
  {
    "path": "HW/hw7/build.xml",
    "chars": 672,
    "preview": "<!--Minimal ant build file that needs to be created per pset.  You\n mostly just have to use this as an example, and modi"
  },
  {
    "path": "HW/hw7/mvc.txt",
    "chars": 519,
    "preview": "Chun-Wei Chen\nCSE 331\nHomework 7\n05/28/13\n\nmodel: CampusDataParser, CampusRouteFindingModel, Coordinates\nview: every sta"
  },
  {
    "path": "HW/hw7/required.properties",
    "chars": 190,
    "preview": "required.files = answers/mvc.txt,answers/reflection.txt,answers/collaboration.txt,test/ImplementationTests.java,test/Spe"
  },
  {
    "path": "HW/hw7/sample_output.txt",
    "chars": 4846,
    "preview": "Menu:\n\tr to find a route\n\tb to see a list of all buildings\n\tq to quit\n\nEnter an option ('m' to see the menu): r\nAbbrevia"
  },
  {
    "path": "HW/hw7/test/CampusDataParserTest.java",
    "chars": 6126,
    "preview": "package hw7.test;\n\nimport static org.junit.Assert.*;\n\nimport hw4.DGraph;\nimport hw7.CampusDataParser;\nimport hw7.Coordin"
  },
  {
    "path": "HW/hw7/test/CampusRouteFindingModelTest.java",
    "chars": 15938,
    "preview": "package hw7.test;\n\nimport static org.junit.Assert.*;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java."
  },
  {
    "path": "HW/hw7/test/CoordinatesTest.java",
    "chars": 1263,
    "preview": "package hw7.test;\n\nimport static org.junit.Assert.*;\nimport hw7.Coordinates;\n\nimport org.junit.Before;\nimport org.junit."
  },
  {
    "path": "HW/hw7/test/HW7TestDriver.java",
    "chars": 1716,
    "preview": "package hw7.test;\n\nimport hw7.CampusRouteFindingTool;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java."
  },
  {
    "path": "HW/hw7/test/ImplementationTests.java",
    "chars": 582,
    "preview": "package hw7.test;\n\nimport org.junit.*;\nimport org.junit.runner.*;\nimport org.junit.runners.*;\nimport org.junit.runners.S"
  },
  {
    "path": "HW/hw7/test/ScriptFileTests.java",
    "chars": 7099,
    "preview": "package hw7.test;\n\nimport static org.junit.Assert.assertEquals;\n\nimport java.io.BufferedReader;\nimport java.io.File;\nimp"
  },
  {
    "path": "HW/hw7/test/SpecificationTests.java",
    "chars": 775,
    "preview": "package hw7.test;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.Suite"
  },
  {
    "path": "HW/hw7/test/campusBuildings.expected",
    "chars": 2177,
    "preview": "Menu:\n\tr to find a route\n\tb to see a list of all buildings\n\tq to quit\n\nEnter an option ('m' to see the menu): # Verify t"
  },
  {
    "path": "HW/hw7/test/campusBuildings.test",
    "chars": 132,
    "preview": "# Verify that the program list all buildings' names \n# (both abbreviated name and full name) correctly.\nb\n\n# terminate t"
  },
  {
    "path": "HW/hw7/test/echoEmptyLineAndComments.expected",
    "chars": 233,
    "preview": "Menu:\n\tr to find a route\n\tb to see a list of all buildings\n\tq to quit\n\nEnter an option ('m' to see the menu): # Check th"
  },
  {
    "path": "HW/hw7/test/echoEmptyLineAndComments.test",
    "chars": 124,
    "preview": "# Check the program echo empty lines and \n# lines starting with # character.\n\n# seems like no problem\n\n# terminate progr"
  },
  {
    "path": "HW/hw7/test/exampleBasicFindPath.expected",
    "chars": 1329,
    "preview": "Menu:\n\tr to find a route\n\tb to see a list of all buildings\n\tq to quit\n\nEnter an option ('m' to see the menu): # Verify t"
  },
  {
    "path": "HW/hw7/test/exampleBasicFindPath.test",
    "chars": 174,
    "preview": "# Verify that the program finds and correctly outputs the shortest path from\n# CSE to PAB.\nr\nCSE\nPAB\n\n# All of your test"
  },
  {
    "path": "HW/hw7/test/findRouteWithTwoUnknownBuildings.expected",
    "chars": 440,
    "preview": "Menu:\n\tr to find a route\n\tb to see a list of all buildings\n\tq to quit\n\nEnter an option ('m' to see the menu): # Verify t"
  },
  {
    "path": "HW/hw7/test/findRouteWithTwoUnknownBuildings.test",
    "chars": 181,
    "preview": "# Verify that the program prints \n# \"Unknown building: \" + buildingName \n# twice when both starting building and \n# endi"
  },
  {
    "path": "HW/hw7/test/findRouteWithUnknownEndingBuilding.expected",
    "chars": 386,
    "preview": "Menu:\n\tr to find a route\n\tb to see a list of all buildings\n\tq to quit\n\nEnter an option ('m' to see the menu): # Verify t"
  },
  {
    "path": "HW/hw7/test/findRouteWithUnknownEndingBuilding.test",
    "chars": 149,
    "preview": "# Verify that the program prints \n# \"Unknown building: \" + buildingName \n# once when ending building is unknown.\nr\nCSE\nN"
  },
  {
    "path": "HW/hw7/test/findRouteWithUnknownStartingBuilding.expected",
    "chars": 388,
    "preview": "Menu:\n\tr to find a route\n\tb to see a list of all buildings\n\tq to quit\n\nEnter an option ('m' to see the menu): # Verify t"
  },
  {
    "path": "HW/hw7/test/findRouteWithUnknownStartingBuilding.test",
    "chars": 151,
    "preview": "# Verify that the program prints \n# \"Unknown building: \" + buildingName \n# once when starting building is unknown.\nr\nNBA"
  }
]

// ... and 145 more files (download for full content)

About this extraction

This page contains the full source code of the ldfaiztt/CSE331 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 345 files (16.3 MB), approximately 1.6M tokens, and a symbol index with 1151 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!