javaclass

Changeset

72:ac628263decd
2004-11-21 Paul Boddie raw files shortlog changelog graph Added tentative library implementations.
java/lang.py (file)
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/lang.py	Sun Nov 21 23:32:03 2004 +0100
     1.3 @@ -0,0 +1,206 @@
     1.4 +#!/usr/bin/env python
     1.5 +
     1.6 +class Character(object):
     1.7 +    def __init__(self, value):
     1.8 +        raise NotImplementedError, "__init__"
     1.9 +    def charValue(self):
    1.10 +        raise NotImplementedError, "charValue"
    1.11 +    def hashCode(self):
    1.12 +        raise NotImplementedError, "hashCode"
    1.13 +    def equals(self, anObject):
    1.14 +        raise NotImplementedError, "equals"
    1.15 +    def toString(self):
    1.16 +        raise NotImplementedError, "toString"
    1.17 +    def isLowerCase(self, ch):
    1.18 +        raise NotImplementedError, "isLowerCase"
    1.19 +    isLowerCase = staticmethod(isLowerCase)
    1.20 +    def isUpperCase(self, ch):
    1.21 +        raise NotImplementedError, "isUpperCase"
    1.22 +    isUpperCase = staticmethod(isUpperCase)
    1.23 +    def isTitleCase(self, ch):
    1.24 +        raise NotImplementedError, "isTitleCase"
    1.25 +    isTitleCase = staticmethod(isTitleCase)
    1.26 +    def isDigit(self, ch):
    1.27 +        raise NotImplementedError, "isDigit"
    1.28 +    isDigit = staticmethod(isDigit)
    1.29 +    def isDefined(self, ch):
    1.30 +        raise NotImplementedError, "isDefined"
    1.31 +    isDefined = staticmethod(isDefined)
    1.32 +    def isLetter(self, ch):
    1.33 +        raise NotImplementedError, "isLetter"
    1.34 +    isLetter = staticmethod(isLetter)
    1.35 +    def isLetterOrDigit(self, ch):
    1.36 +        raise NotImplementedError, "isLetterOrDigit"
    1.37 +    isLetterOrDigit = staticmethod(isLetterOrDigit)
    1.38 +    def isJavaLetter(self, ch):
    1.39 +        raise NotImplementedError, "isJavaLetter"
    1.40 +    isJavaLetter = staticmethod(isJavaLetter)
    1.41 +    def isJavaLetterOrDigit(self, ch):
    1.42 +        raise NotImplementedError, "isJavaLetterOrDigit"
    1.43 +    isJavaLetterOrDigit = staticmethod(isJavaLetterOrDigit)
    1.44 +    def isJavaIdentifierStart(self, ch):
    1.45 +        raise NotImplementedError, "isJavaIdentifierStart"
    1.46 +    isJavaIdentifierStart = staticmethod(isJavaIdentifierStart)
    1.47 +    def isJavaIdentifierPart(self, ch):
    1.48 +        raise NotImplementedError, "isJavaIdentifierPart"
    1.49 +    isJavaIdentifierPart = staticmethod(isJavaIdentifierPart)
    1.50 +    def isUnicodeIdentifierStart(self, ch):
    1.51 +        raise NotImplementedError, "isUnicodeIdentifierStart"
    1.52 +    isUnicodeIdentifierStart = staticmethod(isUnicodeIdentifierStart)
    1.53 +    def isUnicodeIdentifierPart(self, ch):
    1.54 +        raise NotImplementedError, "isUnicodeIdentifierPart"
    1.55 +    isUnicodeIdentifierPart = staticmethod(isUnicodeIdentifierPart)
    1.56 +    def isIdentifierIgnorable(self, ch):
    1.57 +        raise NotImplementedError, "isIdentifierIgnorable"
    1.58 +    isIdentifierIgnorable = staticmethod(isIdentifierIgnorable)
    1.59 +    def toLowerCase(self, ch):
    1.60 +        raise NotImplementedError, "toLowerCase"
    1.61 +    toLowerCase = staticmethod(toLowerCase)
    1.62 +    def toUpperCase(self, ch):
    1.63 +        raise NotImplementedError, "toUpperCase"
    1.64 +    toUpperCase = staticmethod(toUpperCase)
    1.65 +    def toTitleCase(self, ch):
    1.66 +        raise NotImplementedError, "toTitleCase"
    1.67 +    toTitleCase = staticmethod(toTitleCase)
    1.68 +    def digit(self, ch, radix):
    1.69 +        raise NotImplementedError, "digit"
    1.70 +    digit = staticmethod(digit)
    1.71 +    def getNumericValue(self, ch):
    1.72 +        raise NotImplementedError, "getNumericValue"
    1.73 +    getNumericValue = staticmethod(getNumericValue)
    1.74 +    def isSpace(self, ch):
    1.75 +        raise NotImplementedError, "isSpace"
    1.76 +    isSpace = staticmethod(isSpace)
    1.77 +    def isSpaceChar(self, ch):
    1.78 +        raise NotImplementedError, "isSpaceChar"
    1.79 +    isSpaceChar = staticmethod(isSpaceChar)
    1.80 +    def isWhitespace(self, ch):
    1.81 +        raise NotImplementedError, "isWhitespace"
    1.82 +    isWhitespace = staticmethod(isWhitespace)
    1.83 +    def isISOControl(self, ch):
    1.84 +        raise NotImplementedError, "isISOControl"
    1.85 +    isISOControl = staticmethod(isISOControl)
    1.86 +    def getType(self, ch):
    1.87 +        raise NotImplementedError, "getType"
    1.88 +    getType = staticmethod(getType)
    1.89 +    def forDigit(self, ch, radix):
    1.90 +        raise NotImplementedError, "forDigit"
    1.91 +    forDigit = staticmethod(forDigit)
    1.92 +    def compareTo(self, *args):
    1.93 +        # compareTo(self, anotherCharacter)
    1.94 +        # compareTo(self, o)
    1.95 +        raise NotImplementedError, "compareTo"
    1.96 +
    1.97 +class String(object):
    1.98 +    def __init__(self, *args):
    1.99 +        # Python string initialisation:
   1.100 +        if len(args) == 1 and isinstance(args[0], str):
   1.101 +            self.value = unicode(args[0])
   1.102 +            return
   1.103 +        elif len(args) == 1 and isinstance(args[0], unicode):
   1.104 +            self.value = args[0]
   1.105 +            return
   1.106 +        # __init__(self)
   1.107 +        elif len(args) == 0:
   1.108 +            self.value = u""
   1.109 +            return
   1.110 +        # __init__(self, original)
   1.111 +        elif len(args) == 1 and isinstance(args[0], String):
   1.112 +            self.value = args[0].value
   1.113 +            return
   1.114 +        # __init__(self, value)
   1.115 +        # __init__(self, value, offset, count)
   1.116 +        # __init__(self, ascii, hibyte, offset, count)
   1.117 +        # __init__(self, ascii, hibyte)
   1.118 +        # __init__(self, bytes, offset, length, enc)
   1.119 +        # __init__(self, bytes, enc)
   1.120 +        # __init__(self, bytes, offset, length)
   1.121 +        # __init__(self, bytes)
   1.122 +        elif len(args) >= 1 and isinstance(args[0], list):
   1.123 +            raise NotImplementedError, "__init__"
   1.124 +        # __init__(self, buffer)
   1.125 +        raise NotImplementedError, "__init__"
   1.126 +    def length(self):
   1.127 +        return len(self.value)
   1.128 +    def charAt(self, index):
   1.129 +        return self.value[index]
   1.130 +    def getChars(self, srcBegin, srcEnd, dst, dstBegin):
   1.131 +        raise NotImplementedError, "getChars"
   1.132 +    def getBytes(self, *args):
   1.133 +        # void getBytes(self, srcBegin, srcEnd, dst, dstBegin)
   1.134 +        # byte[] getBytes(self, enc)
   1.135 +        # byte[] getBytes(self)
   1.136 +        raise NotImplementedError, "getBytes"
   1.137 +    def equals(self, anObject):
   1.138 +        raise NotImplementedError, "equals"
   1.139 +    def compareTo(self, obj):
   1.140 +        raise NotImplementedError, "compareTo"
   1.141 +    # NOTE: Comparator defined using private classes.
   1.142 +    def compareToIgnoreCase(self, str):
   1.143 +        raise NotImplementedError, "compareToIgnoreCase"
   1.144 +    def regionMatches(self, *args):
   1.145 +        # regionMatches(self, toffset, other, ooffset, len)
   1.146 +        # regionMatches(self, ignoreCase, toffset, other, ooffset, len)
   1.147 +        raise NotImplementedError, "regionMatches"
   1.148 +    def startsWith(self, *args):
   1.149 +        # startsWith(self, prefix, toffset)
   1.150 +        # startsWith(self, prefix)
   1.151 +        raise NotImplementedError, "startsWith"
   1.152 +    def endsWith(self, suffix):
   1.153 +        raise NotImplementedError, "endsWith"
   1.154 +    def hashCode(self):
   1.155 +        raise NotImplementedError, "hashCode"
   1.156 +    def indexOf(self, *args):
   1.157 +        # indexOf(self, ch)
   1.158 +        # indexOf(self, ch, fromIndex)
   1.159 +        # indexOf(self, str)
   1.160 +        # indexOf(self, str, fromIndex)
   1.161 +        raise NotImplementedError, "indexOf"
   1.162 +    def lastIndexOf(self, *args):
   1.163 +        # lastIndexOf(self, ch)
   1.164 +        # lastIndexOf(self, ch, fromIndex)
   1.165 +        # lastIndexOf(self, str)
   1.166 +        # lastIndexOf(self, str, fromIndex)
   1.167 +        raise NotImplementedError, "lastIndexOf"
   1.168 +    def substring(self, *args):
   1.169 +        # substring(self, beginIndex)
   1.170 +        # substring(self, beginIndex, endIndex)
   1.171 +        raise NotImplementedError, "substring"
   1.172 +    def concat(self, str):
   1.173 +        raise NotImplementedError, "concat"
   1.174 +    def replace(self, oldChar, newChar):
   1.175 +        raise NotImplementedError, "replace"
   1.176 +    def toLowerCase(self, *args):
   1.177 +        # toLowerCase(self, locale)
   1.178 +        # toLowerCase(self)
   1.179 +        raise NotImplementedError, "toLowerCase"
   1.180 +    def toUpperCase(self, *args):
   1.181 +        # toUpperCase(self, locale)
   1.182 +        # toUpperCase(self)
   1.183 +        raise NotImplementedError, "toUpperCase"
   1.184 +    def trim(self):
   1.185 +        raise NotImplementedError, "trim"
   1.186 +    def toString(self):
   1.187 +        return self
   1.188 +    def toCharArray(self):
   1.189 +        raise NotImplementedError, "toCharArray"
   1.190 +    def valueOf(self, *args):
   1.191 +        # valueOf(self, obj)
   1.192 +        # valueOf(self, data)
   1.193 +        # valueOf(self, data, offset, count)
   1.194 +        # valueOf(self, b)
   1.195 +        # valueOf(self, c)
   1.196 +        # valueOf(self, l)
   1.197 +        # valueOf(self, f)
   1.198 +        # valueOf(self, d)
   1.199 +        raise NotImplementedError, "valueOf"
   1.200 +    valueOf = staticmethod(valueOf)
   1.201 +    def copyValueOf(self, *args):
   1.202 +        # copyValueOf(self, data, offset, count)
   1.203 +        # copyValueOf(self, data)
   1.204 +        raise NotImplementedError, "copyValueOf"
   1.205 +    copyValueOf = staticmethod(copyValueOf)
   1.206 +    def intern(self):
   1.207 +        raise NotImplementedError, "intern"
   1.208 +
   1.209 +# vim: tabstop=4 expandtab shiftwidth=4