FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Reformat all code with spotless · bladecoder/blade-ink-java@9344cdc · GitHub

Commit 9344cdc

Browse files
committed
Reformat all code with spotless
1 parent ddde5af commit 9344cdc

66 files changed

Lines changed: 8954 additions & 9307 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/gradle-build-push.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Run Gradle build on push
22

3-
on: [push]
3+
on: [ push ]
44

55
jobs:
66
build:
@@ -23,6 +23,8 @@ jobs:
2323
${{ runner.os }}-gradle-
2424
- name: Build with Gradle
2525
run: ./gradlew build
26+
- name: Pass tests and checks
27+
run: ./gradlew check
2628
- name: Cleanup Gradle Cache
2729
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
2830
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
package com.bladecoder.ink.runtime;
2-
3-
public abstract class AbstractValue extends RTObject {
4-
public abstract ValueType getValueType();
5-
6-
public abstract boolean isTruthy() throws Exception;
7-
8-
public abstract AbstractValue cast(ValueType newType) throws Exception;
9-
10-
public abstract Object getValueObject();
11-
12-
public static AbstractValue create(Object val) {
13-
// Implicitly lose precision from any doubles we get passed in
14-
if (val instanceof Double) {
15-
double doub = (Double) val;
16-
val = (float) doub;
17-
}
18-
19-
if (val instanceof Boolean) {
20-
return new BoolValue((Boolean) val);
21-
} else if (val instanceof Integer) {
22-
return new IntValue((Integer) val);
23-
} else if (val instanceof Long) {
24-
return new IntValue(((Long) val).intValue());
25-
} else if (val instanceof Float) {
26-
return new FloatValue((Float) val);
27-
} else if (val instanceof Double) {
28-
return new FloatValue((((Double) val).floatValue()));
29-
} else if (val instanceof String) {
30-
return new StringValue((String) val);
31-
} else if (val instanceof Path) {
32-
return new DivertTargetValue((Path) val);
33-
} else if (val instanceof InkList) {
34-
return new ListValue((InkList) val);
35-
}
36-
37-
return null;
38-
}
39-
40-
@Override
41-
RTObject copy() {
42-
return create(getValueObject());
43-
}
44-
45-
protected StoryException BadCastException(ValueType targetType) throws Exception {
46-
return new StoryException(
47-
"Can't cast " + this.getValueObject() + " from " + this.getValueType() + " to " + targetType);
48-
}
49-
}
1+
package com.bladecoder.ink.runtime;
2+
3+
public abstract class AbstractValue extends RTObject {
4+
public abstract ValueType getValueType();
5+
6+
public abstract boolean isTruthy() throws Exception;
7+
8+
public abstract AbstractValue cast(ValueType newType) throws Exception;
9+
10+
public abstract Object getValueObject();
11+
12+
public static AbstractValue create(Object val) {
13+
// Implicitly lose precision from any doubles we get passed in
14+
if (val instanceof Double) {
15+
double doub = (Double) val;
16+
val = (float) doub;
17+
}
18+
19+
if (val instanceof Boolean) {
20+
return new BoolValue((Boolean) val);
21+
} else if (val instanceof Integer) {
22+
return new IntValue((Integer) val);
23+
} else if (val instanceof Long) {
24+
return new IntValue(((Long) val).intValue());
25+
} else if (val instanceof Float) {
26+
return new FloatValue((Float) val);
27+
} else if (val instanceof Double) {
28+
return new FloatValue((((Double) val).floatValue()));
29+
} else if (val instanceof String) {
30+
return new StringValue((String) val);
31+
} else if (val instanceof Path) {
32+
return new DivertTargetValue((Path) val);
33+
} else if (val instanceof InkList) {
34+
return new ListValue((InkList) val);
35+
}
36+
37+
return null;
38+
}
39+
40+
@Override
41+
RTObject copy() {
42+
return create(getValueObject());
43+
}
44+
45+
protected StoryException BadCastException(ValueType targetType) throws Exception {
46+
return new StoryException(
47+
"Can't cast " + this.getValueObject() + " from " + this.getValueType() + " to " + targetType);
48+
}
49+
}
Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
package com.bladecoder.ink.runtime;
22

33
class BoolValue extends Value<Boolean> {
4-
public BoolValue() {
5-
this(false);
6-
}
7-
8-
public BoolValue(boolean boolVal) {
9-
super(boolVal);
10-
}
11-
12-
@Override
13-
public AbstractValue cast(ValueType newType) throws Exception {
14-
if (newType == getValueType()) {
15-
return this;
16-
}
17-
18-
if (newType == ValueType.Int) {
19-
return new IntValue(value ? 1 : 0);
20-
}
21-
22-
if (newType == ValueType.Float) {
23-
return new FloatValue(value ? 1f : 0f);
24-
}
25-
26-
if (newType == ValueType.String) {
27-
return new StringValue(value.toString());
28-
}
29-
30-
throw BadCastException(newType);
31-
}
32-
33-
@Override
34-
public boolean isTruthy() {
35-
return value;
36-
}
37-
38-
@Override
39-
public ValueType getValueType() {
40-
return ValueType.Bool;
41-
}
42-
4+
public BoolValue() {
5+
this(false);
6+
}
7+
8+
public BoolValue(boolean boolVal) {
9+
super(boolVal);
10+
}
11+
12+
@Override
13+
public AbstractValue cast(ValueType newType) throws Exception {
14+
if (newType == getValueType()) {
15+
return this;
16+
}
17+
18+
if (newType == ValueType.Int) {
19+
return new IntValue(value ? 1 : 0);
20+
}
21+
22+
if (newType == ValueType.Float) {
23+
return new FloatValue(value ? 1f : 0f);
24+
}
25+
26+
if (newType == ValueType.String) {
27+
return new StringValue(value.toString());
28+
}
29+
30+
throw BadCastException(newType);
31+
}
32+
33+
@Override
34+
public boolean isTruthy() {
35+
return value;
36+
}
37+
38+
@Override
39+
public ValueType getValueType() {
40+
return ValueType.Bool;
41+
}
4342
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL