private bool equals(char[] text1, int off, int len, char[] text2) { if (len != text2.Length) { return(false); } if (_ignoreCase) { for (int i = 0; i < len; i++) { if (Character.toLowerCase(text1[off + i]) != text2[i]) { return(false); } } } else { for (int i = 0; i < len; i++) { if (text1[off + i] != text2[i]) { return(false); } } } return(true); }
private bool equals(CharSequence text1, char[] text2) { int len = text1.length(); if (len != text2.Length) { return(false); } if (_ignoreCase) { for (int i = 0; i < len; i++) { if (Character.toLowerCase(text1.charAt(i)) != text2[i]) { return(false); } } } else { for (int i = 0; i < len; i++) { if (text1.charAt(i) != text2[i]) { return(false); } } } return(true); }
/** Add this key,val pair to the map. * The char[] key is directly used, no copy is made. * If ignoreCase is true for this Map, the key array will be directly modified. * The user should never modify the key after calling this method. */ public object put(char[] key, object val) { if (_ignoreCase) { for (int i = 0; i < key.Length; i++) { key[i] = Character.toLowerCase(key[i]); } } int slot = getSlot(key, 0, key.Length); if (keys[slot] == null) { count++; } object prev = values[slot]; keys[slot] = key; values[slot] = val; if (count + (count >> 2) >= keys.Length) { rehash(); } return(prev); }
static WordDelimiterFilter() { byte[] tab = new byte[256]; for (int i = 0; i < 256; i++) { byte code = 0; if (Character.isLowerCase(i)) { code |= LOWER; } else if (Character.isUpperCase(i)) { code |= UPPER; } else if (Character.isDigit(i)) { code |= DIGIT; } if (code == 0) { code = SUBWORD_DELIM; } tab[i] = code; } defaultWordDelimTable = tab; }
private int getHashCode(CharSequence text) { int code; if (_ignoreCase) { code = 0; int len = text.length(); for (int i = 0; i < len; i++) { code = code * 31 + Character.toLowerCase(text.charAt(i)); } } else { #pragma warning disable 184 if (false && text is string) #pragma warning restore 184 { code = text.GetHashCode(); } else { code = 0; int len = text.length(); for (int i = 0; i < len; i++) { code = code * 31 + text.charAt(i); } } } return(code); }
public static global::System.Object get(global::java.lang.Object n1, int n2){ //XMLVM_BEGIN_WRAPPER[java.lang.reflect.Array: java.lang.Object get(java.lang.Object, int)] throw new org.xmlvm._nNotYetImplementedException("native/wrapper method not yet implemented"); if (n1==null) { java.lang.NullPointerException jex = new java.lang.NullPointerException(); jex.@this(); throw new org.xmlvm._nExceptionAdapter(jex); } else if (n1 is org.xmlvm._nArrayAdapter<object>) { return ((org.xmlvm._nArrayAdapter<object>) n1)[n2]; } else if (n1 is org.xmlvm._nArrayAdapter<bool>) { bool unwrappedBoolean = ((org.xmlvm._nArrayAdapter<bool>) n1)[n2]; java.lang.Boolean result = new java.lang.Boolean(); result.@this(unwrappedBoolean); return result; } else if (n1 is org.xmlvm._nArrayAdapter<sbyte>) { sbyte unwrappedByte = ((org.xmlvm._nArrayAdapter<sbyte>) n1)[n2]; java.lang.Byte result = new java.lang.Byte(); result.@this(unwrappedByte); return result; } else if (n1 is org.xmlvm._nArrayAdapter<char>) { char unwrappedChar = ((org.xmlvm._nArrayAdapter<char>) n1)[n2]; java.lang.Character result = new java.lang.Character(); result.@this(unwrappedChar); return result; } else if (n1 is org.xmlvm._nArrayAdapter<short>) { short unwrappedShort = ((org.xmlvm._nArrayAdapter<short>) n1)[n2]; java.lang.Short result = new java.lang.Short(); result.@this(unwrappedShort); return result; } else if (n1 is org.xmlvm._nArrayAdapter<int>) { int unwrappedInteger = ((org.xmlvm._nArrayAdapter<int>) n1)[n2]; java.lang.Integer result = new java.lang.Integer(); result.@this(unwrappedInteger); return result; } else if (n1 is org.xmlvm._nArrayAdapter<long>) { long unwrappedLong = ((org.xmlvm._nArrayAdapter<long>) n1)[n2]; java.lang.Long result = new java.lang.Long(); result.@this(unwrappedLong); return result; } else if (n1 is org.xmlvm._nArrayAdapter<float>) { float unwrappedFloat = ((org.xmlvm._nArrayAdapter<float>) n1)[n2]; java.lang.Float result = new java.lang.Float(); result.@this(unwrappedFloat); return result; } else if (n1 is org.xmlvm._nArrayAdapter<double>) { double unwrappedDouble = ((org.xmlvm._nArrayAdapter<double>) n1)[n2]; java.lang.Double result = new java.lang.Double(); result.@this(unwrappedDouble); return result; } else if (!(n1 is org.xmlvm._nIArray)) { // it is not an org.xmlvm._nIArray java.lang.IllegalArgumentException jex = new java.lang.IllegalArgumentException(); jex.@this(org.xmlvm._nUtil.toJavaString("Not an array")); throw new org.xmlvm._nExceptionAdapter(jex); } else { // something went wrong throw new org.xmlvm._nNativeImplementationException(); } //XMLVM_END_WRAPPER[java.lang.reflect.Array: java.lang.Object get(java.lang.Object, int)] }
public static int CompareTo(javaChar self, object value) { if (value == null) { return(1); } if (!(value is Char)) { throw new ArgumentException(Environment.GetResourceString("Arg_MustBeChar")); } return(self.charValue() - ((char)value)); }
internal static object Unbox(object val) { #if STATIC_COMPILER || FIRST_PASS || STUB_GENERATOR return(null); #else java.lang.Byte b = val as java.lang.Byte; if (b != null) { return(b.byteValue()); } java.lang.Boolean b1 = val as java.lang.Boolean; if (b1 != null) { return(b1.booleanValue()); } java.lang.Short s = val as java.lang.Short; if (s != null) { return(s.shortValue()); } java.lang.Character c = val as java.lang.Character; if (c != null) { return(c.charValue()); } java.lang.Integer i = val as java.lang.Integer; if (i != null) { return(i.intValue()); } java.lang.Float f = val as java.lang.Float; if (f != null) { return(f.floatValue()); } java.lang.Long l = val as java.lang.Long; if (l != null) { return(l.longValue()); } java.lang.Double d = val as java.lang.Double; if (d != null) { return(d.doubleValue()); } else { throw new java.lang.IllegalArgumentException(); } #endif }
int charType(int ch) { if (ch < charTypeTable.Length) { return(charTypeTable[ch]); } switch (Character.getType(ch)) { case Character.UPPERCASE_LETTER: return(UPPER); case Character.LOWERCASE_LETTER: return(LOWER); case Character.TITLECASE_LETTER: case Character.MODIFIER_LETTER: case Character.OTHER_LETTER: case Character.NON_SPACING_MARK: case Character.ENCLOSING_MARK: // depends what it encloses? case Character.COMBINING_SPACING_MARK: return(ALPHA); case Character.DECIMAL_DIGIT_NUMBER: case Character.LETTER_NUMBER: case Character.OTHER_NUMBER: return(DIGIT); // case Character.SPACE_SEPARATOR: // case Character.LINE_SEPARATOR: // case Character.PARAGRAPH_SEPARATOR: // case Character.CONTROL: // case Character.FORMAT: // case Character.PRIVATE_USE: case Character.SURROGATE: // prevent splitting return(ALPHA | DIGIT); // case Character.DASH_PUNCTUATION: // case Character.START_PUNCTUATION: // case Character.END_PUNCTUATION: // case Character.CONNECTOR_PUNCTUATION: // case Character.OTHER_PUNCTUATION: // case Character.MATH_SYMBOL: // case Character.CURRENCY_SYMBOL: // case Character.MODIFIER_SYMBOL: // case Character.OTHER_SYMBOL: // case Character.INITIAL_QUOTE_PUNCTUATION: // case Character.FINAL_QUOTE_PUNCTUATION: default: return(SUBWORD_DELIM); } }
private int getHashCode(char[] text, int len) { int code = 0; if (_ignoreCase) { for (int i = 0; i < len; i++) { code = code * 31 + Character.toLowerCase(text[i]); } } else { for (int i = 0; i < len; i++) { code = code * 31 + text[i]; } } return(code); }
public static CharMap GetAdapter(javaChar self) { return(new CharMap(self.charValue())); }
public static java.lang.Object boxIfPrimitive(global::System.Object aValue, global::System.Type aType) { if (!aType.GetTypeInfo().IsPrimitive) { return (java.lang.Object) aValue; // do nothing } else if (aType.Equals(booleanType)) { java.lang.Boolean boolBox = new java.lang.Boolean(); boolBox.@this((bool) aValue); return boolBox; } else if (aType.Equals(byteType)) { java.lang.Byte byteBox = new java.lang.Byte(); byteBox.@this((sbyte) aValue); return byteBox; } else if (aType.Equals(charType)) { java.lang.Character charBox = new java.lang.Character(); charBox.@this((char) aValue); return charBox; } else if (aType.Equals(shortType)) { java.lang.Short shortBox = new java.lang.Short(); shortBox.@this((short) aValue); return shortBox; } else if (aType.Equals(intType)) { java.lang.Integer intBox = new java.lang.Integer(); intBox.@this((int) aValue); return intBox; } else if (aType.Equals(longType)) { java.lang.Long longBox = new java.lang.Long(); longBox.@this((long) aValue); return longBox; } else if (aType.Equals(floatType)) { java.lang.Float floatBox = new java.lang.Float(); floatBox.@this((float) aValue); return floatBox; } else if (aType.Equals(doubleType)) { java.lang.Double doubleBox = new java.lang.Double(); doubleBox.@this((double) aValue); return doubleBox; } else if (aType.Equals(voidType)) { java.lang.Void voidBox = new java.lang.Void(); voidBox.@this(); return voidBox; } else { throw new org.xmlvm._nNativeImplementationException(); } }
public static TypeCode GetTypeCode(javaChar self) { return(TypeCode.Char); }
public static string ToString(javaChar self, IFormatProvider provider) { return(new string(self.charValue(), 1)); }
public static int CompareTo(javaChar self, char value) { return(self.charValue() - value); }
/* * public static java.lang.String nativeTypeToJavaTypeName(global::System.Type nativeType) { * string result; * _nTIB tib; * if(!tibTable.TryGetValue(nativeType, out tib)) { * // if it is not already in the table, * // then the native type name is the same as the java counterpart * result = nativeType.ToString(); * tib = new _nTIB(nativeType, result); * tibTable.Add(nativeType, tib); * jNameTable.Add(result, tib); * bootstrapSetClass(tib); * } else { * result = tib.getJavaName(); * } * return org.xmlvm._nUtil.toJavaString(result); * } */ public static java.lang.Object boxIfPrimitive(global::System.Object aValue, global::System.Type aType) { if (!aType.IsPrimitive) { return((java.lang.Object)aValue); // do nothing } else if (aType.Equals(booleanType)) { java.lang.Boolean boolBox = new java.lang.Boolean(); boolBox.@this((bool)aValue); return(boolBox); } else if (aType.Equals(byteType)) { java.lang.Byte byteBox = new java.lang.Byte(); byteBox.@this((sbyte)aValue); return(byteBox); } else if (aType.Equals(charType)) { java.lang.Character charBox = new java.lang.Character(); charBox.@this((char)aValue); return(charBox); } else if (aType.Equals(shortType)) { java.lang.Short shortBox = new java.lang.Short(); shortBox.@this((short)aValue); return(shortBox); } else if (aType.Equals(intType)) { java.lang.Integer intBox = new java.lang.Integer(); intBox.@this((int)aValue); return(intBox); } else if (aType.Equals(longType)) { java.lang.Long longBox = new java.lang.Long(); longBox.@this((long)aValue); return(longBox); } else if (aType.Equals(floatType)) { java.lang.Float floatBox = new java.lang.Float(); floatBox.@this((float)aValue); return(floatBox); } else if (aType.Equals(doubleType)) { java.lang.Double doubleBox = new java.lang.Double(); doubleBox.@this((double)aValue); return(doubleBox); } else if (aType.Equals(voidType)) { java.lang.Void voidBox = new java.lang.Void(); voidBox.@this(); return(voidBox); } else { throw new org.xmlvm._nNativeImplementationException(); } }
public static bool Equals(javaChar self, char obj) { return(self.charValue() == obj); }
public static global::System.Object get(global::java.lang.Object n1, int n2) { //XMLVM_BEGIN_WRAPPER[java.lang.reflect.Array: java.lang.Object get(java.lang.Object, int)] throw new org.xmlvm._nNotYetImplementedException("native/wrapper method not yet implemented"); if (n1 == null) { java.lang.NullPointerException jex = new java.lang.NullPointerException(); jex.@this(); throw new org.xmlvm._nExceptionAdapter(jex); } else if (n1 is org.xmlvm._nArrayAdapter <object> ) { return(((org.xmlvm._nArrayAdapter <object>)n1)[n2]); } else if (n1 is org.xmlvm._nArrayAdapter <bool> ) { bool unwrappedBoolean = ((org.xmlvm._nArrayAdapter <bool>)n1)[n2]; java.lang.Boolean result = new java.lang.Boolean(); result.@this(unwrappedBoolean); return(result); } else if (n1 is org.xmlvm._nArrayAdapter <sbyte> ) { sbyte unwrappedByte = ((org.xmlvm._nArrayAdapter <sbyte>)n1)[n2]; java.lang.Byte result = new java.lang.Byte(); result.@this(unwrappedByte); return(result); } else if (n1 is org.xmlvm._nArrayAdapter <char> ) { char unwrappedChar = ((org.xmlvm._nArrayAdapter <char>)n1)[n2]; java.lang.Character result = new java.lang.Character(); result.@this(unwrappedChar); return(result); } else if (n1 is org.xmlvm._nArrayAdapter <short> ) { short unwrappedShort = ((org.xmlvm._nArrayAdapter <short>)n1)[n2]; java.lang.Short result = new java.lang.Short(); result.@this(unwrappedShort); return(result); } else if (n1 is org.xmlvm._nArrayAdapter <int> ) { int unwrappedInteger = ((org.xmlvm._nArrayAdapter <int>)n1)[n2]; java.lang.Integer result = new java.lang.Integer(); result.@this(unwrappedInteger); return(result); } else if (n1 is org.xmlvm._nArrayAdapter <long> ) { long unwrappedLong = ((org.xmlvm._nArrayAdapter <long>)n1)[n2]; java.lang.Long result = new java.lang.Long(); result.@this(unwrappedLong); return(result); } else if (n1 is org.xmlvm._nArrayAdapter <float> ) { float unwrappedFloat = ((org.xmlvm._nArrayAdapter <float>)n1)[n2]; java.lang.Float result = new java.lang.Float(); result.@this(unwrappedFloat); return(result); } else if (n1 is org.xmlvm._nArrayAdapter <double> ) { double unwrappedDouble = ((org.xmlvm._nArrayAdapter <double>)n1)[n2]; java.lang.Double result = new java.lang.Double(); result.@this(unwrappedDouble); return(result); } else if (!(n1 is org.xmlvm._nIArray)) { // it is not an org.xmlvm._nIArray java.lang.IllegalArgumentException jex = new java.lang.IllegalArgumentException(); jex.@this(org.xmlvm._nUtil.toJavaString("Not an array")); throw new org.xmlvm._nExceptionAdapter(jex); } else { // something went wrong throw new org.xmlvm._nNativeImplementationException(); } //XMLVM_END_WRAPPER[java.lang.reflect.Array: java.lang.Object get(java.lang.Object, int)] }