Rename isAt method to isNext in ImmutableStringReader and StringReader
This commit is contained in:
parent
a048014b3f
commit
11758168ba
3 changed files with 7 additions and 7 deletions
src
main/java/com/mojang/brigadier
test/java/com/mojang/brigadier
|
@ -24,5 +24,5 @@ public interface ImmutableStringReader {
|
|||
|
||||
char peek(int offset);
|
||||
|
||||
boolean isAt(char c);
|
||||
boolean isNext(char c);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class StringReader implements ImmutableStringReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isAt(char c) {
|
||||
public boolean isNext(char c) {
|
||||
return canRead() && peek() == c;
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ public class StringReader implements ImmutableStringReader {
|
|||
}
|
||||
|
||||
public void expect(final char c) throws CommandSyntaxException {
|
||||
if (!isAt(c)) {
|
||||
if (!isNext(c)) {
|
||||
throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.readerExpectedSymbol().createWithContext(this, String.valueOf(c));
|
||||
}
|
||||
skip();
|
||||
|
|
|
@ -589,11 +589,11 @@ public class StringReaderTest {
|
|||
@Test
|
||||
public void isAt() {
|
||||
final StringReader reader = new StringReader("abc");
|
||||
assertThat(reader.isAt('a'), is(true));
|
||||
assertThat(reader.isAt('x'), is(false));
|
||||
assertThat(reader.isNext('a'), is(true));
|
||||
assertThat(reader.isNext('x'), is(false));
|
||||
reader.setCursor(2);
|
||||
assertThat(reader.isAt('c'), is(true));
|
||||
assertThat(reader.isNext('c'), is(true));
|
||||
reader.skip();
|
||||
assertThat(reader.isAt('c'), is(false));
|
||||
assertThat(reader.isNext('c'), is(false));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue