Skip to content

Commit

Permalink
Update dependencies, JDK 21, workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Nov 21, 2023
1 parent f6763cb commit 4b7b369
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.linux.temurin.current.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: JDK
uses: actions/setup-java@v3
with:
java-version: 20
java-version: 21
distribution: 'temurin'
- name: Build
run: mvn --errors clean verify site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.linux.temurin.lts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: JDK
uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
distribution: 'temurin'
- name: Build
run: mvn --errors clean verify site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.windows.temurin.current.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: JDK
uses: actions/setup-java@v3
with:
java-version: 20
java-version: 21
distribution: 'temurin'
- name: Build
run: mvn --errors clean verify site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.windows.temurin.lts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: JDK
uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
distribution: 'temurin'
- name: Build
run: mvn --errors clean verify site
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.io7m.jsycamore.api.events;

import com.io7m.jsycamore.api.keyboard.SyKeyEventType;
import com.io7m.jsycamore.api.menus.SyMenuEventType;
import com.io7m.jsycamore.api.mouse.SyMouseEventType;
import com.io7m.jsycamore.api.windows.SyWindowEventType;
Expand All @@ -25,7 +26,7 @@
*/

public sealed interface SyEventType
permits com.io7m.jsycamore.api.keyboard.SyKeyEventType,
permits SyKeyEventType,
SyMenuEventType,
SyMouseEventType,
SyWindowEventType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import com.io7m.jsycamore.api.rendering.SyPaintGradientLinear;
import com.io7m.jsycamore.api.rendering.SyRenderNodeComposite;
import com.io7m.jsycamore.api.rendering.SyRenderNodeImage;
import com.io7m.jsycamore.api.rendering.SyRenderNodeNoop;
import com.io7m.jsycamore.api.rendering.SyRenderNodeShape;
import com.io7m.jsycamore.api.rendering.SyRenderNodeText;
import com.io7m.jsycamore.api.rendering.SyRenderNodeType;
import com.io7m.jsycamore.api.rendering.SyShapeComposite;
import com.io7m.jsycamore.api.rendering.SyShapePolygon;
import com.io7m.jsycamore.api.rendering.SyShapeRectangle;
import com.io7m.jsycamore.api.spaces.SySpaceComponentRelativeType;
Expand All @@ -36,7 +38,7 @@
import com.io7m.jsycamore.api.text.SyFontDirectoryType;
import com.io7m.jsycamore.api.text.SyFontException;
import com.io7m.jtensors.core.parameterized.vectors.PVector4D;
import com.io7m.junreachable.UnreachableCodeException;
import com.io7m.junreachable.UnimplementedCodeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -148,15 +150,14 @@ private static <T extends SySpaceType> Paint fillToPaint(
final PAreaI<T> boundingArea,
final SyPaintFillType fillPaint)
{
if (fillPaint instanceof SyPaintFlat flat) {
return fillToPaintFlat(flat);
}

if (fillPaint instanceof SyPaintGradientLinear linear) {
return fillToPaintGradientLinear(boundingArea, linear);
}

throw new UnreachableCodeException();
return switch (fillPaint) {
case final SyPaintFlat flat -> {
yield fillToPaintFlat(flat);
}
case final SyPaintGradientLinear linear -> {
yield fillToPaintGradientLinear(boundingArea, linear);
}
};
}

private static Color toColor4(
Expand Down Expand Up @@ -213,11 +214,14 @@ private static <T extends SySpaceType> Paint edgeToPaint(
final PAreaI<T> boundingArea,
final SyPaintEdgeType edgePaint)
{
if (edgePaint instanceof SyPaintFlat flat) {
return edgeToPaintFlat(flat);
}

throw new UnreachableCodeException();
return switch (edgePaint) {
case final SyPaintFlat flat -> {
yield edgeToPaintFlat(flat);
}
case final SyPaintGradientLinear linear -> {
throw new UnimplementedCodeException();
}
};
}

private static Paint edgeToPaintFlat(
Expand Down Expand Up @@ -276,13 +280,16 @@ private static void renderNodeShape(
final Graphics2D g,
final SyRenderNodeShape shape)
{
if (shape.shape() instanceof SyShapeRectangle<SySpaceComponentRelativeType> rectangle) {
renderShapeRectangle(g, shape.edgePaint(), shape.fillPaint(), rectangle);
return;
}
if (shape.shape() instanceof SyShapePolygon<SySpaceComponentRelativeType> polygon) {
renderShapePolygon(g, shape.edgePaint(), shape.fillPaint(), polygon);
return;
switch (shape.shape()) {
case final SyShapeRectangle<SySpaceComponentRelativeType> r -> {
renderShapeRectangle(g, shape.edgePaint(), shape.fillPaint(), r);
}
case final SyShapePolygon<SySpaceComponentRelativeType> p -> {
renderShapePolygon(g, shape.edgePaint(), shape.fillPaint(), p);
}
case final SyShapeComposite<?> c -> {

}
}
}

Expand Down Expand Up @@ -322,23 +329,24 @@ public void renderNode(
final SyRenderNodeType renderNode)
{
try {
if (renderNode instanceof SyRenderNodeShape shape) {
renderNodeShape(graphics2D, shape);
return;
}
if (renderNode instanceof SyRenderNodeText text) {
renderNodeText(graphics2D, this.fontDirectory, text);
return;
}
if (renderNode instanceof SyRenderNodeImage image) {
this.renderNodeImage(graphics2D, image);
return;
}
if (renderNode instanceof SyRenderNodeComposite composite) {
for (final var node : composite.nodes()) {
this.renderNode(graphics2D, node);
switch (renderNode) {
case final SyRenderNodeShape shape -> {
renderNodeShape(graphics2D, shape);
}
case final SyRenderNodeText text -> {
this.renderNodeText(graphics2D, this.fontDirectory, text);
}
case final SyRenderNodeImage image -> {
this.renderNodeImage(graphics2D, image);
}
case final SyRenderNodeComposite composite -> {
for (final var node : composite.nodes()) {
this.renderNode(graphics2D, node);
}
}
case final SyRenderNodeNoop noOp -> {

}
return;
}
} finally {
if (this.debugBounds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,47 +447,43 @@ private void evaluate()
while (iterator.hasNext()) {
final var node = iterator.next();

if (node instanceof SyValueFunctionInteger functionNode) {
functionNode.evaluate(
Optional.ofNullable(this.nodes.get(functionNode.source()))
.orElseThrow(UnreachableCodeException::new)
);
continue;
}

if (node instanceof SyValueFunctionDouble functionNode) {
functionNode.evaluate(
Optional.ofNullable(this.nodes.get(functionNode.source()))
.orElseThrow(UnreachableCodeException::new)
);
continue;
}

if (node instanceof SyValueFunctionFont functionNode) {
functionNode.evaluate(
Optional.ofNullable(this.nodes.get(functionNode.source()))
.orElseThrow(UnreachableCodeException::new)
);
continue;
}

if (node instanceof SyValueFunctionColor4D functionNode) {
functionNode.evaluate(
Optional.ofNullable(this.nodes.get(functionNode.source()))
.orElseThrow(UnreachableCodeException::new)
);
continue;
}

if (node instanceof SyConstantType) {
continue;
switch (node) {
case final SyValueFunctionInteger functionNode -> {
functionNode.evaluate(
Optional.ofNullable(this.nodes.get(functionNode.source()))
.orElseThrow(UnreachableCodeException::new)
);
continue;
}
case final SyValueFunctionDouble functionNode -> {
functionNode.evaluate(
Optional.ofNullable(this.nodes.get(functionNode.source()))
.orElseThrow(UnreachableCodeException::new)
);
continue;
}
case final SyValueFunctionFont functionNode -> {
functionNode.evaluate(
Optional.ofNullable(this.nodes.get(functionNode.source()))
.orElseThrow(UnreachableCodeException::new)
);
continue;
}
case final SyValueFunctionColor4D functionNode -> {
functionNode.evaluate(
Optional.ofNullable(this.nodes.get(functionNode.source()))
.orElseThrow(UnreachableCodeException::new)
);
continue;
}
case final SyConstantType syConstantType -> {
continue;
}
}

throw new UnreachableCodeException();
}
}

private static record ValueEdge(
private record ValueEdge(
SyValueNodeType source,
SyValueNodeType target)
{
Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.io7m.primogenitor</groupId>
<artifactId>com.io7m.primogenitor</artifactId>
<version>7.5.0</version>
<version>8.1.0</version>
</parent>

<groupId>com.io7m.jsycamore</groupId>
Expand All @@ -36,11 +36,11 @@

<properties>
<io7m.api.previousVersion>0.1.0</io7m.api.previousVersion>
<io7m.org.immutables.value.version>2.9.3</io7m.org.immutables.value.version>
<javafx.version>20.0.1</javafx.version>
<jqwik.version>1.7.3</jqwik.version>
<junit.version>5.9.3</junit.version>
<mockito.version>5.3.1</mockito.version>
<io7m.org.immutables.value.version>2.10.0</io7m.org.immutables.value.version>
<javafx.version>21.0.1</javafx.version>
<jqwik.version>1.8.1</jqwik.version>
<junit.version>5.10.0</junit.version>
<mockito.version>5.6.0</mockito.version>
</properties>

<licenses>
Expand Down Expand Up @@ -171,12 +171,12 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.7</version>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>net.java.dev.designgridlayout</groupId>
Expand All @@ -191,7 +191,7 @@
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.1.6</version>
<version>3.1.8</version>
<exclusions>
<exclusion>
<groupId>com.google.errorprone</groupId>
Expand Down

0 comments on commit 4b7b369

Please sign in to comment.