|
|
|
|
2
|
|
2
|
|
3
|
Various Java programs to illustrate various concepts from an old CS course at UTexas.edu.
|
3
|
Various Java programs to illustrate various concepts from an old CS course at UTexas.edu.
|
4
|
|
4
|
|
5
|
-* A [Hello World!](javacode/codeSamples/HelloWorld.java) Java program.
|
|
|
|
|
5
|
+* A [Hello World!](CodeSamples/codeSamples/HelloWorld.java) Java program.
|
6
|
|
6
|
|
7
|
-* [Calling Methods](javacode/codeSamples/CallingMethodsInSameClass.java). A sample of how to call methods in the same class.
|
|
|
|
|
7
|
+* [Calling Methods](CodeSamples/codeSamples/CallingMethodsInSameClass.java). A sample of how to call methods in the same class.
|
8
|
|
8
|
|
9
|
-* [For loop](javacode/codeSamples/Factorial.java). A simple example of using for loops to calculate factorial. Uses the built in int data type so only good to 13!
|
|
|
|
|
9
|
+* [For loop](CodeSamples/codeSamples/Factorial.java). A simple example of using for loops to calculate factorial. Uses the built in int data type so only good to 13!
|
10
|
|
10
|
|
11
|
-* [Enhanced for loop](javacode/codeSamples/EnhancedFor.java)
|
|
|
|
|
11
|
+* [Enhanced for loop](CodeSamples/codeSamples/EnhancedFor.java)
|
12
|
|
12
|
|
13
|
-* [Value Parameters](javacode/codeSamples/PrimitiveParameters.java): An example that shows the behavior of value parameters. In Java all parameters are passed by value.
|
|
|
|
|
13
|
+* [Value Parameters](CodeSamples/codeSamples/PrimitiveParameters.java): An example that shows the behavior of value parameters. In Java all parameters are passed by value.
|
14
|
|
14
|
|
15
|
-* [String Example](javacode/codeSamples/StringExample.java). A few brief examples of String manipulations.
|
|
|
|
|
15
|
+* [String Example](CodeSamples/codeSamples/StringExample.java). A few brief examples of String manipulations.
|
16
|
|
16
|
|
17
|
-* [BinaryConverter](javacode/codeSamples/BinaryConverter.java). A program with examples of various Java syntax that converts a base 10 int to base 2 String.
|
|
|
|
|
17
|
+* [BinaryConverter](CodeSamples/codeSamples/BinaryConverter.java). A program with examples of various Java syntax that converts a base 10 int to base 2 String.
|
18
|
|
18
|
|
19
|
-* [PrimeEx](javacode/codeSamples/PrimeEx.java) A program with various approaches to determine if an int is prime or not. Used to demonstrate Java syntax. You need the [Stopwatch](javacode/utilities/Stopwatch.java) class, a non standard Java class, as well.
|
|
|
|
|
19
|
+* [PrimeEx](CodeSamples/codeSamples/PrimeEx.java) A program with various approaches to determine if an int is prime or not. Used to demonstrate Java syntax. You need the [Stopwatch](CodeSamples/utilities/Stopwatch.java) class, a non standard Java class, as well.
|
20
|
|
20
|
|
21
|
-* [Pointers as Value parameters](javacode/codeSamples/ObjectVarsAsParameters.java)
|
|
|
|
|
21
|
+* [Pointers as Value parameters](CodeSamples/codeSamples/ObjectVarsAsParameters.java)
|
22
|
|
22
|
|
23
|
-* [Array Examples](javacode/codeSamples/ArrayExamples.java)
|
|
|
|
|
23
|
+* [Array Examples](CodeSamples/codeSamples/ArrayExamples.java)
|
24
|
|
24
|
|
25
|
-* [2D array Example](javacode/codeSamples/FilterExample.java). A simplified version of filtering a picture represented by ints.
|
|
|
|
|
25
|
+* [2D array Example](CodeSamples/codeSamples/FilterExample.java). A simplified version of filtering a picture represented by ints.
|
26
|
|
26
|
|
27
|
-* [2D array example](javacode/codeSamples/Life.java). Very simple version of the Conway's Game of Life.
|
|
|
|
|
27
|
+* [2D array example](CodeSamples/codeSamples/Life.java). Very simple version of the Conway's Game of Life.
|
28
|
|
28
|
|
29
|
-* [Getting input from Keyboard with Scanner class](javacode/codeSamples/ScannerAndKeyboard.java)
|
|
|
|
|
29
|
+* [Getting input from Keyboard with Scanner class](CodeSamples/codeSamples/ScannerAndKeyboard.java)
|
30
|
|
30
|
|
31
|
-* [Reading ints from file with Scanner class](javacode/codeSamples/ReadAndPrintScores.java)
|
|
|
|
|
31
|
+* [Reading ints from file with Scanner class](CodeSamples/codeSamples/ReadAndPrintScores.java)
|
32
|
|
32
|
|
33
|
-* [Writing ints to file](javacode/codeSamples/WriteToFile.java)
|
|
|
|
|
33
|
+* [Writing ints to file](CodeSamples/codeSamples/WriteToFile.java)
|
34
|
|
34
|
|
35
|
-* [Connecting to and reading from a web page.](javacode/codeSamples/URLExpSimple.java)
|
|
|
|
|
35
|
+* [Connecting to and reading from a web page.](CodeSamples/codeSamples/URLExpSimple.java)
|
36
|
|
36
|
|
37
|
-* [Program to create ASCII frequency table from file and url.](javacode/codeSamples/FreqTableExampleOriginal.java) Demonstration of try / catch blocks. The CIA 2008 Factbook may be downloaded from [Project Gutenberg](http://www.gutenberg.org/cache/epub/29233/pg29233.txt).
|
|
|
|
|
37
|
+* [Program to create ASCII frequency table from file and url.](CodeSamples/codeSamples/FreqTableExampleOriginal.java) Demonstration of try / catch blocks. The CIA 2008 Factbook may be downloaded from [Project Gutenberg](http://www.gutenberg.org/cache/epub/29233/pg29233.txt).
|
38
|
|
38
|
|
39
|
-* [IntListVer1](javacode/codeSamples/IntListVer1.java) First version of the IntList class developed in class. Developing class to illustrate various class design and implementation issues in Java.
|
|
|
|
|
39
|
+* [IntListVer1](CodeSamples/codeSamples/IntListVer1.java) First version of the IntList class developed in class. Developing class to illustrate various class design and implementation issues in Java.
|
40
|
|
40
|
|
41
|
-* [IntListTesterVer1](javacode/codeSamples/IntListTesterVer1.java)
|
|
|
|
|
41
|
+* [IntListTesterVer1](CodeSamples/codeSamples/IntListTesterVer1.java)
|
42
|
|
42
|
|
43
|
-* [IntListVer2](javacode/codeSamples/IntListVer2.java) Added default add method, equals method, and toString methods. Includes versions of toString using String concatenation and StringBuffer to illustarte performance differences.
|
|
|
|
|
43
|
+* [IntListVer2](CodeSamples/codeSamples/IntListVer2.java) Added default add method, equals method, and toString methods. Includes versions of toString using String concatenation and StringBuffer to illustarte performance differences.
|
44
|
|
44
|
|
45
|
-* [IntListTesterVer2](javacode/codeSamples/IntListTesterVer2.java)
|
|
|
|
|
45
|
+* [IntListTesterVer2](CodeSamples/codeSamples/IntListTesterVer2.java)
|
46
|
|
46
|
|
47
|
-* [IntListVer3](javacode/codeSamples/IntListVer3.java). Added insert and remove methods.
|
|
|
|
|
47
|
+* [IntListVer3](CodeSamples/codeSamples/IntListVer3.java). Added insert and remove methods.
|
48
|
|
48
|
|
49
|
-* [SortedIntList](javacode/codeSamples/SortedIntList.java). Inherits from InListVer3 to create a SortedIntList. Class is "broken" because random insertions still allowed.
|
|
|
|
|
49
|
+* [SortedIntList](CodeSamples/codeSamples/SortedIntList.java). Inherits from InListVer3 to create a SortedIntList. Class is "broken" because random insertions still allowed.
|
50
|
|
50
|
|
51
|
-* [GenericList](javacode/codeSamples/GenericList.java). Altered the list to store anything, not just ints.
|
|
|
|
|
51
|
+* [GenericList](CodeSamples/codeSamples/GenericList.java). Altered the list to store anything, not just ints.
|
52
|
|
52
|
|
53
|
-* [Die](javacode/codeSamples/Die.java) class. A class that models a playing die.
|
|
|
|
|
53
|
+* [Die](CodeSamples/codeSamples/Die.java) class. A class that models a playing die.
|
54
|
|
54
|
|
55
|
-* [DemoClass](javacode/codeSamples/DemoClass.java): This illustrates some of the more confusing concepts in class syntax and mechanics such as constructors, static vs. instance methods, and method overloading.
|
|
|
|
|
55
|
+* [DemoClass](CodeSamples/codeSamples/DemoClass.java): This illustrates some of the more confusing concepts in class syntax and mechanics such as constructors, static vs. instance methods, and method overloading.
|
56
|
|
56
|
|
57
|
-* [Stopwatch class](javacode/utilities/Stopwatch.java). A class for measuring how long it takes for a program to run.
|
|
|
|
|
57
|
+* [Stopwatch class](CodeSamples/utilities/Stopwatch.java). A class for measuring how long it takes for a program to run.
|
58
|
|
58
|
|
59
|
- * [Documentation for Stopwatch class.](javacode/utilities/Stopwatch.html)
|
|
|
|
|
59
|
+ * [Documentation for Stopwatch class.](CodeSamples/utilities/Stopwatch.html)
|
60
|
|
60
|
|
61
|
-* [Create a Set](javacode/codeSamples/CreateASet.java). A method that using polymorphism to create a set from an array.
|
|
|
|
|
61
|
+* [Create a Set](CodeSamples/codeSamples/CreateASet.java). A method that using polymorphism to create a set from an array.
|
62
|
|
62
|
|
63
|
-* [Recursion examples](javacode/codeSamples/RecursionExampleDirectory.java). Includes examples on finding space taken up by files in a directory including all files in all subdirectories, recursive factorial, recursive power, recursive Fibonacci numbers, and a simple knapsack problem.
|
|
|
|
|
63
|
+* [Recursion examples](CodeSamples/codeSamples/RecursionExampleDirectory.java). Includes examples on finding space taken up by files in a directory including all files in all subdirectories, recursive factorial, recursive power, recursive Fibonacci numbers, and a simple knapsack problem.
|
64
|
|
64
|
|
65
|
-* [Eight Queens example](javacode/codeSamples/EightQueens.java). Code to find a a solution to an N queens problem. Note the queensAreSafe method has not been completed.
|
|
|
|
|
65
|
+* [Eight Queens example](CodeSamples/codeSamples/EightQueens.java). Code to find a a solution to an N queens problem. Note the queensAreSafe method has not been completed.
|
66
|
|
66
|
|
67
|
-* [Airlines example](javacode/codeSamples/AirlineProblem.java). Determine if airlines can be moved from airline to another based on network of airline partners. Here is a [sample input file](javacode/codeSamples/airlines.txt).
|
|
|
|
|
67
|
+* [Airlines example](CodeSamples/codeSamples/AirlineProblem.java). Determine if airlines can be moved from airline to another based on network of airline partners. Here is a [sample input file](CodeSamples/codeSamples/airlines.txt).
|
68
|
|
68
|
|
69
|
-* [Minesweeper](javacode/codeSamples/MineSweeper.java). Another example of recursion from the game minesweeper.
|
|
|
|
|
69
|
+* [Minesweeper](CodeSamples/codeSamples/MineSweeper.java). Another example of recursion from the game minesweeper.
|
70
|
|
70
|
|
71
|
-* [GenericListVersion2](javacode/codeSamples/GenericListVersion2.java). Changed the GenericList class so that it implements the [Iterable](http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html) interface in order to demonstrate how to implement an [iterator](http://java.sun.com/javase/6/docs/api/java/util/Iterator.html) using an inner class.
|
|
|
|
|
71
|
+* [GenericListVersion2](CodeSamples/codeSamples/GenericListVersion2.java). Changed the GenericList class so that it implements the [Iterable](http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html) interface in order to demonstrate how to implement an [iterator](http://java.sun.com/javase/6/docs/api/java/util/Iterator.html) using an inner class.
|
72
|
|
72
|
|
73
|
-* [GenericListVersion3](javacode/GenericList.java). Changed GenericList so it is generic based on Java generics syntax instead of relying on Object.
|
|
|
|
|
73
|
+* [GenericListVersion3](CodeSamples/GenericList.java). Changed GenericList so it is generic based on Java generics syntax instead of relying on Object.
|
74
|
|
74
|
|
75
|
-* [ListNode](javacode/codeSamples/ListNode.java). A singly linked node class used to build linked lists
|
|
|
|
|
75
|
+* [ListNode](CodeSamples/codeSamples/ListNode.java). A singly linked node class used to build linked lists
|
76
|
|
76
|
|
77
|
-* [IList](javacode/LinkedList/IList.java). A simple list interface
|
|
|
|
|
77
|
+* [IList](CodeSamples/LinkedList/IList.java). A simple list interface
|
78
|
|
78
|
|
79
|
-* [LinkedList](javacode/codeSamples/LinkedList.java). Similar to the LinkedList developed in class. Does not contain all the methods you would expect of a LinkedList. Also implements the iterator remove method in O(N) time. An O(1) time remove method is possible.
|
|
|
|
|
79
|
+* [LinkedList](CodeSamples/codeSamples/LinkedList.java). Similar to the LinkedList developed in class. Does not contain all the methods you would expect of a LinkedList. Also implements the iterator remove method in O(N) time. An O(1) time remove method is possible.
|
80
|
|
80
|
|
81
|
-* [UnsortedHashSet](javacode/codeSamples/UnsortedHashSet.java) \- An unsorted set that uses a hashtable with closed address hashing to store values. Currently only the add method is implemented.
|
|
|
|
|
81
|
+* [UnsortedHashSet](CodeSamples/codeSamples/UnsortedHashSet.java) \- An unsorted set that uses a hashtable with closed address hashing to store values. Currently only the add method is implemented.
|
82
|
|
82
|
|
83
|
-* [UnsortedSetTest](javacode/codeSamples/UnsortedSetTest.java) - A method to compare Java's TreeSet and HashSet to the BianrySearchTree, UnsortedSet, and UnsortedHashSet classes developed in class. Note you need a lot of other files for this to work.
|
|
|
|
|
83
|
+* [UnsortedSetTest](CodeSamples/codeSamples/UnsortedSetTest.java) - A method to compare Java's TreeSet and HashSet to the BianrySearchTree, UnsortedSet, and UnsortedHashSet classes developed in class. Note you need a lot of other files for this to work.
|
84
|
|
84
|
|
85
|
-* [SimpleWordCount](javacode/codeSamples/SimpleWordCounter.java) \- Program demonstrating use of a map to count the frequency of words in a file.
|
|
|
|
|
85
|
+* [SimpleWordCount](CodeSamples/codeSamples/SimpleWordCounter.java) \- Program demonstrating use of a map to count the frequency of words in a file.
|
86
|
|
86
|
|
87
|
-* [WordCount](https://www.cs.utexas.edu/~scottm/cs314/javacode/CodingSamples/WordCount.java) \- Program that compares counting words in files using an ArrayList and a Map.
|
|
|
|
|
87
|
+* [WordCount](https://www.cs.utexas.edu/~scottm/cs314/CodeSamples/CodingSamples/WordCount.java) \- Program that compares counting words in files using an ArrayList and a Map.
|