Skip to content

Commit

Permalink
Version 1.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Charpentier authored and Michel Charpentier committed Dec 18, 2023
1 parent 3dddc00 commit b57489e
Show file tree
Hide file tree
Showing 667 changed files with 27,930 additions and 10,727 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: 'sbt'

Expand Down
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.6.0
version = 3.7.17
runner.dialect = scala3

fileOverride {
Expand Down
6 changes: 3 additions & 3 deletions J/src/main/java/tinyscalautils/java/Collection.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public static <A> Iterator<A> circular(Iterable<A> iterable) {
}

public static <A> Iterator<A> randomly(Iterable<A> iterable, Random rand) {
return collection.randomly(iterable,rand);
return collection.randomly(iterable, rand);
}

public static <A> A pickOne(Iterable<A> iterable, Random rand) {
return collection.pickOne(iterable,rand);
return collection.pickOne(iterable, rand);
}

public static <A> Optional<A> pickOneOption(Iterable<A> iterable, Random rand) {
return collection.pickOneOption(iterable,rand);
return collection.pickOneOption(iterable, rand);
}
}
184 changes: 101 additions & 83 deletions J/src/main/java/tinyscalautils/java/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,122 +8,140 @@
* @see tinyscalautils.text
*/
public final class Text {
private Text() {
throw new AssertionError("this class cannot be instantiated");
}

public final static class SILENT_MODE {
private SILENT_MODE() {
throw new AssertionError("this class cannot be instantiated");
private Text() {
throw new AssertionError("this class cannot be instantiated");
}

public static void println(Object arg) {
}
public final static class SILENT_MODE {
private SILENT_MODE() {
throw new AssertionError("this class cannot be instantiated");
}

public static void printf(String format, Object... arg) {
}
}
public static void println(Object ignoredArg) {
}

public final static class STANDARD_MODE {
private STANDARD_MODE() {
throw new AssertionError("this class cannot be instantiated");
public static void printf(String ignoredFormat, Object... ignoredArgs) {
}
}

public static void println(Object arg) {
tinyscalautils.text.StandardMode.print(arg, true);
}
public final static class STANDARD_MODE {
private STANDARD_MODE() {
throw new AssertionError("this class cannot be instantiated");
}

public static void printf(String format, Object... arg) {
tinyscalautils.text.StandardMode.print(String.format(format, arg),false);
}
}
public static void println(Object arg) {
tinyscalautils.text.StandardMode.print(arg, true);
}

public final static class THREAD_MODE {
private THREAD_MODE() {
throw new AssertionError("this class cannot be instantiated");
public static void printf(String format, Object... arg) {
tinyscalautils.text.StandardMode.print(String.format(format, arg), false);
}
}

public static void println(Object arg) {
tinyscalautils.text.ThreadMode.print(arg ,true);
}
public final static class THREAD_MODE {
private THREAD_MODE() {
throw new AssertionError("this class cannot be instantiated");
}

public static void printf(String format, Object... arg) {
tinyscalautils.text.ThreadMode.print(String.format(format, arg),false);
}
}
public static void println(Object arg) {
tinyscalautils.text.ThreadMode.print(arg, true);
}

public final static class THREAD_TIME_DEMO_MODE {
private THREAD_TIME_DEMO_MODE() {
throw new AssertionError("this class cannot be instantiated");
public static void printf(String format, Object... arg) {
tinyscalautils.text.ThreadMode.print(String.format(format, arg), false);
}
}

public static void println(Object arg) {
tinyscalautils.text.ThreadTimeDemoMode.print(arg ,true);
}
public final static class THREAD_TIME_DEMO_MODE {
private THREAD_TIME_DEMO_MODE() {
throw new AssertionError("this class cannot be instantiated");
}

public static void printf(String format, Object... arg) {
tinyscalautils.text.ThreadTimeDemoMode.print(String.format(format, arg),false);
}
}
public static void println(Object arg) {
tinyscalautils.text.ThreadTimeDemoMode.print(arg, true);
}

public final static class THREAD_TIME_MODE {
private THREAD_TIME_MODE() {
throw new AssertionError("this class cannot be instantiated");
public static void printf(String format, Object... arg) {
tinyscalautils.text.ThreadTimeDemoMode.print(String.format(format, arg), false);
}
}

public static void println(Object arg) {
tinyscalautils.text.ThreadTimeMode.print(arg ,true);
}
public final static class THREAD_TIME_MODE {
private THREAD_TIME_MODE() {
throw new AssertionError("this class cannot be instantiated");
}

public static void printf(String format, Object... arg) {
tinyscalautils.text.ThreadTimeMode.print(String.format(format, arg),false);
}
}
public static void println(Object arg) {
tinyscalautils.text.ThreadTimeMode.print(arg, true);
}

public final static class TIME_DEMO_MODE {
private TIME_DEMO_MODE() {
throw new AssertionError("this class cannot be instantiated");
public static void printf(String format, Object... arg) {
tinyscalautils.text.ThreadTimeMode.print(String.format(format, arg), false);
}
}

public static void println(Object arg) {
tinyscalautils.text.TimeDemoMode.print(arg ,true);
}
public final static class TIME_DEMO_MODE {
private TIME_DEMO_MODE() {
throw new AssertionError("this class cannot be instantiated");
}

public static void println(Object arg) {
tinyscalautils.text.TimeDemoMode.print(arg, true);
}

public static void printf(String format, Object... arg) {
tinyscalautils.text.TimeDemoMode.print(String.format(format, arg),false);
public static void printf(String format, Object... arg) {
tinyscalautils.text.TimeDemoMode.print(String.format(format, arg), false);
}
}
}

public final static class TIME_MODE {
private TIME_MODE() {
throw new AssertionError("this class cannot be instantiated");
public final static class TIME_MODE {
private TIME_MODE() {
throw new AssertionError("this class cannot be instantiated");
}

public static void println(Object arg) {
tinyscalautils.text.TimeMode.print(arg, true);
}

public static void printf(String format, Object... arg) {
tinyscalautils.text.TimeMode.print(String.format(format, arg), false);
}
}

public static void println(Object arg) {
tinyscalautils.text.TimeMode.print(arg ,true);
private static final TextScala textScala = new TextScala();

/**
* Note that, contrary to the Scala variant, this method sets {@code includeSystem} to true by default.
*/
public static String printout(Runnable code) {
return printout(false, true, Charset.defaultCharset(), code);
}

public static void printf(String format, Object... arg) {
tinyscalautils.text.TimeMode.print(String.format(format, arg),false);
public static String printout(boolean includeErr, boolean includeSystem, Runnable code) {
return printout(includeErr, includeSystem, Charset.defaultCharset(), code);
}
}

private static final TextScala textScala = new TextScala();
public static String printout(boolean includeErr, boolean includeSystem, Charset charset, Runnable code) {
return textScala.printout(code, includeErr, includeSystem, charset);
}

/** Note that, contrary to the Scala variant, this method sets {@code includeSystem} to true by default. */
public static String printout(Runnable code) {
return printout(false, true, Charset.defaultCharset(), code);
}
public static void info() {
textScala.info();
}

public static String printout(boolean includeErr, boolean includeSystem, Runnable code) {
return printout(includeErr, includeSystem, Charset.defaultCharset(), code);
}
public static String plural(Number x, String singularForm, String pluralForm) {
return textScala.plural(x, singularForm, pluralForm);
}

public static String printout(boolean includeErr, boolean includeSystem, Charset charset, Runnable code) {
return textScala.printout(code, includeErr, includeSystem, charset);
}
public static String plural(Number x, String singularForm) {
return textScala.plural(x, singularForm);
}

public static String timeString(double seconds, int unitsCount) {
return textScala.timeString(seconds, unitsCount);
}

public static void info() {
textScala.info();
}
public static String timeString(double seconds) {
return timeString(seconds, 2);
}
}
9 changes: 9 additions & 0 deletions J/src/main/scala/tinyscalautils/java/TextScala.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ private final class TextScala:
)

def info(): Unit = tinyscalautils.text.info()

def plural(x: Number, singularForm: String, pluralForm: String): String =
tinyscalautils.text.plural(x.doubleValue(), singularForm, pluralForm)

def plural(x: Number, singularForm: String): String =
tinyscalautils.text.plural(x.doubleValue(), singularForm)

def timeString(seconds: Double, unitsCount: Int): String =
tinyscalautils.text.timeString(seconds, unitsCount)
2 changes: 1 addition & 1 deletion J/src/main/scala/tinyscalautils/java/TimingScala.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tinyscalautils.java
import java.util.function.Supplier

private final class TimingScala:

//noinspection AccessorLikeMethodIsEmptyParen
def getTime(): Long = tinyscalautils.timing.getTime()

def now(): Long = tinyscalautils.timing.now()
Expand Down
57 changes: 0 additions & 57 deletions J/src/test/java/PrintingSuite.java

This file was deleted.

Loading

0 comments on commit b57489e

Please sign in to comment.