Просмотр исходного кода

Fix various issues with some problems

- where files are required from the "starter" (./src/main/java), these
  are now soft-linked into the example source.
- a couple examples were missing import statements.
- the example code for Hamming was failing the test suite.

At this time, these are all of the problems that have example code.
John S. Ryan 11 лет назад
Родитель
Сommit
dc0734c8f9

+ 1
- 0
allergies/src/example/java/Allergen.java Просмотреть файл

@@ -0,0 +1 @@
1
+../../main/java/Allergen.java

+ 3
- 0
gigasecond/src/example/java/Gigasecond.java Просмотреть файл

@@ -1,3 +1,6 @@
1
+import java.time.LocalDateTime;
2
+import java.time.LocalDate;
3
+
1 4
 public class Gigasecond {
2 5
 
3 6
     private LocalDateTime birthDateTime;

+ 3
- 0
hamming/src/example/java/Hamming.java Просмотреть файл

@@ -1,6 +1,9 @@
1 1
 public class Hamming {
2 2
 
3 3
     public static int compute(String leftStrand, String rightStrand) {
4
+        if(leftStrand.length() != rightStrand.length()) {
5
+            throw new IllegalArgumentException("leftStrand and rightStrand must be of equal length.");
6
+        }
4 7
         final int length = Math.min(leftStrand.length(), rightStrand.length());
5 8
         int distance = 0;
6 9
         for (int i = 0; i < length; i++) {

+ 1
- 0
meetup/src/example/java/MeetupSchedule.java Просмотреть файл

@@ -0,0 +1 @@
1
+../../main/java/MeetupSchedule.java

nucleotide-count/src/example/java/.java → nucleotide-count/src/example/java/DNA.java Просмотреть файл


+ 3
- 0
roman-numerals/src/example/java/RomanNumeral.java Просмотреть файл

@@ -1,3 +1,6 @@
1
+import java.util.Map;
2
+import java.util.LinkedHashMap;
3
+
1 4
 public class RomanNumeral {
2 5
 
3 6
     private int arabicNumeral;

+ 3
- 0
scrabble-score/src/example/java/Scrabble.java Просмотреть файл

@@ -1,3 +1,6 @@
1
+import java.util.Map;
2
+import java.util.HashMap;
3
+
1 4
 public class Scrabble {
2 5
 
3 6
     private String word;

+ 8
- 8
settings.gradle Просмотреть файл

@@ -1,17 +1,17 @@
1 1
 include 'accumulate'
2
-// include 'allergies'
2
+include 'allergies'
3 3
 include 'anagram'
4 4
 include 'atbash-cipher'
5 5
 include 'binary'
6 6
 include 'bob'
7 7
 include 'crypto-square'
8 8
 include 'etl'
9
-// include 'gigasecond'
9
+include 'gigasecond'
10 10
 include 'grade-school'
11
-// include 'hamming'
11
+include 'hamming'
12 12
 include 'luhn'
13
-// include 'meetup'
14
-// include 'nucleotide-count'
13
+include 'meetup'
14
+include 'nucleotide-count'
15 15
 include 'octal'
16 16
 include 'pascals-triangle'
17 17
 include 'phone-number'
@@ -19,13 +19,13 @@ include 'pig-latin'
19 19
 include 'raindrops'
20 20
 include 'rna-transcription'
21 21
 include 'robot-name'
22
-// include 'roman-numerals'
22
+include 'roman-numerals'
23 23
 include 'prime-factors'
24
-// include 'scrabble-score'
24
+include 'scrabble-score'
25 25
 include 'sieve'
26 26
 include 'simple-cipher'
27 27
 include 'space-age'
28 28
 include 'strain'
29
-// include 'triangle'
29
+include 'triangle'
30 30
 include 'trinary'
31 31
 include 'word-count'

+ 3
- 0
triangle/src/example/java/Triangle.java Просмотреть файл

@@ -1,3 +1,6 @@
1
+import java.util.HashSet;
2
+import java.util.Set;
3
+
1 4
 public class Triangle {
2 5
 
3 6
     private double side1;

+ 1
- 0
triangle/src/example/java/TriangleException.java Просмотреть файл

@@ -0,0 +1 @@
1
+../../main/java/TriangleException.java

+ 1
- 0
triangle/src/example/java/TriangleKind.java Просмотреть файл

@@ -0,0 +1 @@
1
+../../main/java/TriangleKind.java