Skip to content

Commit

Permalink
More cleanup + spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
bladecoder committed Sep 19, 2023
1 parent 3baa36b commit dd0e1ab
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 23 deletions.
1 change: 0 additions & 1 deletion src/main/java/com/bladecoder/ink/runtime/CallStack.java
Expand Up @@ -2,7 +2,6 @@

import com.bladecoder.ink.runtime.SimpleJson.InnerWriter;
import com.bladecoder.ink.runtime.SimpleJson.Writer;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/bladecoder/ink/runtime/Container.java
@@ -1,7 +1,6 @@
package com.bladecoder.ink.runtime;

import com.bladecoder.ink.runtime.Path.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -202,11 +201,11 @@ private RTObject contentWithPathComponent(Path.Component component) {
}
}

public SearchResult contentAtPath(Path path) throws Exception {
public SearchResult contentAtPath(Path path) {
return contentAtPath(path, 0, -1);
}

public SearchResult contentAtPath(Path path, int partialPathStart, int partialPathLength) throws Exception {
public SearchResult contentAtPath(Path path, int partialPathStart, int partialPathLength) {
if (partialPathLength == -1) partialPathLength = path.getLength();

SearchResult result = new SearchResult();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/bladecoder/ink/runtime/Json.java
@@ -1,7 +1,6 @@
package com.bladecoder.ink.runtime;

import com.bladecoder.ink.runtime.ControlCommand.CommandType;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/bladecoder/ink/runtime/RTObject.java
@@ -1,7 +1,6 @@
package com.bladecoder.ink.runtime;

import com.bladecoder.ink.runtime.Path.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/bladecoder/ink/runtime/Story.java
Expand Up @@ -3,7 +3,6 @@
import com.bladecoder.ink.runtime.Error.ErrorType;
import com.bladecoder.ink.runtime.SimpleJson.InnerWriter;
import com.bladecoder.ink.runtime.SimpleJson.Writer;

import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -2667,9 +2666,7 @@ void visitChangedContainersDueToDivert() throws Exception {
// Invalid pointer? May happen if attemptingto
if (currentChildOfContainer == null) return;

Container currentContainerAncestor = currentChildOfContainer.getParent() instanceof Container
? (Container) currentChildOfContainer.getParent()
: null;
Container currentContainerAncestor = currentChildOfContainer.getParent();

boolean allChildrenEnteredAtStart = true;
while (currentContainerAncestor != null
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bladecoder/ink/runtime/StoryState.java
Expand Up @@ -3,7 +3,6 @@
import com.bladecoder.ink.runtime.CallStack.Element;
import com.bladecoder.ink.runtime.SimpleJson.InnerWriter;
import com.bladecoder.ink.runtime.SimpleJson.Writer;

import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -580,6 +579,7 @@ RTObject peekEvaluationStack() {
RTObject popEvaluationStack() {
RTObject obj = evaluationStack.get(evaluationStack.size() - 1);
evaluationStack.remove(evaluationStack.size() - 1);

return obj;
}

Expand Down
@@ -1,11 +1,10 @@
package com.bladecoder.ink.runtime.test;

import com.bladecoder.ink.runtime.Story;
import org.junit.Assert;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;

public class BasicTextSpecTest {

Expand Down Expand Up @@ -34,8 +33,6 @@ public void twolines() throws Exception {
String json = TestUtils.getJsonString("inkfiles/basictext/twolines.ink.json");
Story story = new Story(json);

System.out.println(story.buildStringOfHierarchy());

TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("Line.", text.get(0));
Expand Down
13 changes: 6 additions & 7 deletions src/test/java/com/bladecoder/ink/runtime/test/TestUtils.java
@@ -1,21 +1,20 @@
package com.bladecoder.ink.runtime.test;

import static org.junit.Assert.fail;

import com.bladecoder.ink.runtime.Choice;
import com.bladecoder.ink.runtime.Story;
import com.bladecoder.ink.runtime.StoryException;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.fail;

public class TestUtils {

public static final String getJsonString(String filename) throws IOException {
public static String getJsonString(String filename) throws IOException {

InputStream systemResourceAsStream = ClassLoader.getSystemResourceAsStream(filename);

Expand All @@ -39,7 +38,7 @@ public static final String getJsonString(String filename) throws IOException {
}
}

public static final List<String> runStory(String filename, List<Integer> choiceList, List<String> errors)
public static List<String> runStory(String filename, List<Integer> choiceList, List<String> errors)
throws Exception {
// 1) Load story
String json = getJsonString(filename);
Expand Down Expand Up @@ -90,7 +89,7 @@ public static final List<String> runStory(String filename, List<Integer> choiceL
return text;
}

public static final String joinText(List<String> text) {
public static String joinText(List<String> text) {
StringBuilder sb = new StringBuilder();

for (String s : text) {
Expand All @@ -101,7 +100,7 @@ public static final String joinText(List<String> text) {
}

public static boolean isEnded(Story story) {
return !story.canContinue() && story.getCurrentChoices().size() == 0;
return !story.canContinue() && story.getCurrentChoices().isEmpty();
}

public static void nextAll(Story story, List<String> text) throws StoryException, Exception {
Expand Down

0 comments on commit dd0e1ab

Please sign in to comment.