-
Notifications
You must be signed in to change notification settings - Fork 11
Updated files, pull request contains my implementation and test cases #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ElCapitanHaddock
wants to merge
2
commits into
main
Choose a base branch
from
Judy_Yang_CodeReview
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,28 @@ | ||
| .DS_Store | ||
| # Compiled class file | ||
| *.class | ||
|
|
||
| # Log file | ||
| *.log | ||
|
|
||
| # BlueJ files | ||
| *.ctxt | ||
|
|
||
| # Mobile Tools for Java (J2ME) | ||
| .mtj.tmp/ | ||
|
|
||
| # Package Files # | ||
| *.jar | ||
| *.war | ||
| *.nar | ||
| *.ear | ||
| *.zip | ||
| *.tar.gz | ||
| *.rar | ||
|
|
||
| # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
| hs_err_pid* | ||
|
|
||
| .idea | ||
| *.iml | ||
| .DS_Store | ||
| # Compiled class file | ||
| *.class | ||
| # Log file | ||
| *.log | ||
| # BlueJ files | ||
| *.ctxt | ||
| # Mobile Tools for Java (J2ME) | ||
| .mtj.tmp/ | ||
| # Package Files # | ||
| *.jar | ||
| *.war | ||
| *.nar | ||
| *.ear | ||
| *.zip | ||
| *.tar.gz | ||
| *.rar | ||
| # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
| hs_err_pid* | ||
| .idea | ||
| *.iml | ||
| target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| language: java | ||
| jdk: openjdk17 | ||
| jobs: | ||
| include: | ||
| - script: mvn clean verify package | ||
| after_success: | ||
| language: java | ||
| jdk: openjdk17 | ||
| jobs: | ||
| include: | ||
| - script: mvn clean verify package | ||
| after_success: | ||
| - bash <(curl -s https://codecov.io/bash) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,32 @@ | ||
| [](https://app.travis-ci.com/sarafarag/Spring22CodeReviewActivity) | ||
|
|
||
| @BCComputerScience | ||
|
|
||
| # Spr23-5540-CodeReviewActivity | ||
|
|
||
| ## Task 1: Open a Pull request | ||
| 1. **Clone/Fork** this repository that contains the unit test assignmentSkeleton from here. You should have access now, because you can see this ReadMe file. | ||
| 2. If Cloned, create a branch to the local repository named "First_lastName_CodeReview" | ||
| 3. Update the skeleton project with your final project implementation from Assignment two | ||
| 4. Don't change the pom.xml or the .travis.yml file | ||
| 5. Commit your changes to the **local repository** | ||
| 6. Push your local barnch to the remote | ||
| 7. Complete a pull request for the updates | ||
|
|
||
|
|
||
| ### Warning: You have to complete Task 1 to be appointed as a reviewer for a pull request and start Task 2 | ||
|
|
||
| ## Task 2: Code review for the assigned pull request | ||
| 1. You will be assigned to a students' submission to complete the code review for their project implementation. | ||
| 2. You need to complete the code reviews for the pull request assigned to you. | ||
| 3. Check the build for the assigned code and note if there is any errors | ||
| 4. If there is a build issue indiacte it in your review comments | ||
| 5. Also, add at least four meaningful inline reviews of the class implementation, the test class, and one overall recap. Agreeing on the implementation is not counted as a meaningful review. | ||
| Approve or request changes to the pull request | ||
| 6. Take screenshots for your reviews. | ||
|
|
||
| ### Check Canvas for more instructions on how to ccomplete each task | ||
|
|
||
| Enjoy your code review experience. | ||
|
|
||
| Sara | ||
| [](https://app.travis-ci.com/sarafarag/Spring22CodeReviewActivity) | ||
| @BCComputerScience | ||
| # Spr23-5540-CodeReviewActivity | ||
| ## Task 1: Open a Pull request | ||
| 1. **Clone/Fork** this repository that contains the unit test assignmentSkeleton from here. You should have access now, because you can see this ReadMe file. | ||
| 2. If Cloned, create a branch to the local repository named "First_lastName_CodeReview" | ||
| 3. Update the skeleton project with your final project implementation from Assignment two | ||
| 4. Don't change the pom.xml or the .travis.yml file | ||
| 5. Commit your changes to the **local repository** | ||
| 6. Push your local barnch to the remote | ||
| 7. Complete a pull request for the updates | ||
| ### Warning: You have to complete Task 1 to be appointed as a reviewer for a pull request and start Task 2 | ||
| ## Task 2: Code review for the assigned pull request | ||
| 1. You will be assigned to a students' submission to complete the code review for their project implementation. | ||
| 2. You need to complete the code reviews for the pull request assigned to you. | ||
| 3. Check the build for the assigned code and note if there is any errors | ||
| 4. If there is a build issue indiacte it in your review comments | ||
| 5. Also, add at least four meaningful inline reviews of the class implementation, the test class, and one overall recap. Agreeing on the implementation is not counted as a meaningful review. | ||
| Approve or request changes to the pull request | ||
| 6. Take screenshots for your reviews. | ||
| ### Check Canvas for more instructions on how to ccomplete each task | ||
| Enjoy your code review experience. | ||
| Sara |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,77 +1,77 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>org.example</groupId> | ||
| <artifactId>UnitTestAssignment</artifactId> | ||
| <version>1.0-SNAPSHOT</version> | ||
|
|
||
| <properties> | ||
| <maven.compiler.source>15</maven.compiler.source> | ||
| <maven.compiler.target>15</maven.compiler.target> | ||
| </properties> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-api</artifactId> | ||
| <version>5.7.2</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.hamcrest</groupId> | ||
| <artifactId>hamcrest-library</artifactId> | ||
| <version>2.2</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <version>3.0.0-M5</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.jacoco</groupId> | ||
| <artifactId>jacoco-maven-plugin</artifactId> | ||
| <version>0.8.7</version> | ||
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>prepare-agent</goal> | ||
| </goals> | ||
| </execution> | ||
| <execution> | ||
| <id>report</id> | ||
| <phase>test</phase> | ||
| <goals> | ||
| <goal>report</goal> | ||
| </goals> | ||
| </execution> | ||
| <execution> | ||
| <id>jacoco-check</id> | ||
| <goals> | ||
| <goal>check</goal> | ||
| </goals> | ||
| <configuration> | ||
| <rules> | ||
| <rule> | ||
| <element>PACKAGE</element> | ||
| <limits> | ||
| <limit> | ||
| <counter>LINE</counter> | ||
| <value>COVEREDRATIO</value> | ||
| <minimum>0.9</minimum> | ||
| </limit> | ||
| </limits> | ||
| </rule> | ||
| </rules> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>org.example</groupId> | ||
| <artifactId>UnitTestAssignment</artifactId> | ||
| <version>1.0-SNAPSHOT</version> | ||
| <properties> | ||
| <maven.compiler.source>15</maven.compiler.source> | ||
| <maven.compiler.target>15</maven.compiler.target> | ||
| </properties> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-api</artifactId> | ||
| <version>5.7.2</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.hamcrest</groupId> | ||
| <artifactId>hamcrest-library</artifactId> | ||
| <version>2.2</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <version>3.0.0-M5</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.jacoco</groupId> | ||
| <artifactId>jacoco-maven-plugin</artifactId> | ||
| <version>0.8.7</version> | ||
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>prepare-agent</goal> | ||
| </goals> | ||
| </execution> | ||
| <execution> | ||
| <id>report</id> | ||
| <phase>test</phase> | ||
| <goals> | ||
| <goal>report</goal> | ||
| </goals> | ||
| </execution> | ||
| <execution> | ||
| <id>jacoco-check</id> | ||
| <goals> | ||
| <goal>check</goal> | ||
| </goals> | ||
| <configuration> | ||
| <rules> | ||
| <rule> | ||
| <element>PACKAGE</element> | ||
| <limits> | ||
| <limit> | ||
| <counter>LINE</counter> | ||
| <value>COVEREDRATIO</value> | ||
| <minimum>0.9</minimum> | ||
| </limit> | ||
| </limits> | ||
| </rule> | ||
| </rules> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,62 @@ | ||
| public class StringManipulation implements StringManipulationInterface { | ||
|
|
||
| @Override | ||
| public String getString() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void setString(String string) { | ||
| } | ||
|
|
||
| @Override | ||
| public int count() { | ||
| return 0; | ||
| } | ||
|
|
||
| @Override | ||
| public String removeNthCharacter(int n, boolean maintainSpacing) { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public String[] getSubStrings(int startWord, int endWord) { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public String restoreString(int[] indices) { | ||
| return null; | ||
| } | ||
|
|
||
|
|
||
| } | ||
| import java.util.Arrays; | ||
|
|
||
| public class StringManipulation implements StringManipulationInterface { | ||
| private String value; | ||
|
|
||
| @Override | ||
| public String getString() { | ||
| return value; | ||
| } | ||
|
|
||
| @Override | ||
| public void setString(String string) { | ||
| value = string; | ||
| } | ||
|
|
||
| @Override | ||
| public int count() { | ||
| if (value.trim() == "") return 0; | ||
| return value.trim().split("\\s+").length; | ||
| } | ||
|
|
||
| @Override | ||
| public String removeNthCharacter(int n, boolean maintainSpacing) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method throws no exceptions at all! |
||
|
|
||
| char[] chars = value.toCharArray(); | ||
| String res = ""; | ||
|
|
||
| for (int i = 0; i < chars.length; i++) { | ||
|
|
||
| if ( (i+1)%n != 0 ) res += chars[i]; | ||
| else if (maintainSpacing) res += " "; | ||
| } | ||
| return res; | ||
| } | ||
|
|
||
| @Override | ||
| public String[] getSubStrings(int startWord, int endWord){ | ||
| String[] words = value.trim().split("\\s+"); | ||
| if (value.trim() == "" || endWord < startWord || startWord > words.length) throw new IllegalArgumentException(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exceptions should come with messages relevant to what occurred. This is apparent in multiple places. |
||
| return Arrays.copyOfRange(value.trim().split("\\s+"), startWord-1, endWord+1); | ||
| } | ||
|
|
||
| @Override | ||
| public String restoreString(int[] indices) { | ||
| if (value == null || indices.length != value.length()) throw new IllegalArgumentException(); | ||
|
|
||
| //output string | ||
| String res = ""; | ||
|
|
||
| //string value to char array | ||
| char[] chars = value.toCharArray(); | ||
|
|
||
| for (int index : indices) { | ||
| if (index >= 0 && index < chars.length) res += chars[index]; | ||
| else throw new ArrayIndexOutOfBoundsException(); | ||
| } | ||
|
|
||
| return res; | ||
| } | ||
|
|
||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result of value.trim().split() is re-used several times in the code, but is calculated every time. It should be cached and regenerated whenever the string is changed.