Reindentation.

parent fd0da69f
......@@ -35,17 +35,15 @@ package org.armedbear.lisp;
import static org.armedbear.lisp.Lisp.*;
public final class StringFunctions
{
public final class StringFunctions {
// ### %string=
// Case sensitive.
private static final Primitive _STRING_EQUAL = new pf__string_equal();
private static final class pf__string_equal extends Primitive {
pf__string_equal()
{
super("%string=", PACKAGE_SYS, false);
}
private static final class pf__string_equal extends Primitive {
pf__string_equal() {
super("%string=", PACKAGE_SYS, false);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third, LispObject fourth,
......@@ -74,8 +72,7 @@ public final class StringFunctions
if (array1[i] != array2[j])
return NIL;
}
}
catch (ArrayIndexOutOfBoundsException e) {
} catch (ArrayIndexOutOfBoundsException e) {
// Shouldn't happen.
Debug.trace(e);
return NIL;
......@@ -87,12 +84,11 @@ public final class StringFunctions
// ### %%string=
// Case sensitive.
private static final Primitive __STRING_EQUAL = new pf___string_equal();
private static final class pf___string_equal extends Primitive {
pf___string_equal()
{
super("%%string=", PACKAGE_SYS, false);
}
private static final class pf___string_equal extends Primitive {
pf___string_equal() {
super("%%string=", PACKAGE_SYS, false);
}
@Override
public LispObject execute(LispObject first, LispObject second)
......@@ -112,15 +108,13 @@ public final class StringFunctions
// ### %string/=
// Case sensitive.
private static final Primitive _STRING_NOT_EQUAL = new pf__string_not_equal();
private static final class pf__string_not_equal extends Primitive {
pf__string_not_equal()
{
super("%string/=", PACKAGE_SYS, true);
}
private static final class pf__string_not_equal extends Primitive {
pf__string_not_equal() {
super("%string/=", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -153,12 +147,11 @@ public final class StringFunctions
// ### %string-equal
// Case insensitive.
private static final Primitive _STRING_EQUAL_IGNORE_CASE = new pf__string_equal_ignore_case();
private static final class pf__string_equal_ignore_case extends Primitive {
pf__string_equal_ignore_case()
{
super("%string-equal", PACKAGE_SYS, true);
}
private static final class pf__string_equal_ignore_case extends Primitive {
pf__string_equal_ignore_case() {
super("%string-equal", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third, LispObject fourth,
......@@ -192,15 +185,13 @@ public final class StringFunctions
// ### %string-not-equal
// Case sensitive.
private static final Primitive _STRING_NOT_EQUAL_IGNORE_CASE = new pf__string_not_equal_ignore_case();
private static final class pf__string_not_equal_ignore_case extends Primitive {
pf__string_not_equal_ignore_case()
{
super("%string-not-equal", PACKAGE_SYS, true);
}
private static final class pf__string_not_equal_ignore_case extends Primitive {
pf__string_not_equal_ignore_case() {
super("%string-not-equal", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -225,9 +216,8 @@ public final class StringFunctions
char c1 = array1[i];
char c2 = array2[j];
if (c1 == c2 ||
LispCharacter.toUpperCase(c1) == LispCharacter.toUpperCase(c2) ||
LispCharacter.toLowerCase(c1) == LispCharacter.toLowerCase(c2))
{
LispCharacter.toUpperCase(c1) == LispCharacter.toUpperCase(c2) ||
LispCharacter.toLowerCase(c1) == LispCharacter.toLowerCase(c2)) {
++i;
++j;
continue;
......@@ -240,15 +230,13 @@ public final class StringFunctions
// ### %string<
// Case sensitive.
private static final Primitive _STRING_LESS_THAN = new pf__string_less_than();
private static final class pf__string_less_than extends Primitive {
pf__string_less_than()
{
super("%string<", PACKAGE_SYS, true);
}
private static final class pf__string_less_than extends Primitive {
pf__string_less_than() {
super("%string<", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -288,15 +276,13 @@ public final class StringFunctions
// ### %string<=
// Case sensitive.
private static final Primitive _STRING_GREATER_THAN = new pf__string_greater_than();
private static final class pf__string_greater_than extends Primitive {
pf__string_greater_than()
{
super("%string>", PACKAGE_SYS, true);
}
private static final class pf__string_greater_than extends Primitive {
pf__string_greater_than() {
super("%string>", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -334,15 +320,13 @@ public final class StringFunctions
// ### %string<=
// Case sensitive.
private static final Primitive _STRING_LE = new pf__string_le();
private static final class pf__string_le extends Primitive {
pf__string_le()
{
super("%string<=", PACKAGE_SYS, true);
}
private static final class pf__string_le extends Primitive {
pf__string_le() {
super("%string<=", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -380,15 +364,13 @@ public final class StringFunctions
// ### %string<=
// Case sensitive.
private static final Primitive _STRING_GE = new pf__string_ge();
private static final class pf__string_ge extends Primitive {
pf__string_ge()
{
super("%string>=", PACKAGE_SYS, true);
}
private static final class pf__string_ge extends Primitive {
pf__string_ge() {
super("%string>=", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -428,15 +410,13 @@ public final class StringFunctions
// ### %string-lessp
// Case insensitive.
private static final Primitive _STRING_LESSP = new pf__string_lessp();
private static final class pf__string_lessp extends Primitive {
pf__string_lessp()
{
super("%string-lessp", PACKAGE_SYS, true);
}
private static final class pf__string_lessp extends Primitive {
pf__string_lessp() {
super("%string-lessp", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -476,15 +456,13 @@ public final class StringFunctions
// ### %string-greaterp
// Case insensitive.
private static final Primitive _STRING_GREATERP = new pf__string_greaterp();
private static final class pf__string_greaterp extends Primitive {
pf__string_greaterp()
{
super("%string-greaterp", PACKAGE_SYS, true);
}
private static final class pf__string_greaterp extends Primitive {
pf__string_greaterp() {
super("%string-greaterp", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -522,15 +500,13 @@ public final class StringFunctions
// ### %string-not-lessp
// Case insensitive.
private static final Primitive _STRING_NOT_LESSP = new pf__string_not_lessp();
private static final class pf__string_not_lessp extends Primitive {
pf__string_not_lessp()
{
super("%string-not-lessp", PACKAGE_SYS, true);
}
private static final class pf__string_not_lessp extends Primitive {
pf__string_not_lessp() {
super("%string-not-lessp", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -570,15 +546,13 @@ public final class StringFunctions
// ### %string-not-greaterp
// Case insensitive.
private static final Primitive _STRING_NOT_GREATERP = new pf__string_not_greaterp();
private static final class pf__string_not_greaterp extends Primitive {
pf__string_not_greaterp()
{
super("%string-not-greaterp", PACKAGE_SYS, true);
}
private static final class pf__string_not_greaterp extends Primitive {
pf__string_not_greaterp() {
super("%string-not-greaterp", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject[] args)
{
public LispObject execute(LispObject[] args) {
if (args.length != 6)
return error(new WrongNumberOfArgumentsException(this));
char[] array1 = args[0].STRING().getStringChars();
......@@ -615,12 +589,11 @@ public final class StringFunctions
// ### %string-upcase
private static final Primitive _STRING_UPCASE = new pf__string_upcase();
private static final class pf__string_upcase extends Primitive {
pf__string_upcase()
{
super("%string-upcase", PACKAGE_SYS, true);
}
private static final class pf__string_upcase extends Primitive {
pf__string_upcase() {
super("%string-upcase", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
......@@ -655,16 +628,14 @@ public final class StringFunctions
// ### %string-downcase
private static final Primitive _STRING_DOWNCASE = new pf__string_downcase();
private static final class pf__string_downcase extends Primitive {
pf__string_downcase()
{
super("%string-downcase", PACKAGE_SYS, true);
}
private static final class pf__string_downcase extends Primitive {
pf__string_downcase() {
super("%string-downcase", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
{
LispObject third) {
LispObject s = first.STRING();
final int length = s.length();
int start = (int) Fixnum.getValue(second);
......@@ -694,12 +665,11 @@ public final class StringFunctions
// ### %string-capitalize
private static final Primitive _STRING_CAPITALIZE = new pf__string_capitalize();
private static final class pf__string_capitalize extends Primitive {
pf__string_capitalize()
{
super("%string-capitalize", PACKAGE_SYS, true);
}
private static final class pf__string_capitalize extends Primitive {
pf__string_capitalize() {
super("%string-capitalize", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
......@@ -746,12 +716,11 @@ public final class StringFunctions
// ### %nstring-upcase
private static final Primitive _NSTRING_UPCASE = new pf__nstring_upcase();
private static final class pf__nstring_upcase extends Primitive {
pf__nstring_upcase()
{
super("%nstring-upcase", PACKAGE_SYS, true);
}
private static final class pf__nstring_upcase extends Primitive {
pf__nstring_upcase() {
super("%nstring-upcase", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
......@@ -779,12 +748,11 @@ public final class StringFunctions
// ### %nstring-downcase
private static final Primitive _NSTRING_DOWNCASE = new pf__nstring_downcase();
private static final class pf__nstring_downcase extends Primitive {
pf__nstring_downcase()
{
super("%nstring-downcase", PACKAGE_SYS, true);
}
private static final class pf__nstring_downcase extends Primitive {
pf__nstring_downcase() {
super("%nstring-downcase", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
......@@ -812,12 +780,11 @@ public final class StringFunctions
// ### %nstring-capitalize
private static final Primitive _NSTRING_CAPITALIZE = new pf__nstring_capitalize();
private static final class pf__nstring_capitalize extends Primitive {
pf__nstring_capitalize()
{
super("%nstring-capitalize", PACKAGE_SYS, true);
}
private static final class pf__nstring_capitalize extends Primitive {
pf__nstring_capitalize() {
super("%nstring-capitalize", PACKAGE_SYS, true);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
......@@ -857,30 +824,26 @@ public final class StringFunctions
// ### stringp
public static final Primitive STRINGP = new pf_stringp();
private static final class pf_stringp extends Primitive {
pf_stringp()
{
super("stringp", "object");
}
private static final class pf_stringp extends Primitive {
pf_stringp() {
super("stringp", "object");
}
@Override
public LispObject execute(LispObject arg)
{
public LispObject execute(LispObject arg) {
return arg.STRINGP();
}
};
// ### simple-string-p
public static final Primitive SIMPLE_STRING_P = new pf_simple_string_p();
private static final class pf_simple_string_p extends Primitive {
pf_simple_string_p()
{
super("simple-string-p", "object");
}
private static final class pf_simple_string_p extends Primitive {
pf_simple_string_p() {
super("simple-string-p", "object");
}
@Override
public LispObject execute(LispObject arg)
{
public LispObject execute(LispObject arg) {
return arg.SIMPLE_STRING_P();
}
};
......@@ -889,12 +852,11 @@ public final class StringFunctions
// %make-string size initial-element element-type => string
// Returns a simple string.
private static final Primitive _MAKE_STRING = new pf__make_string();
private static final class pf__make_string extends Primitive {
pf__make_string()
{
super("%make-string", PACKAGE_SYS, false);
}
private static final class pf__make_string extends Primitive {
pf__make_string() {
super("%make-string", PACKAGE_SYS, false);
}
@Override
public LispObject execute(LispObject size, LispObject initialElement,
LispObject elementType)
......@@ -927,28 +889,26 @@ public final class StringFunctions
// ### char
private static final Primitive CHAR = new pf_char();
private static final class pf_char extends Primitive {
pf_char()
{
super(Symbol.CHAR, "string index");
}
private static final class pf_char extends Primitive {
pf_char() {
super(Symbol.CHAR, "string index");
}
@Override
public LispObject execute(LispObject first, LispObject second)
{
return first.CHAR(Fixnum.getValue(second));
return first.CHAR(Fixnum.getValue(second));
}
};
// ### schar
private static final Primitive SCHAR = new pf_schar();
private static final class pf_schar extends Primitive {
pf_schar()
{
super(Symbol.SCHAR, "string index");
}
private static final class pf_schar extends Primitive {
pf_schar() {
super(Symbol.SCHAR, "string index");
}
@Override
public LispObject execute(LispObject first, LispObject second)
......@@ -959,31 +919,29 @@ public final class StringFunctions
// ### set-char
private static final Primitive SET_CHAR = new pf_set_char();
private static final class pf_set_char extends Primitive {
pf_set_char()
{
super(Symbol.SET_CHAR, "string index character");
}
private static final class pf_set_char extends Primitive {
pf_set_char() {
super(Symbol.SET_CHAR, "string index character");
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
{
checkString(first).setCharAt(Fixnum.getValue(second),
LispCharacter.getValue(third));
LispCharacter.getValue(third));
return third;
}
};
// ### set-schar
private static final Primitive SET_SCHAR = new pf_set_schar();
private static final class pf_set_schar extends Primitive {
pf_set_schar()
{
super(Symbol.SET_SCHAR, "string index character");
}
private static final class pf_set_schar extends Primitive {
pf_set_schar() {
super(Symbol.SET_SCHAR, "string index character");
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
......@@ -1000,12 +958,11 @@ public final class StringFunctions
// ### string-position
private static final Primitive STRING_POSITION = new pf_string_position();
private static final class pf_string_position extends Primitive {
pf_string_position()
{
super("string-position", PACKAGE_EXT, true);
}
private static final class pf_string_position extends Primitive {
pf_string_position() {
super("string-position", PACKAGE_EXT, true);
}
@Override
public LispObject execute(LispObject first, LispObject second,
LispObject third)
......@@ -1024,12 +981,11 @@ public final class StringFunctions
// ### string-find
private static final Primitive STRING_FIND = new pf_string_find();
private static final class pf_string_find extends Primitive {
pf_string_find()
{
super("string-find", PACKAGE_EXT, true, "char string");
}
private static final class pf_string_find extends Primitive {
pf_string_find() {
super("string-find", PACKAGE_EXT, true, "char string");
}
@Override
public LispObject execute(LispObject first, LispObject second)
......@@ -1050,12 +1006,11 @@ public final class StringFunctions
// ### simple-string-search pattern string => position
// Searches string for a substring that matches pattern.
private static final Primitive SIMPLE_STRING_SEARCH = new pf_simple_string_search();
private static final class pf_simple_string_search extends Primitive {
pf_simple_string_search()
{
super("simple-string-search", PACKAGE_EXT, true);
}
private static final class pf_simple_string_search extends Primitive {
pf_simple_string_search() {
super("simple-string-search", PACKAGE_EXT, true);
}
@Override
public LispObject execute(LispObject first, LispObject second)
......@@ -1068,17 +1023,16 @@ public final class StringFunctions
// ### simple-string-fill string character => string
private static final Primitive STRING_FILL = new pf_string_fill();
private static final class pf_string_fill extends Primitive {
pf_string_fill()
{
super("simple-string-fill", PACKAGE_EXT, true);
}
private static final class pf_string_fill extends Primitive {
pf_string_fill() {
super("simple-string-fill", PACKAGE_EXT, true);
}
@Override
public LispObject execute(LispObject first, LispObject second)
{
if(first instanceof AbstractString) {
if (first instanceof AbstractString) {
AbstractString s = (AbstractString) first;
s.fill(LispCharacter.getValue(second));
return first;
......@@ -1086,5 +1040,5 @@ public final class StringFunctions
return type_error(first, Symbol.SIMPLE_STRING);
}
};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment