1.1 --- a/java/lang.py Mon Jan 10 23:43:44 2005 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,396 +0,0 @@
1.4 -#!/usr/bin/env python
1.5 -
1.6 -import java.io
1.7 -import os
1.8 -import sys
1.9 -
1.10 -class Character(object):
1.11 - def __init__(self, value):
1.12 - raise NotImplementedError, "__init__"
1.13 -
1.14 - def charValue(self):
1.15 - raise NotImplementedError, "charValue"
1.16 - charValue___ = charValue
1.17 -
1.18 - def hashCode(self):
1.19 - raise NotImplementedError, "hashCode"
1.20 - hashCode___ = hashCode
1.21 -
1.22 - def equals(self, anObject):
1.23 - raise NotImplementedError, "equals"
1.24 - equals___java__lang__Object = equals
1.25 -
1.26 - def toString(self):
1.27 - raise NotImplementedError, "toString"
1.28 - toString___ = toString
1.29 -
1.30 - def isLowerCase(self, ch):
1.31 - raise NotImplementedError, "isLowerCase"
1.32 - isLowerCase____C_ = staticmethod(isLowerCase)
1.33 -
1.34 - def isUpperCase(self, ch):
1.35 - raise NotImplementedError, "isUpperCase"
1.36 - isUpperCase____C_ = staticmethod(isUpperCase)
1.37 -
1.38 - def isTitleCase(self, ch):
1.39 - raise NotImplementedError, "isTitleCase"
1.40 - isTitleCase____C_ = staticmethod(isTitleCase)
1.41 -
1.42 - def isDigit(self, ch):
1.43 - raise NotImplementedError, "isDigit"
1.44 - isDigit____C_ = staticmethod(isDigit)
1.45 -
1.46 - def isDefined(self, ch):
1.47 - raise NotImplementedError, "isDefined"
1.48 - isDefined____C_ = staticmethod(isDefined)
1.49 -
1.50 - def isLetter(self, ch):
1.51 - raise NotImplementedError, "isLetter"
1.52 - isLetter____C_ = staticmethod(isLetter)
1.53 -
1.54 - def isLetterOrDigit(self, ch):
1.55 - raise NotImplementedError, "isLetterOrDigit"
1.56 - isLetterOrDigit____C_ = staticmethod(isLetterOrDigit)
1.57 -
1.58 - def isJavaLetter(self, ch):
1.59 - raise NotImplementedError, "isJavaLetter"
1.60 - isJavaLetter____C_ = staticmethod(isJavaLetter)
1.61 -
1.62 - def isJavaLetterOrDigit(self, ch):
1.63 - raise NotImplementedError, "isJavaLetterOrDigit"
1.64 - isJavaLetterOrDigit____C_ = staticmethod(isJavaLetterOrDigit)
1.65 -
1.66 - def isJavaIdentifierStart(self, ch):
1.67 - raise NotImplementedError, "isJavaIdentifierStart"
1.68 - isJavaIdentifierStart____C_ = staticmethod(isJavaIdentifierStart)
1.69 -
1.70 - def isJavaIdentifierPart(self, ch):
1.71 - raise NotImplementedError, "isJavaIdentifierPart"
1.72 - isJavaIdentifierPart____C_ = staticmethod(isJavaIdentifierPart)
1.73 -
1.74 - def isUnicodeIdentifierStart(self, ch):
1.75 - raise NotImplementedError, "isUnicodeIdentifierStart"
1.76 - isUnicodeIdentifierStart____C_ = staticmethod(isUnicodeIdentifierStart)
1.77 -
1.78 - def isUnicodeIdentifierPart(self, ch):
1.79 - raise NotImplementedError, "isUnicodeIdentifierPart"
1.80 - isUnicodeIdentifierPart____C_ = staticmethod(isUnicodeIdentifierPart)
1.81 -
1.82 - def isIdentifierIgnorable(self, ch):
1.83 - raise NotImplementedError, "isIdentifierIgnorable"
1.84 - isIdentifierIgnorable____C_ = staticmethod(isIdentifierIgnorable)
1.85 -
1.86 - def toLowerCase(self, ch):
1.87 - raise NotImplementedError, "toLowerCase"
1.88 - toLowerCase____C_ = staticmethod(toLowerCase)
1.89 -
1.90 - def toUpperCase(self, ch):
1.91 - raise NotImplementedError, "toUpperCase"
1.92 - toUpperCase____C_ = staticmethod(toUpperCase)
1.93 -
1.94 - def toTitleCase(self, ch):
1.95 - raise NotImplementedError, "toTitleCase"
1.96 - toTitleCase____C_ = staticmethod(toTitleCase)
1.97 -
1.98 - def digit(self, ch, radix):
1.99 - raise NotImplementedError, "digit"
1.100 - digit____C_____I_ = staticmethod(digit)
1.101 -
1.102 - def getNumericValue(self, ch):
1.103 - raise NotImplementedError, "getNumericValue"
1.104 - getNumericValue____C_ = staticmethod(getNumericValue)
1.105 -
1.106 - def isSpace(self, ch):
1.107 - raise NotImplementedError, "isSpace"
1.108 - isSpace____C_ = staticmethod(isSpace)
1.109 -
1.110 - def isSpaceChar(self, ch):
1.111 - raise NotImplementedError, "isSpaceChar"
1.112 - isSpaceChar____C_ = staticmethod(isSpaceChar)
1.113 -
1.114 - def isWhitespace(self, ch):
1.115 - raise NotImplementedError, "isWhitespace"
1.116 - isWhitespace____C_ = staticmethod(isWhitespace)
1.117 -
1.118 - def isISOControl(self, ch):
1.119 - raise NotImplementedError, "isISOControl"
1.120 - isISOControl____C_ = staticmethod(isISOControl)
1.121 -
1.122 - def getType(self, ch):
1.123 - raise NotImplementedError, "getType"
1.124 - getType____C_ = staticmethod(getType)
1.125 -
1.126 - def forDigit(self, ch, radix):
1.127 - raise NotImplementedError, "forDigit"
1.128 - forDigit____C_____I_ = staticmethod(forDigit)
1.129 -
1.130 - def compareTo(self, *args):
1.131 - # compareTo(self, anotherCharacter)
1.132 - # compareTo(self, o)
1.133 - raise NotImplementedError, "compareTo"
1.134 - compareTo____C_ = compareTo
1.135 - compareTo___java__lang__Object = compareTo
1.136 -
1.137 -setattr(Character, "__init____C_", Character.__init__)
1.138 -
1.139 -class Class(object):
1.140 - def forName(className):
1.141 - parts = unicode(className).split(".")
1.142 - obj = __import__(".".join(parts[:-1]), globals(), {}, [])
1.143 - for part in parts[1:]:
1.144 - obj = getattr(obj, part)
1.145 - return obj
1.146 -
1.147 - forName___java__lang__String = staticmethod(forName)
1.148 - # NOTE: To be enhanced.
1.149 - forName___java__lang__String____Z____java__lang__ClassLoader = staticmethod(forName)
1.150 -
1.151 -# NOTE: Establish a better exception hierarchy.
1.152 -
1.153 -class Error(object):
1.154 - def __init__(self, *args):
1.155 - self.args = args
1.156 -
1.157 -setattr(Error, "__init_____", Error.__init__)
1.158 -setattr(Error, "__init_____java__lang__String", Error.__init__)
1.159 -
1.160 -class Exception(object):
1.161 - def __init__(self, *args):
1.162 - self.args = args
1.163 -
1.164 -setattr(Exception, "__init_____", Exception.__init__)
1.165 -setattr(Exception, "__init_____java__lang__String", Exception.__init__)
1.166 -
1.167 -class IndexOutOfBoundsException(object):
1.168 - def __init__(self, *args):
1.169 - self.args = args
1.170 -
1.171 -setattr(IndexOutOfBoundsException, "__init_____", IndexOutOfBoundsException.__init__)
1.172 -setattr(IndexOutOfBoundsException, "__init_____java__lang__String", IndexOutOfBoundsException.__init__)
1.173 -
1.174 -class IllegalArgumentException(Exception):
1.175 - def __init__(self, *args):
1.176 - self.args = args
1.177 -
1.178 -setattr(IllegalArgumentException, "__init_____", IllegalArgumentException.__init__)
1.179 -setattr(IllegalArgumentException, "__init_____java__lang__String", IllegalArgumentException.__init__)
1.180 -
1.181 -class NullPointerException(object):
1.182 - def __init__(self, *args):
1.183 - self.args = args
1.184 -
1.185 -setattr(NullPointerException, "__init_____", NullPointerException.__init__)
1.186 -setattr(NullPointerException, "__init_____java__lang__String", NullPointerException.__init__)
1.187 -
1.188 -class SecurityException(Exception):
1.189 - def __init__(self, *args):
1.190 - self.args = args
1.191 -
1.192 -setattr(SecurityException, "__init_____", SecurityException.__init__)
1.193 -setattr(SecurityException, "__init_____java__lang__String", SecurityException.__init__)
1.194 -
1.195 -class String(object):
1.196 -
1.197 - # NOTE: This method should not be needed, really.
1.198 - def __str__(self):
1.199 - return self.value.encode("utf-8")
1.200 -
1.201 - def __unicode__(self):
1.202 - return self.value
1.203 -
1.204 - def init__empty(self):
1.205 - self.value = u""
1.206 -
1.207 - def init__String(self, obj):
1.208 - self.value = obj.value
1.209 -
1.210 - def __init__(self, *args):
1.211 -
1.212 - "Python string initialisation only."
1.213 -
1.214 - if len(args) == 1 and isinstance(args[0], str):
1.215 - self.value = unicode(args[0])
1.216 - return
1.217 - elif len(args) == 1 and isinstance(args[0], unicode):
1.218 - self.value = args[0]
1.219 - return
1.220 - # __init__(self)
1.221 - elif len(args) == 0:
1.222 - self.__init__empty()
1.223 - return
1.224 - # __init__(self, original)
1.225 - elif len(args) == 1 and isinstance(args[0], String):
1.226 - self.init__String(args[0])
1.227 - return
1.228 - # __init__(self, value)
1.229 - # __init__(self, value, offset, count)
1.230 - # __init__(self, ascii, hibyte, offset, count)
1.231 - # __init__(self, ascii, hibyte)
1.232 - # __init__(self, bytes, offset, length, enc)
1.233 - # __init__(self, bytes, enc)
1.234 - # __init__(self, bytes, offset, length)
1.235 - # __init__(self, bytes)
1.236 - elif len(args) >= 1 and isinstance(args[0], list):
1.237 - raise NotImplementedError, "__init__"
1.238 - # __init__(self, buffer)
1.239 - raise NotImplementedError, "__init__"
1.240 -
1.241 - def length(self):
1.242 - return len(self.value)
1.243 - length___ = length
1.244 -
1.245 - def charAt(self, index):
1.246 - return ord(self.value[index])
1.247 - charAt____I_ = charAt
1.248 -
1.249 - def getChars(self, srcBegin, srcEnd, dst, dstBegin):
1.250 - raise NotImplementedError, "getChars"
1.251 - getChars____I_____I_____C__array_____I_ = getChars
1.252 -
1.253 - def getBytes(self, *args):
1.254 - # void getBytes(self, srcBegin, srcEnd, dst, dstBegin)
1.255 - # byte[] getBytes(self, enc)
1.256 - # byte[] getBytes(self)
1.257 - raise NotImplementedError, "getBytes"
1.258 - getBytes___ = getBytes
1.259 - getBytes____I_____I_____B__array_____I_ = getBytes
1.260 -
1.261 - def equals(self, anObject):
1.262 - return isinstance(anObject, self.__class__) and self.value == anObject.value
1.263 - equals___java__lang__Object = equals
1.264 -
1.265 - def compareTo(self, obj):
1.266 - if self.value < obj.value:
1.267 - return -1
1.268 - elif self.value == obj.value:
1.269 - return 0
1.270 - else:
1.271 - return 1
1.272 - compareTo___java__lang__String = compareTo
1.273 -
1.274 - # NOTE: Comparator defined using private classes. This implementation just
1.275 - # NOTE: uses Python's lower method.
1.276 - def compareToIgnoreCase(self, str):
1.277 - value = self.value.lower()
1.278 - value2 = str.value.lower()
1.279 - if value < value2:
1.280 - return -1
1.281 - elif value == value2:
1.282 - return 0
1.283 - else:
1.284 - return 1
1.285 - compareToIgnoreCase___java__lang__String = compareToIgnoreCase
1.286 -
1.287 - # NOTE: Comparator defined using private classes. This implementation just
1.288 - # NOTE: uses Python's lower method.
1.289 - def equalsIgnoreCase(self, anotherString):
1.290 - value = self.value.lower()
1.291 - value2 = anotherString.value.lower()
1.292 - return value == value2
1.293 - equalsIgnoreCase___java__lang__String = equalsIgnoreCase
1.294 -
1.295 - def regionMatches(self, *args):
1.296 - # regionMatches(self, toffset, other, ooffset, len)
1.297 - # regionMatches(self, ignoreCase, toffset, other, ooffset, len)
1.298 - raise NotImplementedError, "regionMatches"
1.299 -
1.300 - def startsWith(self, *args):
1.301 - # startsWith(self, prefix, toffset)
1.302 - # startsWith(self, prefix)
1.303 - raise NotImplementedError, "startsWith"
1.304 -
1.305 - def endsWith(self, suffix):
1.306 - raise NotImplementedError, "endsWith"
1.307 -
1.308 - def hashCode(self):
1.309 - raise NotImplementedError, "hashCode"
1.310 -
1.311 - def indexOf____I_(self, ch):
1.312 - return self.value.find(chr(ch))
1.313 -
1.314 - def indexOf____I_____I_(self, ch, fromIndex):
1.315 - return self.value.find(chr(ch), fromIndex)
1.316 -
1.317 - def indexOf___java__lang__String___(self, str):
1.318 - return self.value.find(str.value)
1.319 -
1.320 - def indexOf___java__lang__String____I_(self, str, fromIndex):
1.321 - return self.value.find(str.value, fromIndex)
1.322 -
1.323 - def lastIndexOf(self, *args):
1.324 - # lastIndexOf(self, ch)
1.325 - # lastIndexOf(self, ch, fromIndex)
1.326 - # lastIndexOf(self, str)
1.327 - # lastIndexOf(self, str, fromIndex)
1.328 - raise NotImplementedError, "lastIndexOf"
1.329 -
1.330 - def substring(self, *args):
1.331 - # substring(self, beginIndex)
1.332 - # substring(self, beginIndex, endIndex)
1.333 - raise NotImplementedError, "substring"
1.334 -
1.335 - def concat(self, str):
1.336 - raise NotImplementedError, "concat"
1.337 -
1.338 - def replace(self, oldChar, newChar):
1.339 - raise NotImplementedError, "replace"
1.340 -
1.341 - def toLowerCase(self, *args):
1.342 - # toLowerCase(self, locale)
1.343 - # toLowerCase(self)
1.344 - raise NotImplementedError, "toLowerCase"
1.345 -
1.346 - def toUpperCase(self, *args):
1.347 - # toUpperCase(self, locale)
1.348 - # toUpperCase(self)
1.349 - raise NotImplementedError, "toUpperCase"
1.350 -
1.351 - def trim(self):
1.352 - raise NotImplementedError, "trim"
1.353 -
1.354 - def toString(self):
1.355 - return self
1.356 -
1.357 - def toCharArray(self):
1.358 - raise NotImplementedError, "toCharArray"
1.359 -
1.360 - def valueOf(self, *args):
1.361 - # valueOf(self, obj)
1.362 - # valueOf(self, data)
1.363 - # valueOf(self, data, offset, count)
1.364 - # valueOf(self, b)
1.365 - # valueOf(self, c)
1.366 - # valueOf(self, l)
1.367 - # valueOf(self, f)
1.368 - # valueOf(self, d)
1.369 - raise NotImplementedError, "valueOf"
1.370 - valueOf = staticmethod(valueOf)
1.371 -
1.372 - def copyValueOf(self, *args):
1.373 - # copyValueOf(self, data, offset, count)
1.374 - # copyValueOf(self, data)
1.375 - raise NotImplementedError, "copyValueOf"
1.376 - copyValueOf = staticmethod(copyValueOf)
1.377 -
1.378 - def intern(self):
1.379 - raise NotImplementedError, "intern"
1.380 -
1.381 -setattr(String, "__init_____", String.init__empty)
1.382 -setattr(String, "__init_____java__lang__String", String.init__String)
1.383 -
1.384 -class System(object):
1.385 - in_ = java.io.InputStream(sys.stdin)
1.386 - out = java.io.PrintStream(sys.stdout)
1.387 - err = java.io.PrintStream(sys.stderr)
1.388 -
1.389 - def getProperty___java__lang__String(key):
1.390 - try:
1.391 - return os.environ[key]
1.392 - except KeyError:
1.393 - return None
1.394 -
1.395 - getProperty___java__lang__String = staticmethod(getProperty___java__lang__String)
1.396 -
1.397 -setattr(System, "in", System.in_)
1.398 -
1.399 -# vim: tabstop=4 expandtab shiftwidth=4