Description
Mark: 6%
Prerequisite
Caught up to Unit 34 of Lecture Notes
Completed Lab 7
Important Concepts Tested
Memo: Compute only when needed & do not repeat yourself
Actually: Possibly error handled by container
PECS: Make your method signature as flexible as possible
JaoaDoc: Documenting your code and generating the documentation
Files
A skeleton for InfiniteList<T> is provided for you. Copy the following implementations over before you start with Lab 7:
• cs2030s . fp . Action
• cs2030s . fp .Immutator
• cs2030s . fp . Constant
• cs2030s . fp . Combiner
• cs2030s . fp . Actionable
• cs2030s . fp . Immutatorable
• cs2030s .fp . Actually
• cs2030s .fp . Memo
The files Test 1 . java , Test2.java , etc., as well as CS2030STest . java , are provided for testing. You can edit them to add your test cases, but they will not be submitted.
Infinite List
You have seen in class a poorly implemented version of InfiniteList . Recall that there are two issues:
1. It uses null to represent a missing value.
• This design prevents us from having null as elements in the list.
2. Produced values are not memoized.
• This results in repeated computation of the same value.
You are already given a (badly written but still correct) implementation of which will solve problem (1), and Memo<T> which will solve problem (2). We will use them to build a better version of InfiniteList here.
• public class InfiniteList<T> {
2 private Memo<Actua11Y<T>> head; 3 private Memo<InfiniteList<T>> tail ;
4
IMPORTANTU
Take note of the following constraints. Not following these constraints will result in immediate 0 for your lab.
• You are NOT allowed to add other instance fields.
• You are NOT allowed to use any raw types.
• You are NOT allowed to use java . util . stream . Stream to solve this lab.
• You are NOT allowed to use unwrap from Actually .
Additionally, you must follow the following constraints or heavy penalty will be given.
• @SuppressWarnings must be used responsibly.
• Where possible, use the methods provided by to handle the conditions where the value is there or not there, instead of using if-else or try-catch .
The Basics
Write the static generate and iterate methods that create an InfiniteList . This is different from generate in MemoList in Lab 7 but this is similar to generate introduced in the lecture on Infinite List.
To access the elements of the list, provide the head and tail method that produces the head and tail of the infinite list. Recap the problem in the lecture about head() and tail() in relation to filter method. You should follow the idea presented in the lecture to avoid modifying head() and tail( ) later on.
To help with debugging, a toString method has been provided for you.
jshell> import cs2030s .fp. InfiniteList ;
2 jshell> import cs2030s .fp. Immutator;
3
4 jshell> import cs2030s .fp.Constant ;
5
6 jshell> one InfiniteList<Integer> one = InfiniteList .
7
8 jshell>
one. head( )
9
10 jshell> one one
1 1
12 jshell>
one. tail( ) . head( )
13
14
15 jshell> one one
16 jshell> InfiniteList<Integer> nul = InfiniteList .generate( ( ) null)
1 8 jshell> nul. head( )
19 null
20 jshell> nul
21 nul [<null> ? ]
22 jshell> nul . tail ( ) . head( )
23 null
24 jshell> nul
25
26 nul [<null> [<null> ? ] ]
27 jshell> InfiniteList<String> str = InfiniteList . iterate( “A
28 str
29 jshell> str .tail( ) . head( )
30
31 jshell> str
32 str
33 jshell>
str .tail( ) . tail( ) . tail( ) . head( )
I ‘ ARRR’
35 jshell> str
36
37 str
38 jshell> Immutator<lnteger, Integer> incr =
39 System . out . print
40 return x + 1
41
42 jshell> InfiniteList<Integer> nat = InfiniteList . iterate(1 , incr)
43 nat
44
45 jshell> nat . head( )
46
47 jshell> nat
49
50 jshell> nat . tail ( ) . head( )
51 1 + 1 = 2
52 $21 2
53 jshell> nat
54 nat
55
56 jshell> nat . tail ( ) . head( )
2
58 jshell> nat
59 nat = = > [ < ? ] ]
60
61 jshell> nat . tail ( ) . tail( ) . head( )
62 2 + 1 = 3
63 3
64 jshell> nat
65 nat
66
67 jshell> nat . tail ( ) . head( )
68 2
69 jshell> nat
70 nat
71
72 jshell> Constant<lnteger> zero
73 System . out . print In(
74 return 0 ;
75
76 jshell> InfiniteList<Integer> zeroes = InfiniteList . generate (zero)
77 zeroes
78
79 jshell> zeroes . head( )
80
81 0
82 jshell> zeroes
83 zeroes
84
85 jshell> zeroes . tail( ) . head( )
86
88 jshell> zeroes
89 zeroes
90
91 jshell> zeroes . head( )
92 0
93 jshell> zeroes
94 zeroes
95
96 jshell> zeroes . tail( ) . head( )
98 jshell> zeroes
99 zeroes
100
101 jshell> zeroes . tail( ) . tail( ) . head( )
102
103 0
104 jshell> zeroes
105 zeroes
106
107 jshell> zeroes . tail( ) . head( )
108 0
109 jshell> zeroes
110 zeroes
You can test your code by running the Test 1 . java provided. The following should compile without errors or warnings. Make sure your code follows the CS2030S Java style and can generate the documentation without error.
$ javac -Xlint : rawtypes cs2030s/fp/*java
2 $ javac -Xlint : rawtypes Test 1 . java
3 $ java Test 1
4 $ java -jar æ cs2030s/bin/checksty1e. jar -c -vcs2030s/bin/cs2030_checks.xm1 cs2030s/fp 5 / InfiniteList . java
$ javadoc -quiet -private -d docs cs2030s/fp/InfiniteList . java
map
Now let’s add the map method. The map method (lazily) applies the given Immutator to each element in the list and returns the resulting InfiniteList .
tail
list
map(tail)
j shell> import cs2030s.fp .InfiniteList
2 j shell> import cs2030s.fp . Immutator
3
4 j shell> import cs2030s.fp . Constant
5 j shell> InfiniteList<Integer> nat = InfiniteList . iterate(l ,
6 nat
7 l ) .map(x
8
9
10
11 l ) .map(x -> x * 2) . tail( ) . head( )
12
13 14
15
16
171 ) . head( )
18
19 j shell> nat .map (x 2) . map(x 1 ) . tail( ) . head( )
20 3
21 j shell> nat .map (x null x) . tail( ) . head( )
22 null
23
24 j shell> Constant<lnteger> one
25 System . out . print
26 return 1 ;
27
28 j shell>
29
30
31
32
33 j shell> InfiniteList . generate(one) .map(dbl) . tail( ) . head( )
34
35 1 + 1 = 2
36
37 1 + 1 = 2
38
39
40 jshell> InfiniteList<Integer> ones = InfiniteList . generate (one)
41 ones
42 jshell> InfiniteList<Integer> twos = ones .map(dbl)
43 twos
44
45 jshell> twos. tail( ) . head( )
46
47 1 + 1 = 2
48
49 1 + 1 = 2
50
51 jshell> ones
52 ones
53 j shell> twos
54 twos
55
56 jshell> twos. head( )
57
58 jshell> twos. tail( ) . head( )
59
You can test your code by running the Test2. java provided. The following should compile without errors or warnings. Make sure your code follows the CS2030S Java style and can generate the documentation without error.
$ javac -Xlint : rawtypes cs2030s/fp/*java
2 $ javac -X lint : rawtypes Test2 . java
3 $ java Test2
4 $ java -jar Ncs2030s/bin/checksty1e. jar -c cs2030s/fp
5 / InfiniteList . java
$ javadoc -quiet -private -d docs cs2030s/fp/InfiniteList . java
filter
Add the filter method to filter out elements in the list that fail a given Immutator<B001ean, T> (note: make the type flexible following PECS). filter should mark any filtered (i.e., removed or missing) element as Actually. err() instead of null . The resulting (lazily) filtered InfiniteList is returned.
tail
list
ao filter(tail)
Lastly, for this lab, modify such that Failure class simply returns <> on toString . This has been done in our implementation of Actually (there is no Failure class but we print <> on our equivalent concept offailure) but if you are using your own implementation, you need to modify this.
jshell> import cs2030s .fp. Immutator
2 jshell> import cs2030s .fp. InfiniteList
3
4 jshell> InfiniteList<Integer> nat = InfiniteList . iterate(l
5 nat
6 jshell> InfiniteList . generate( ( ) 1 ) . filte r (x -> x % 2 =
7
8 jshell> nat .filter(x
9
10 jshell> nat .filter(x = 0) . head( )
1 1 2
12 jshell> nat . filte r ( x – 0) . filter (x -> x > 4) . head( )
1 3 6
14
1 5 jshell> Immutator<lnteger, Integer> incr 16 System . out . print In(
1 8 return x + 1
19 jshell> Immutator<B001ean, Integer> isEven
20 System . out . print In(
21 return x % 2 0;
22
23
24 jshell> InfiniteList . iterate(l incr) . filter(isEven) . tail( ) . head( )
25
26
27
28
29
30
31
32
33 jshell> InfiniteList<Integer> nums = InfiniteList . iterate(1 , x
35 nums
36 jshell> InfiniteList<Integer> evens = nums .filter(x -> x % 2 =
37
38
39 jshell> evens. tail( ) . head( )
40
41 jshell> nums
42 nums
43 jshell> evens // modify Failure : :toString for this
44
45
46 jshell> nums .tail( ) . head( )
47 2
jshell> evens. tail( ) . head( )
49
50 4
51 jshell> Immutator<B001ean, Integer> moreThan5 52 System . out . print
53
54 return x > 5 ;
55 jshell> Immutator<lnteger, Integer> dbl
56 System . out . print return X + X ;
58
59
60 jshell> InfiniteList . iterate(l incr) . filter(moreThan5) . filter(isEven) . head( )
61 1 false
62 1
63 2 false
64 2
65 3 false
66 3
67 4 false
68 4
69 5 false
70
6 true
72 6
73
74
75 jshell> InfiniteList . iterate(1 , incr)
76 . map(dbl) . filter(moreThan5)
. filter(isEven) . tail( ) . head( )
78
79 2 false
80
81 2
82 4 false
83 2
84 3
85 6 > 5 = true
86
88
89true
90
92
93 jshell> InfiniteList . iterate(1 , incr)
94 . filter(isEven) .map(dbl) 95 . filter(moreThan5) . head( )
96
97
98
99
100false
101
102
103
104
105
106true
107
You can test your code by running the Test3 . java provided. The following should compile without errors or warnings. Make sure your code follows the CS2030S Java style and can generate the documentation without error.
$ javac -Xlint : rawtypes cs2030s/fp/*java
$ javac -X lint : rawtypes Test3 . java
$ java Test3
$ java -jar æ cs2030s/bin/checksty1e. jar -c evcs2030s/bin/cs2030_checks.xm1 cs2030s/fp / InfiniteList . java
$ javadoc -quiet -private -d docs cs2030s/fp/InfiniteList . java
end and isEnd
Provide a boolean isEnd method that returns true if the list is an instance of End and returns false otherwise. Note that isEnd is a lazy operation and should not trigger the evaluation of the infinite list.
Provide an end method that returns an end.
Provide a head and tail method that simply throws java . util.NoSuchE1ementException( )
j shell> import cs2030s.fp .Immutator
2 j shell> import cs2030s.fp .InfiniteList
3 j shell> import cs2030s.fp . Constant 4
5 j shell> InfiniteList . iterate(1 , x
6 false
7 j shell> InfiniteList . 2) . isEnd( )
8 false
9 j shell> InfiniteList . . filter (x -> x 0) . isEnd( )
10 false
11 j shell> InfiniteList . iterate(l , + 1 ) . map(x 2) . isEnd( )
12 false
13 j shell> InfiniteList . iterate(l , + 1 ) . filte r ( x 0) . isEnd( )
14 false
15
16 j shell> InfiniteList . end( )
17
18 j shell> InfiniteList . end( ) . isEnd( )
19 true
20 j shell> InfiniteList .end( ) . map(x -> 2) . isEnd( )
21 true
22 j shell> InfiniteList . end( ) . filter (x true) . isEnd( )
23 true
24 j shell> InfiniteList . end( ) . filter (x false) . isEnd( )
25 true
limit , toList
Now that we have a way to terminate an infinite list into a finite list, write a limit method that takes in a value n and truncate the InfiniteList<T> to a finite list with at most n elements. Your limit method must not count elements that are filtered out by filter , if any. Here, the type of n should be long instead of int .
jshell> import cs2030s .fp. Immutator
2 jshell> import cs2030s .fp. InfiniteList
3 jshell> import cs2030s .fp.Constant
4
5 jshell> InfiniteList . end( ) . limit (4) . isEnd( )
6 true
7 jshell> InfiniteList<Integer> nat – InfiniteList . iterate(l
8 nat
9 jshell> nat . 1imit(0) . isEnd( )
10 true
1 1 jshell> nat . limit(l ) . isEnd( )
12 false
1 3 jshell> nat . 1imit(10) . isEnd( )
14 false
1 5 jshell> nat . limit ( – l ) . isEnd( )
16 true
jshell> nat . 1imit(0) . isEnd( )
1 8 true
19 jshell> nat . limit(l ) . isEnd( )
20 false
21 jshell> nat . 1imit(10) . isEnd( )
22
23 false
24 jshell> InfiniteList . generate( ( ) 1 ) . 1imit(4)
25
26 jshell> nat . 1imit(4)
27
28
29 jshell>
nat . limit(l ) . head( )
30
31
32 jshell>
nat . 1imit(4) . head( )
33 jshell>
T run(Constant<T> c) try {
35 return c . init( ) ;
36 } catch (Exception e) {
37 System . out . println(e) ;
38
39
40 return nu ll ;
41 jshell> Immutator<B001ean, Integer> isEven =
42 jshell> Immutator<String, String> zzz =
43
44 jshell> run( ( ) -> nat . limit(l ) . tail( ) . head( ) )
45 j ava . util . NoSuchE1ementException
46 $ null
47 jshell> run( ( ) -> nat . 1imit(0) . head( ) )
48 j ava . util . NoSuchE1ementException
49 $ . . null
50 jshell> run( ( ) -> nat . 1imit(4) . tail( ) . tail( ) . head( ) ) 51
52 jshell> run( ( ) -> nat . 1imit(4) . limit (1 ) . tail( ) . head( ) )
53 j ava . util . NoSuchE1ementException
54 $ null
55 jshell> run( ( ) -> nat . limit(l ) . limit (4) . tail( ) . head( ) )
56 j ava . util . NoSuchE1ementException
$ null
58
59 jshell> run( ( ) -> nat .fi1ter(isEven) . limit (0) . head( ) )
60 j ava . util . NoSuchE1ementException
61 $ null
62 jshell> run( ( ) -> nat .fi1ter(isEven) . limit (1 ) . head( ) )
63 jshell> run( ( ) -> nat . limit(l ) . filter(isEven) . head( ) )
65 java . util . NoSuchE1ementException
66 null
67 jshell> run( ( ) -> nat . 1imit(2) . filter(isEven) . head( ) )
68 2
69
70 jshell> run( ( ) -> InfiniteList . iterate( “A” , zzz) . limit (2) . map(s -> s . length( ) )
71 . head( ) )
72
73 jshell> run( ( ) -> InfiniteList . iterate( “A l zzz) . limit (2) . map(s -> s . length( ) ) 74. tail( ) . head( ) )
752
76 jshell> run( ( ) -> InfiniteList . iterate( “A” ,
. . head( ) ) zzz) . limit (2) . map(s s . length( ) )
78 j ava . util . NoSuchE1ementException
79
80 null
81 jshell> run( ( ) InfiniteList . iterate( “A l zzz) . map(s -> s. length( ) )
82
83 . limit (2) . head( ) )
84 jshell> run( ( ) InfiniteList . iterate( “A” , zzz) . map(s -> s. length( ) )
85 . limit (2) . tail( ) . head( ) )
86 2
jshell> run( ( ) InfiniteList . iterate( “A” , zzz) . map(s -> s . length( ) )
88 . limit (2) . tail( ) . tail( ) . head( ) )
89 j ava . util . NoSuchE1ementException
90 null
91
92 jshell> InfiniteList .toList( )
93
94 jshell> InfiniteList . iterate( “A” , zzz) . map(s -> s . length( ) ) . limit (2) .toList( )
96 jshell> InfiniteList . iterate( “A” , zzz) . limit (2) . map(s -> s . length( ) ) .toList( )
98 jshell> nat . limit (2) . filter(isEven) .toList( )
99 [2]
100 jshell> nat .fi1ter(isEven) . limit (2) .toList( ) 101
102 jshell> InfiniteList . iterate(0, x -> x + 1 ) . filter (x -> x > 10)
103 . map(x -> x. hashCode( ) % 30) . filte r (x -> x < 20) . limit (5) .toList( )
104 [11 , 12, 13, 14, 15]
105 jshell> Random rng = new Random(l ) rng ==> java . util.Random@2b9627bc
106 jshell> InfiniteList . generate( ( ) -> rng . nextlnt( ) % 100)
107 . filte r (x -> x > 10) . limit (4) .toList( )
108 [76, 95, 26, 69]
109 jshell> InfiniteList . generate( ( ) -> null) . limit (4) . limit ( 1 ) .toList( )
110 [null]
11 1 jshell> InfiniteList . generate( ( ) -> null) . limit ( 1 ) . limit (4) .toList( )
112 [null]
You can test your code by running the Test4. java provided. The following should compile without errors or warnings. Make sure your code follows the CS2030S Java style and can generate the documentation without error.
$ javac -Xlint : rawtypes cs2030s/fp/*java
2 $ javac -X lint : rawtypes Test4. java
3 $ java Test4
4 $ java -jar N cs2030s/bin/checksty1e. jar -c rucs2030s/bin/cs2030_checks.xm1 cs2030s/fp 5 / InfiniteList . java
$ javadoc -quiet -private -d docs cs2030s/fp/InfiniteList . java
takeWhi1e
Now, implement the takeWhi1e method. The method takes in an Immutator<B001ean, T> (note: make the type flexible following PECS), and truncates the list as soon as it finds an element that evaluates the condition to false.
Just like limit , the takeWhi1e method should ignore elements that have been filtered out by filte r .
jshell> import cs2030s .fp. Immutator
2 jshell> import cs2030s .fp. InfiniteList
3 jshell> import cs2030s .fp.Constant
4
5 jshell> Immutator<lnteger, Integer> incr =
6 System . out . print
7 return x + 1
8
9 jshell>
10 System . out . print
1 1
12 return x < 0 ;
13 jshell> Immutator<B001ean, Integer> lessThan2 14 System . out . print
15
16 return x < 2 ;
jshell> Immutator<B001ean, Integer> lessThan5
1 8 System . out . print
19 return x < 5 ;
20
21 jshell> Immutator<B001ean, Integer> less Than 10 22 System . out . print
23 return x < 10;
24
25 jshell> Immutator<B001ean,
26 System . out . print
27 return x % 2 =
28
29 jshell> < T > T run(Constant<T> c) {
30 try {
31 return c . init( ) ;
32 } catch (Exception e) {
33 System.out .println(e) ; return nu ll ;
35
36
37
38 jshell> jshell> InfiniteList . < . takeWhi1e(1essThan0) . isEnd( )
39 true
40 jshell> InfiniteList . iterate(l incr) . takeWhi1e(1essThan0) . isEnd( ) 41 false 42 jshell> InfiniteList . iterate(l incr) . takeWhi1e(1essThan2) . isEnd( ) 43 false 44 jshell> InfiniteList . iterate(l , incr) . takeWhi1e(1essThan5)
45 . takeWhi1e(1essThan2) . toList( )
46true
47true
1 + 1 = 2
49 2 < 5 = true
50false
51
52 jshell> InfiniteList . iterate(1 , incr) . filter(isEven)
53 . takeWhi1e(1essThan10) .toList( )
54
55 1
56
true
58 2
59
60 3
61
62 63 64
65
66 4
5 4
5
6 10 =
true
68 6 6
10 =
true
69
70
71 7 7
8 0 2
1
72 73 74 8 8
9 10 =
1
true
75 9 1 = 10
76
77
78
79
80
81 jshell> run( ( ) -> InfiniteList .generate( ( )
-> 2) .takeWhi1e(1essThan0)) ;
82
83 jshell> run( ( ) -> InfiniteList . iterate(1
incr) . takeWhi1e(1essThan0) ) ;
84 jshell> run( ( ) -> InfiniteList . iterate(1 , incr) . takeWhi1e(1essThan0) . head( ) ) ;
85 false
86
j ava . util . NoSuchE1ementException $ null
88 jshell> run( ( ) -> InfiniteList . iterate(1 , incr) . takeWhi1e(1essThan2) . head( ) ) ;
89true
90
91 jshell> run( ( ) -> InfiniteList . iterate(1 incr) . takeWhi1e(1essThan2)
92. tail( ) . head( ) ) ;
93true
94 1 + 1 = 2
95 false
96
j ava . util . NoSuchE1ementException $ null
98 jshell> run( ( ) -> InfiniteList . iterate(1 , incr) . takeWhi1e(1essThan2)
99. takeWhi1e(1essThan0) . head( ) ) ;
100true
101 – false
102 j ava . util . NoSuchE1ementException
103 $ null
104 jshell> run( ( ) -> InfiniteList . iterate(1 , incr) .takeWhi1e(1essThan0)
105 . takeWhi1e(1essThan2) . head( ) ) ;
106 1 < 0 = false
107 j ava . util . NoSuchE1ementException
108 $ null
109 jshell> run( ( ) -> InfiniteList . iterate(1 , incr) .takeWhi1e(1essThan5)
110. takeWhi1e(1essThan2) . tail( ) . head( ) ) ;
11 1true
112true
113 1 + 1 = 2
2 < 5 = true
11 5 false
11 6 java . util . NoSuchE1ementException
117 $ null
11 8 jshell> run( ( ) -> InfiniteList . iterate(1 , incr) . filter(isEven)
11 9. takeWhi1e(1essThan10) . head( ) ) ;
1201
121
122 2
123 2 10 = true
124
125 jshell> run( ( ) -> InfiniteList . iterate(1 , incr) . filter(isEven)
126 takeWhi1e(1essThan10) . tail( ) . head( ) ) ;
127
128
129
130true
131
132
133
134
135true
136
137
138 jshell> InfiniteList<Integer> list = InfiniteList . iterate(1 , incr)
139 . takeWhi1e( less Than 1 0)
140 list
141 jshell> list . tail( ) . tail( ) . head( )
142 1 < 10 = true
143 1 + 1 = 2
144 2 < 10 = true
145 2 + 1 = 3
146true
147
148 jshell> list . head( )
149
150 jshell> list
151 list
152 jshell> list . tail( ) . head( )
153
154 jshell> list . tail( ) . tail( ) . tail( ) . head( )
155 3 + 1 = 4
156 4 < 10 = true
157
158 jshell> list 159 list
reduce and count
Finally, we are going to implement the terminal operations: count and reduce . To imitate java . util . stream. Stream , the count method should return a long .
Note: In Java, any integral value with suffix L is treated as a long value. For instance, 123 has the type int , but 123L has the type long .
j shell> import cs2030s.fp .InfiniteList ;
2
3 j shell> InfiniteList . <Integer>end( ) . reduce(0, (x, y) x + Y)
4
5 j shell> InfiniteList . iterate(0, x -> x + 1 ) . limit (5) . reduce(0, (x, y)
6 10
7 j shell> InfiniteList . iterate(0, x -> x + 1 ) . limit (0) . reduce(0, (x, y)
8
9 j shell> InfiniteList . iterate(1 , x -> x + 1 ) . map(x -> x * x)
10 . limit (5) . reduce(l ,
11 14400
12
13 j shell> InfiniteList . <lnteger>end( ) . count( )
14
15 j shell> InfiniteList . iterate(0, x -> x + 1 ) . limit (0) . count( )
16
17 j shell> InfiniteList . iterate(0, x -> x + 1 ) . limit(l ) .count( )
18
19
20 j shell> InfiniteList . iterate(0, x -> x + 1 ) . filte r (x -> x % 2 –
21 . limit (10) . count( )
22 10
23 j shell> InfiniteList . iterate(0, x x + 1 ) . limit ( 1 0)
24 . filter (x == 1 ) . count( )
25 5
26 j shell> InfiniteList . iterate(0, x -> x + 1 ) .takeWhi1e(x x < 10)
27 . count( )
28 10
29 j shell> InfiniteList . iterate(0, x x + 1 ) .takeWhi1e(x
30 . filter (x = 0) . count( )
31 5
You can test your code by running the Test6 . java provided. The following should compile without errors or warnings. Make sure your code follows the CS2030S Java style and can generate the documentation without error.
$ javac -X lint : rawtypes cs2030s/fp/*java
2 $ javac -Xlint : rawtypes Test6 . java
3 $ java Test6
4 $ java -jar æ cs2030s/bin/checksty1e. jar -c æcs2030s/bin/cs2030_checks.xm1 cs2030s/fp 5 / InfiniteList . java
$ javadoc -quiet -private -d docs InfiniteList . java
Following CS2030S Style Guide
You should make sure that your code follows the given Java style guide.
Grading
This lab is worth 24 marks and contributes 6% to your final grade. The marking scheme is as follows:
• Documentation: 2 marks
• Everything Else: 22 marks
We will deduct 1 mark for each unnecessary use of @SuppressWarnings and each raw type.
@SuppressWarnings should be used appropriately and not abused to remove compilation warnings.
Note that general style marks are no longer awarded will only be awarded for documentation. You should know how to follow the prescribed Java style by now. We will still deduct up to 2 marks if there are serious violations of styles. In other words, if you have no documentation and serious violation of styles, you will get deducted 4 marks.
Submission
Similar to Lab 7, submit the files inside the directory cs2030s/fp along with the other file without the need for folder. Your cs2030s/fp should only contain the following files:
• Action . java
• Actionable . java
• Actually . java
• Combiner . java
• Constant . java
• Immutator . java
• Immutatorable . java
• Memo . java
• InfiniteList . java
Additionally, you must submit the file Lab8.h and Lab8 . java . Otherwise, you CodeCrunch submission will not run.
Reviews
There are no reviews yet.