public int getJdbcType() // throws IllegalStateException { string name = this.ToString(); try { // We assume that the JdbcTypes class only consists of constant // integer types, so we make no assertions here FieldInfo[] fields = typeof(JdbcTypes).GetFields(); for (int i = 0; i < fields.Length; i++) { FieldInfo field = fields[i]; string fieldName = field.Name; if (fieldName.Equals(name)) { CsInteger value = CsInteger.ZERO; field.GetValue(value); return(value); } } throw new InvalidOperationException("No JdbcType found with field name: " + name); } catch (Exception e) { throw new InvalidOperationException("Could not access fields in JdbcTypes", e); } } // getJdbcType()
} // getComparable() public int Compare(object o1, object o2) { CsNumber n1 = toNumber(o1); CsNumber n2 = toNumber(o2); if (n1 == null && n2 == null) { return(0); } if (n1 == null) { return(-1); } if (n2 == null) { return(1); } if (n1 is CsNumber && n2 is CsNumber) { return((n1.asBigInteger()).CompareTo(n2.asBigInteger())); } //if (n1 is BigDecimal && n2 is BigDecimal) { // return ((BigDecimal)n1).compareTo((BigDecimal)n2); //} if (NumberComparator.IsIntegerType(n1) && NumberComparator.IsIntegerType(n2)) { return(CsInteger.ValueOf(n1).CompareTo(n2.asLong())); } return(CsNumber.ValueOf(n1).CompareTo(n2.asLong())); } // Compare()
public override string ToString() { // overridden version of toString() method that uses identity hash code // (to prevent hashCode() recursion due to logging!) return(GetType().Name + "@" + CsInteger.ToHexString(CsSystem.IdentityHashCode(this))); // Integer.toHexString(System.identityHashCode(this)); } // ToString()
} // constructor public StyleImpl(bool bold, bool italic, bool underline, CsInteger fontSize, SizeUnit fontSizeUnit, TextAlignment alignment, Color backgroundColor, Color foregroundColor) { _bold = bold; _italic = italic; _underline = underline; _fontSize = fontSize; _fontSizeUnit = fontSizeUnit; _alignment = alignment; _backgroundColor = backgroundColor; _foregroundColor = foregroundColor; } // constructor
} // ValueOf() public static string ToHexString(CsInteger value_arg) { return(CsInteger.ToHexString(value_arg)); } // ToHexString()
} // constructor public static int ValueOf(CsInteger value_arg) { return(value_arg.asInt()); } // ValueOf()