Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
Java Coursework
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simon Barrett
Java Coursework
Commits
7cbf04d8
Commit
7cbf04d8
authored
3 years ago
by
Simon Barrett
Browse files
Options
Downloads
Patches
Plain Diff
Final Refactor of Module class
parent
cbd02809
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Module.java
+8
-5
8 additions, 5 deletions
src/Module.java
with
8 additions
and
5 deletions
src/Module.java
+
8
−
5
View file @
7cbf04d8
public
class
Module
{
/*
This class holds the lesson objects and enables the user to pick from them. It has been designed so that it
can be replicated and extended to include Courses. This is expanded upon in the ReadMe.
*/
private
Lesson
[]
lessons
;
public
Module
(
Lesson
[]
lessons
)
{
...
...
@@ -10,17 +15,15 @@ public class Module {
/**
* Returns a lesson from the Lesson array depending on User input
* User starts choice at 1 rather than 0 so this needs to be translated to arrays
* User starts choice at 1 rather than 0 so this needs to be translated to arrays
with base 0
* @param choice
* @return
* @return
Lesson object
*/
public
Lesson
getLesson
(
int
choice
)
{
return
lessons
[
choice
-
1
];
}
/* This is only called in one place so rather than a getter and then call .length it
has been combined here for readability.
*/
// Rather than have a getter and then call .length on it, it has been combined here for readability.
public
int
getLessonsArrayLength
()
{
return
lessons
.
length
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment