-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from PRL-PRG/server-init
scaffold for server to send and receive messages minor changes and fixes R script tests
- Loading branch information
Showing
52 changed files
with
1,649 additions
and
84 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,3 +1,6 @@ | ||
.snapshots/**/*.fail* | ||
|
||
### Build ### | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.prlprg; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Major.Minor.Patch version number with an optional suffix for things like "Beta" and "RC". | ||
* | ||
* <p>This class needs to support whatever format GNU-R versions can have. But it's not a GNU-R | ||
* specific | ||
*/ | ||
public record RVersion(int major, int minor, int patch, @Nullable String suffix) { | ||
/** The latest version we handle. */ | ||
public static final RVersion LATEST_AWARE = new RVersion(4, 3, 2); | ||
|
||
public static RVersion parse(String textual) { | ||
var parts = textual.split("\\."); | ||
|
||
int major; | ||
int minor; | ||
int patch; | ||
try { | ||
major = Integer.parseInt(parts[0]); | ||
minor = Integer.parseInt(parts[1]); | ||
patch = Integer.parseInt(parts[2]); | ||
} catch (ArrayIndexOutOfBoundsException e) { | ||
throw new IllegalArgumentException("Invalid version number: " + textual, e); | ||
} | ||
|
||
String suffix; | ||
if (parts.length > 3) { | ||
if (parts[3].startsWith("-")) { | ||
suffix = parts[3].substring(1); | ||
} else { | ||
throw new IllegalArgumentException( | ||
"Invalid version number: " + textual + " (suffix must start with '-')"); | ||
} | ||
} else { | ||
suffix = null; | ||
} | ||
|
||
return new RVersion(major, minor, patch, suffix); | ||
} | ||
|
||
RVersion(int major, int minor, int patch) { | ||
this(major, minor, patch, null); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return major + "." + minor + "." + patch + (suffix == null ? "" : "-" + suffix); | ||
} | ||
} |
This file contains 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
Oops, something went wrong.