1 #!/usr/bin/env python 2 3 class Character(object): 4 def __init__(self, value): 5 raise NotImplementedError, "__init__" 6 def charValue(self): 7 raise NotImplementedError, "charValue" 8 def hashCode(self): 9 raise NotImplementedError, "hashCode" 10 def equals(self, anObject): 11 raise NotImplementedError, "equals" 12 def toString(self): 13 raise NotImplementedError, "toString" 14 def isLowerCase(self, ch): 15 raise NotImplementedError, "isLowerCase" 16 isLowerCase = staticmethod(isLowerCase) 17 def isUpperCase(self, ch): 18 raise NotImplementedError, "isUpperCase" 19 isUpperCase = staticmethod(isUpperCase) 20 def isTitleCase(self, ch): 21 raise NotImplementedError, "isTitleCase" 22 isTitleCase = staticmethod(isTitleCase) 23 def isDigit(self, ch): 24 raise NotImplementedError, "isDigit" 25 isDigit = staticmethod(isDigit) 26 def isDefined(self, ch): 27 raise NotImplementedError, "isDefined" 28 isDefined = staticmethod(isDefined) 29 def isLetter(self, ch): 30 raise NotImplementedError, "isLetter" 31 isLetter = staticmethod(isLetter) 32 def isLetterOrDigit(self, ch): 33 raise NotImplementedError, "isLetterOrDigit" 34 isLetterOrDigit = staticmethod(isLetterOrDigit) 35 def isJavaLetter(self, ch): 36 raise NotImplementedError, "isJavaLetter" 37 isJavaLetter = staticmethod(isJavaLetter) 38 def isJavaLetterOrDigit(self, ch): 39 raise NotImplementedError, "isJavaLetterOrDigit" 40 isJavaLetterOrDigit = staticmethod(isJavaLetterOrDigit) 41 def isJavaIdentifierStart(self, ch): 42 raise NotImplementedError, "isJavaIdentifierStart" 43 isJavaIdentifierStart = staticmethod(isJavaIdentifierStart) 44 def isJavaIdentifierPart(self, ch): 45 raise NotImplementedError, "isJavaIdentifierPart" 46 isJavaIdentifierPart = staticmethod(isJavaIdentifierPart) 47 def isUnicodeIdentifierStart(self, ch): 48 raise NotImplementedError, "isUnicodeIdentifierStart" 49 isUnicodeIdentifierStart = staticmethod(isUnicodeIdentifierStart) 50 def isUnicodeIdentifierPart(self, ch): 51 raise NotImplementedError, "isUnicodeIdentifierPart" 52 isUnicodeIdentifierPart = staticmethod(isUnicodeIdentifierPart) 53 def isIdentifierIgnorable(self, ch): 54 raise NotImplementedError, "isIdentifierIgnorable" 55 isIdentifierIgnorable = staticmethod(isIdentifierIgnorable) 56 def toLowerCase(self, ch): 57 raise NotImplementedError, "toLowerCase" 58 toLowerCase = staticmethod(toLowerCase) 59 def toUpperCase(self, ch): 60 raise NotImplementedError, "toUpperCase" 61 toUpperCase = staticmethod(toUpperCase) 62 def toTitleCase(self, ch): 63 raise NotImplementedError, "toTitleCase" 64 toTitleCase = staticmethod(toTitleCase) 65 def digit(self, ch, radix): 66 raise NotImplementedError, "digit" 67 digit = staticmethod(digit) 68 def getNumericValue(self, ch): 69 raise NotImplementedError, "getNumericValue" 70 getNumericValue = staticmethod(getNumericValue) 71 def isSpace(self, ch): 72 raise NotImplementedError, "isSpace" 73 isSpace = staticmethod(isSpace) 74 def isSpaceChar(self, ch): 75 raise NotImplementedError, "isSpaceChar" 76 isSpaceChar = staticmethod(isSpaceChar) 77 def isWhitespace(self, ch): 78 raise NotImplementedError, "isWhitespace" 79 isWhitespace = staticmethod(isWhitespace) 80 def isISOControl(self, ch): 81 raise NotImplementedError, "isISOControl" 82 isISOControl = staticmethod(isISOControl) 83 def getType(self, ch): 84 raise NotImplementedError, "getType" 85 getType = staticmethod(getType) 86 def forDigit(self, ch, radix): 87 raise NotImplementedError, "forDigit" 88 forDigit = staticmethod(forDigit) 89 def compareTo(self, *args): 90 # compareTo(self, anotherCharacter) 91 # compareTo(self, o) 92 raise NotImplementedError, "compareTo" 93 94 class String(object): 95 def __init__(self, *args): 96 # Python string initialisation: 97 if len(args) == 1 and isinstance(args[0], str): 98 self.value = unicode(args[0]) 99 return 100 elif len(args) == 1 and isinstance(args[0], unicode): 101 self.value = args[0] 102 return 103 # __init__(self) 104 elif len(args) == 0: 105 self.value = u"" 106 return 107 # __init__(self, original) 108 elif len(args) == 1 and isinstance(args[0], String): 109 self.value = args[0].value 110 return 111 # __init__(self, value) 112 # __init__(self, value, offset, count) 113 # __init__(self, ascii, hibyte, offset, count) 114 # __init__(self, ascii, hibyte) 115 # __init__(self, bytes, offset, length, enc) 116 # __init__(self, bytes, enc) 117 # __init__(self, bytes, offset, length) 118 # __init__(self, bytes) 119 elif len(args) >= 1 and isinstance(args[0], list): 120 raise NotImplementedError, "__init__" 121 # __init__(self, buffer) 122 raise NotImplementedError, "__init__" 123 def length(self): 124 return len(self.value) 125 def charAt(self, index): 126 return self.value[index] 127 def getChars(self, srcBegin, srcEnd, dst, dstBegin): 128 raise NotImplementedError, "getChars" 129 def getBytes(self, *args): 130 # void getBytes(self, srcBegin, srcEnd, dst, dstBegin) 131 # byte[] getBytes(self, enc) 132 # byte[] getBytes(self) 133 raise NotImplementedError, "getBytes" 134 def equals(self, anObject): 135 raise NotImplementedError, "equals" 136 def compareTo(self, obj): 137 raise NotImplementedError, "compareTo" 138 # NOTE: Comparator defined using private classes. 139 def compareToIgnoreCase(self, str): 140 raise NotImplementedError, "compareToIgnoreCase" 141 def regionMatches(self, *args): 142 # regionMatches(self, toffset, other, ooffset, len) 143 # regionMatches(self, ignoreCase, toffset, other, ooffset, len) 144 raise NotImplementedError, "regionMatches" 145 def startsWith(self, *args): 146 # startsWith(self, prefix, toffset) 147 # startsWith(self, prefix) 148 raise NotImplementedError, "startsWith" 149 def endsWith(self, suffix): 150 raise NotImplementedError, "endsWith" 151 def hashCode(self): 152 raise NotImplementedError, "hashCode" 153 def indexOf(self, *args): 154 # indexOf(self, ch) 155 # indexOf(self, ch, fromIndex) 156 # indexOf(self, str) 157 # indexOf(self, str, fromIndex) 158 raise NotImplementedError, "indexOf" 159 def lastIndexOf(self, *args): 160 # lastIndexOf(self, ch) 161 # lastIndexOf(self, ch, fromIndex) 162 # lastIndexOf(self, str) 163 # lastIndexOf(self, str, fromIndex) 164 raise NotImplementedError, "lastIndexOf" 165 def substring(self, *args): 166 # substring(self, beginIndex) 167 # substring(self, beginIndex, endIndex) 168 raise NotImplementedError, "substring" 169 def concat(self, str): 170 raise NotImplementedError, "concat" 171 def replace(self, oldChar, newChar): 172 raise NotImplementedError, "replace" 173 def toLowerCase(self, *args): 174 # toLowerCase(self, locale) 175 # toLowerCase(self) 176 raise NotImplementedError, "toLowerCase" 177 def toUpperCase(self, *args): 178 # toUpperCase(self, locale) 179 # toUpperCase(self) 180 raise NotImplementedError, "toUpperCase" 181 def trim(self): 182 raise NotImplementedError, "trim" 183 def toString(self): 184 return self 185 def toCharArray(self): 186 raise NotImplementedError, "toCharArray" 187 def valueOf(self, *args): 188 # valueOf(self, obj) 189 # valueOf(self, data) 190 # valueOf(self, data, offset, count) 191 # valueOf(self, b) 192 # valueOf(self, c) 193 # valueOf(self, l) 194 # valueOf(self, f) 195 # valueOf(self, d) 196 raise NotImplementedError, "valueOf" 197 valueOf = staticmethod(valueOf) 198 def copyValueOf(self, *args): 199 # copyValueOf(self, data, offset, count) 200 # copyValueOf(self, data) 201 raise NotImplementedError, "copyValueOf" 202 copyValueOf = staticmethod(copyValueOf) 203 def intern(self): 204 raise NotImplementedError, "intern" 205 206 # vim: tabstop=4 expandtab shiftwidth=4