Changeset 10120


Ignore:
Timestamp:
10/16/05 02:03:28 (16 years ago)
Author:
piso
Message:

Moved Utilites.toUpperCase() and Utilities.toLowerCase() to LispCharacter?.java.

Location:
trunk/j/src/org/armedbear/lisp
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/CapitalizeFirstStream.java

    r8006 r10120  
    22 * CapitalizeFirstStream.java
    33 *
    4  * Copyright (C) 2004 Peter Graves
    5  * $Id: CapitalizeFirstStream.java,v 1.2 2004-10-19 02:03:31 piso Exp $
     4 * Copyright (C) 2004-2005 Peter Graves
     5 * $Id: CapitalizeFirstStream.java,v 1.3 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3535        if (virgin) {
    3636            if (Character.isLetterOrDigit(c)) {
    37                 c = Utilities.toUpperCase(c);
     37                c = LispCharacter.toUpperCase(c);
    3838                virgin = false;
    3939            }
    4040        } else
    41             c = Utilities.toLowerCase(c);
     41            c = LispCharacter.toLowerCase(c);
    4242        target._writeChar(c);
    4343    }
  • trunk/j/src/org/armedbear/lisp/CapitalizeStream.java

    r7056 r10120  
    22 * CapitalizeStream.java
    33 *
    4  * Copyright (C) 2004 Peter Graves
    5  * $Id: CapitalizeStream.java,v 1.1 2004-06-08 23:03:45 piso Exp $
     4 * Copyright (C) 2004-2005 Peter Graves
     5 * $Id: CapitalizeStream.java,v 1.2 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3535        if (inWord) {
    3636            if (Character.isUpperCase(c)) {
    37                 c = Utilities.toLowerCase(c);
     37                c = LispCharacter.toLowerCase(c);
    3838            } else if (!Character.isLowerCase(c) && !Character.isDigit(c)) {
    3939                inWord = false;
     
    4444                inWord = true;
    4545            } else if (Character.isLowerCase(c)) {
    46                 c = Utilities.toUpperCase(c);
     46                c = LispCharacter.toUpperCase(c);
    4747                inWord = true;
    4848            } else if (Character.isDigit(c)) {
  • trunk/j/src/org/armedbear/lisp/CharacterFunctions.java

    r8229 r10120  
    22 * CharacterFunctions.java
    33 *
    4  * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: CharacterFunctions.java,v 1.12 2004-12-07 17:46:07 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: CharacterFunctions.java,v 1.13 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8686            if (c1 == c2)
    8787                return T;
    88             if (Utilities.toUpperCase(c1) == Utilities.toUpperCase(c2))
    89                 return T;
    90             if (Utilities.toLowerCase(c1) == Utilities.toLowerCase(c2))
     88            if (LispCharacter.toUpperCase(c1) == LispCharacter.toUpperCase(c2))
     89                return T;
     90            if (LispCharacter.toLowerCase(c1) == LispCharacter.toLowerCase(c2))
    9191                return T;
    9292            return NIL;
     
    100100                if (c0 == c)
    101101                    continue;
    102                 if (Utilities.toUpperCase(c0) == Utilities.toUpperCase(c))
     102                if (LispCharacter.toUpperCase(c0) == LispCharacter.toUpperCase(c))
    103103                    continue;
    104                 if (Utilities.toLowerCase(c0) == Utilities.toLowerCase(c))
     104                if (LispCharacter.toLowerCase(c0) == LispCharacter.toLowerCase(c))
    105105                    continue;
    106106                return NIL;
     
    127127            throws ConditionThrowable
    128128        {
    129             char c1 = Utilities.toUpperCase(LispCharacter.getValue(first));
    130             char c2 = Utilities.toUpperCase(LispCharacter.getValue(second));
     129            char c1 = LispCharacter.toUpperCase(LispCharacter.getValue(first));
     130            char c2 = LispCharacter.toUpperCase(LispCharacter.getValue(second));
    131131            return c1 > c2 ? T : NIL;
    132132        }
     
    136136            char[] chars = new char[length];
    137137            for (int i = 0; i < length; i++)
    138                 chars[i] = Utilities.toUpperCase(LispCharacter.getValue(array[i]));
     138                chars[i] = LispCharacter.toUpperCase(LispCharacter.getValue(array[i]));
    139139            for (int i = 1; i < length; i++) {
    140140                if (chars[i-1] <= chars[i])
     
    162162            throws ConditionThrowable
    163163        {
    164             char c1 = Utilities.toUpperCase(LispCharacter.getValue(first));
    165             char c2 = Utilities.toUpperCase(LispCharacter.getValue(second));
     164            char c1 = LispCharacter.toUpperCase(LispCharacter.getValue(first));
     165            char c2 = LispCharacter.toUpperCase(LispCharacter.getValue(second));
    166166            return c1 <= c2 ? T : NIL;
    167167        }
     
    171171            char[] chars = new char[length];
    172172            for (int i = 0; i < length; i++)
    173                 chars[i] = Utilities.toUpperCase(LispCharacter.getValue(array[i]));
     173                chars[i] = LispCharacter.toUpperCase(LispCharacter.getValue(array[i]));
    174174            for (int i = 1; i < length; i++) {
    175175                if (chars[i] < chars[i-1])
     
    317317            throws ConditionThrowable
    318318        {
    319             char c1 = Utilities.toUpperCase(LispCharacter.getValue(first));
    320             char c2 = Utilities.toUpperCase(LispCharacter.getValue(second));
     319            char c1 = LispCharacter.toUpperCase(LispCharacter.getValue(first));
     320            char c2 = LispCharacter.toUpperCase(LispCharacter.getValue(second));
    321321            return c1 < c2 ? T : NIL;
    322322        }
     
    326326            char[] chars = new char[length];
    327327            for (int i = 0; i < length; i++)
    328                 chars[i] = Utilities.toUpperCase(LispCharacter.getValue(array[i]));
     328                chars[i] = LispCharacter.toUpperCase(LispCharacter.getValue(array[i]));
    329329            for (int i = 1; i < length; i++) {
    330330                if (chars[i-1] >= chars[i])
     
    352352            throws ConditionThrowable
    353353        {
    354             char c1 = Utilities.toUpperCase(LispCharacter.getValue(first));
    355             char c2 = Utilities.toUpperCase(LispCharacter.getValue(second));
     354            char c1 = LispCharacter.toUpperCase(LispCharacter.getValue(first));
     355            char c2 = LispCharacter.toUpperCase(LispCharacter.getValue(second));
    356356            return c1 >= c2 ? T : NIL;
    357357        }
     
    361361            char[] chars = new char[length];
    362362            for (int i = 0; i < length; i++)
    363                 chars[i] = Utilities.toUpperCase(LispCharacter.getValue(array[i]));
     363                chars[i] = LispCharacter.toUpperCase(LispCharacter.getValue(array[i]));
    364364            for (int i = 1; i < length; i++) {
    365365                if (chars[i] > chars[i-1])
  • trunk/j/src/org/armedbear/lisp/ComplexString.java

    r10104 r10120  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: ComplexString.java,v 1.29 2005-10-15 15:45:24 piso Exp $
     5 * $Id: ComplexString.java,v 1.30 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    163163            for (int i = length(); i-- > 0;) {
    164164                if (string.charAt(i) != charAt(i)) {
    165                     if (Utilities.toLowerCase(string.charAt(i)) != Utilities.toLowerCase(charAt(i)))
     165                    if (LispCharacter.toLowerCase(string.charAt(i)) != LispCharacter.toLowerCase(charAt(i)))
    166166                        return false;
    167167                }
  • trunk/j/src/org/armedbear/lisp/DowncaseStream.java

    r7055 r10120  
    22 * DowncaseStream.java
    33 *
    4  * Copyright (C) 2004 Peter Graves
    5  * $Id: DowncaseStream.java,v 1.1 2004-06-08 22:58:13 piso Exp $
     4 * Copyright (C) 2004-2005 Peter Graves
     5 * $Id: DowncaseStream.java,v 1.2 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3131    public void _writeChar(char c) throws ConditionThrowable
    3232    {
    33         target._writeChar(Utilities.toLowerCase(c));
     33        target._writeChar(LispCharacter.toLowerCase(c));
    3434    }
    3535
  • trunk/j/src/org/armedbear/lisp/Readtable.java

    r9528 r10120  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Readtable.java,v 1.43 2005-06-25 19:37:39 piso Exp $
     5 * $Id: Readtable.java,v 1.44 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    263263        }
    264264        LispObject function =
    265             dispatchTable.functions[Utilities.toUpperCase(subChar)];
     265            dispatchTable.functions[LispCharacter.toUpperCase(subChar)];
    266266        return (function != null) ? function : NIL;
    267267    }
     
    277277                                 " is not a dispatch character."));
    278278        }
    279         dispatchTable.functions[Utilities.toUpperCase(subChar)] = function;
     279        dispatchTable.functions[LispCharacter.toUpperCase(subChar)] = function;
    280280    }
    281281
  • trunk/j/src/org/armedbear/lisp/SimpleString.java

    r9791 r10120  
    33 *
    44 * Copyright (C) 2004-2005 Peter Graves
    5  * $Id: SimpleString.java,v 1.32 2005-08-04 18:10:33 piso Exp $
     5 * $Id: SimpleString.java,v 1.33 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    166166            for (int i = capacity; i-- > 0;) {
    167167                if (string.chars[i] != chars[i]) {
    168                     if (Utilities.toLowerCase(string.chars[i]) != Utilities.toLowerCase(chars[i]))
     168                    if (LispCharacter.toLowerCase(string.chars[i]) != LispCharacter.toLowerCase(chars[i]))
    169169                        return false;
    170170                }
     
    178178            for (int i = length(); i-- > 0;) {
    179179                if (string.charAt(i) != chars[i]) {
    180                     if (Utilities.toLowerCase(string.charAt(i)) != Utilities.toLowerCase(chars[i]))
     180                    if (LispCharacter.toLowerCase(string.charAt(i)) != LispCharacter.toLowerCase(chars[i]))
    181181                        return false;
    182182                }
  • trunk/j/src/org/armedbear/lisp/Stream.java

    r9949 r10120  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Stream.java,v 1.136 2005-09-08 23:30:01 piso Exp $
     5 * $Id: Stream.java,v 1.137 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    929929                rt.checkInvalid(c, this); // Signals a reader-error.
    930930            } else if (readtableCase == Keyword.UPCASE) {
    931                 sb.setCharAt(0, Utilities.toUpperCase(c));
     931                sb.setCharAt(0, LispCharacter.toUpperCase(c));
    932932            } else if (readtableCase == Keyword.DOWNCASE) {
    933                 sb.setCharAt(0, Utilities.toLowerCase(c));
     933                sb.setCharAt(0, LispCharacter.toLowerCase(c));
    934934            }
    935935        }
     
    970970            }
    971971            if (readtableCase == Keyword.UPCASE)
    972                 c = Utilities.toUpperCase(c);
     972                c = LispCharacter.toUpperCase(c);
    973973            else if (readtableCase == Keyword.DOWNCASE)
    974                 c = Utilities.toLowerCase(c);
     974                c = LispCharacter.toLowerCase(c);
    975975            sb.append(c);
    976976        }
     
    11421142                // Exponent marker.
    11431143                maybe = true;
    1144                 marker = Utilities.toUpperCase(c);
     1144                marker = LispCharacter.toUpperCase(c);
    11451145                if (marker == 'S')
    11461146                    marker = 'F';
  • trunk/j/src/org/armedbear/lisp/StringFunctions.java

    r9999 r10120  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: StringFunctions.java,v 1.39 2005-09-22 00:25:33 piso Exp $
     5 * $Id: StringFunctions.java,v 1.40 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    166166                if (c1 == c2)
    167167                    continue;
    168                 if (Utilities.toUpperCase(c1) == Utilities.toUpperCase(c2))
    169                     continue;
    170                 if (Utilities.toLowerCase(c1) == Utilities.toLowerCase(c2))
     168                if (LispCharacter.toUpperCase(c1) == LispCharacter.toUpperCase(c2))
     169                    continue;
     170                if (LispCharacter.toLowerCase(c1) == LispCharacter.toLowerCase(c2))
    171171                    continue;
    172172                return NIL;
     
    207207                char c2 = array2[j];
    208208                if (c1 == c2 ||
    209                     Utilities.toUpperCase(c1) == Utilities.toUpperCase(c2) ||
    210                     Utilities.toLowerCase(c1) == Utilities.toLowerCase(c2))
     209                    LispCharacter.toUpperCase(c1) == LispCharacter.toUpperCase(c2) ||
     210                    LispCharacter.toLowerCase(c1) == LispCharacter.toLowerCase(c2))
    211211                {
    212212                    ++i;
     
    415415                    return NIL;
    416416                }
    417                 char c1 = Utilities.toUpperCase(array1[i]);
    418                 char c2 = Utilities.toUpperCase(array2[j]);
     417                char c1 = LispCharacter.toUpperCase(array1[i]);
     418                char c2 = LispCharacter.toUpperCase(array2[j]);
    419419                if (c1 == c2) {
    420420                    ++i;
     
    456456                    return new Fixnum(i);
    457457                }
    458                 char c1 = Utilities.toUpperCase(array1[i]);
    459                 char c2 = Utilities.toUpperCase(array2[j]);
     458                char c1 = LispCharacter.toUpperCase(array1[i]);
     459                char c2 = LispCharacter.toUpperCase(array2[j]);
    460460                if (c1 == c2) {
    461461                    ++i;
     
    499499                    return new Fixnum(i);
    500500                }
    501                 char c1 = Utilities.toUpperCase(array1[i]);
    502                 char c2 = Utilities.toUpperCase(array2[j]);
     501                char c1 = LispCharacter.toUpperCase(array1[i]);
     502                char c2 = LispCharacter.toUpperCase(array2[j]);
    503503                if (c1 == c2) {
    504504                    ++i;
     
    540540                    return NIL;
    541541                }
    542                 char c1 = Utilities.toUpperCase(array1[i]);
    543                 char c2 = Utilities.toUpperCase(array2[j]);
     542                char c1 = LispCharacter.toUpperCase(array1[i]);
     543                char c2 = LispCharacter.toUpperCase(array2[j]);
    544544                if (c1 == c2) {
    545545                    ++i;
     
    583583                sb.append(array[i]);
    584584            for (i = start; i < end; i++)
    585                 sb.append(Utilities.toUpperCase(array[i]));
     585                sb.append(LispCharacter.toUpperCase(array[i]));
    586586            for (i = end; i < length; i++)
    587587                sb.append(array[i]);
     
    618618                sb.append(array[i]);
    619619            for (i = start; i < end; i++)
    620                 sb.append(Utilities.toLowerCase(array[i]));
     620                sb.append(LispCharacter.toLowerCase(array[i]));
    621621            for (i = end; i < length; i++)
    622622                sb.append(array[i]);
     
    656656                char c = array[i];
    657657                if (Character.isLowerCase(c)) {
    658                     sb.append(lastCharWasAlphanumeric ? c : Utilities.toUpperCase(c));
     658                    sb.append(lastCharWasAlphanumeric ? c : LispCharacter.toUpperCase(c));
    659659                    lastCharWasAlphanumeric = true;
    660660                } else if (Character.isUpperCase(c)) {
    661                     sb.append(lastCharWasAlphanumeric ? Utilities.toLowerCase(c) : c);
     661                    sb.append(lastCharWasAlphanumeric ? LispCharacter.toLowerCase(c) : c);
    662662                    lastCharWasAlphanumeric = true;
    663663                } else {
     
    701701                return signal(new TypeError("Start (" + start + ") is greater than end (" + end + ")."));
    702702            for (int i = start; i < end; i++)
    703                 string.setCharAt(i, Utilities.toUpperCase(string.charAt(i)));
     703                string.setCharAt(i, LispCharacter.toUpperCase(string.charAt(i)));
    704704            return string;
    705705        }
     
    735735                return signal(new TypeError("Start (" + start + ") is greater than end (" + end + ")."));
    736736            for (int i = start; i < end; i++)
    737                 string.setCharAt(i, Utilities.toLowerCase(string.charAt(i)));
     737                string.setCharAt(i, LispCharacter.toLowerCase(string.charAt(i)));
    738738            return string;
    739739        }
     
    773773                if (Character.isLowerCase(c)) {
    774774                    if (!lastCharWasAlphanumeric)
    775                         string.setCharAt(i, Utilities.toUpperCase(c));
     775                        string.setCharAt(i, LispCharacter.toUpperCase(c));
    776776                    lastCharWasAlphanumeric = true;
    777777                } else if (Character.isUpperCase(c)) {
    778778                    if (lastCharWasAlphanumeric)
    779                         string.setCharAt(i, Utilities.toLowerCase(c));
     779                        string.setCharAt(i, LispCharacter.toLowerCase(c));
    780780                    lastCharWasAlphanumeric = true;
    781781                } else
  • trunk/j/src/org/armedbear/lisp/Symbol.java

    r9972 r10120  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Symbol.java,v 1.211 2005-09-14 18:51:18 piso Exp $
     5 * $Id: Symbol.java,v 1.212 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    802802                    sb.append(c);
    803803                else // DOWNCASE
    804                     sb.append(lastCharWasAlphanumeric ? c : Utilities.toUpperCase(c));
     804                    sb.append(lastCharWasAlphanumeric ? c : LispCharacter.toUpperCase(c));
    805805                lastCharWasAlphanumeric = true;
    806806            } else if (Character.isUpperCase(c)) {
    807807                if (readtableCase == Keyword.UPCASE)
    808                     sb.append(lastCharWasAlphanumeric ? Utilities.toLowerCase(c) : c);
     808                    sb.append(lastCharWasAlphanumeric ? LispCharacter.toLowerCase(c) : c);
    809809                else // DOWNCASE
    810810                    sb.append(c);
  • trunk/j/src/org/armedbear/lisp/UpcaseStream.java

    r7055 r10120  
    22 * UpcaseStream.java
    33 *
    4  * Copyright (C) 2004 Peter Graves
    5  * $Id: UpcaseStream.java,v 1.1 2004-06-08 22:55:30 piso Exp $
     4 * Copyright (C) 2004-2005 Peter Graves
     5 * $Id: UpcaseStream.java,v 1.2 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3131    public void _writeChar(char c) throws ConditionThrowable
    3232    {
    33         target._writeChar(Utilities.toUpperCase(c));
     33        target._writeChar(LispCharacter.toUpperCase(c));
    3434    }
    3535
  • trunk/j/src/org/armedbear/lisp/Utilities.java

    r9120 r10120  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Utilities.java,v 1.11 2005-05-10 17:57:33 piso Exp $
     5 * $Id: Utilities.java,v 1.12 2005-10-16 02:03:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    112112        }
    113113    }
    114 
    115     public static final char toUpperCase(char c)
    116     {
    117         if (c < 128)
    118             return UPPER_CASE_CHARS[c];
    119         return Character.toUpperCase(c);
    120     }
    121 
    122     private static final char[] UPPER_CASE_CHARS = new char[128];
    123 
    124     static {
    125         for (int i = UPPER_CASE_CHARS.length; i-- > 0;)
    126             UPPER_CASE_CHARS[i] = Character.toUpperCase((char)i);
    127     }
    128 
    129     public static final char toLowerCase(char c)
    130     {
    131         if (c < 128)
    132             return LOWER_CASE_CHARS[c];
    133         return Character.toLowerCase(c);
    134     }
    135 
    136     private static final char[] LOWER_CASE_CHARS = new char[128];
    137 
    138     static {
    139         for (int i = LOWER_CASE_CHARS.length; i-- > 0;)
    140             LOWER_CASE_CHARS[i] = Character.toLowerCase((char)i);
    141     }
    142114}
Note: See TracChangeset for help on using the changeset viewer.