Java Doc for BinaryDecimal.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » types » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.iapi.types 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.iapi.types.DataType
      org.apache.derby.iapi.types.NumberDataType
         org.apache.derby.iapi.types.BinaryDecimal

All known Subclasses:   org.apache.derby.iapi.types.BigIntegerDecimal,
BinaryDecimal
abstract class BinaryDecimal extends NumberDataType implements VariableSizeDataValue(Code)
SQL DECIMAL using raw data. Provides the basis for the CDCDecimal implementation.

The on-disk format must match the SQLDecimal format so that databases are portable across J2ME and J2SE environments.

The format of the byte array is defined by the return of the java.math.BigInteger.toByteArray:, extracted here. Returns a byte array containing the two's-complement representation of this BigInteger. The byte array will be in big-endian byte-order: the most significant byte is in the zeroth element. This is the format for DECIMAL even if BigINteger is not available, e.g. OSGi ee.minimum.



Field Summary
protected  byte[]data2c
     The unscaled value as a binary two's complement array.
protected  intsqlScale
    

Constructor Summary
 BinaryDecimal()
    

Method Summary
public  NumberDataValuedivide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result)
    
final public  NumberDataValuedivide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result, int scale)
    
abstract public  NumberDataValuedivideNN(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result, int scale)
     Divide two non-nullable values using DECIMAL arithmetic.
public  intestimateMemoryUsage()
    
final public  bytegetByte()
     Return a byte from this value.
public  DataValueDescriptorgetClone()
    
public  intgetDecimalValueScale()
     Return the SQL scale of this value, number of digits after the decimal point, or zero for a whole number.
final public  intgetInt()
     Return a int from this value.
final public  intgetLength()
    
final public  shortgetShort()
     Return a short from this value.
final public  intgetTypeFormatId()
     Return my format identifier.
final public  StringgetTypeName()
    
public  inthashCode()
    
protected  booleanisNegative()
    
public  booleanisNull()
     see if the decimal value is null.
final public  NumberDataValueminus(NumberDataValue left, NumberDataValue right, NumberDataValue result)
    
public  NumberDataValueminusNN(NumberDataValue left, NumberDataValue right, NumberDataValue result)
     Implement subtraction using addition and negation of the right value.
final public  NumberDataValueplus(NumberDataValue addend1, NumberDataValue addend2, NumberDataValue result)
     This method implements the + operator for DECIMAL.
abstract public  NumberDataValueplusNN(NumberDataValue addend1, NumberDataValue addend2, NumberDataValue result)
     Add two non-nullable values using DECIMAL arithmetic.
public  voidreadExternal(ObjectInput in)
     Note the use of data2c: we reuse the array if the incoming array is the same length or smaller than the array length.
public  voidreadExternalFromArray(ArrayInputStream in)
    
public  voidrestoreToNull()
    
protected  voidsetFrom(DataValueDescriptor dvd)
    
public  voidsetValue(long theValue)
     Set the value from a long.
final public  voidsetValue(int theValue)
     Set the value from an int, just copy 'byte-by-byte' from the int to a four byte array.
public  voidsetValue(boolean theValue)
    
final public  voidsetValue(double theValue)
     Convert from a double, normalize and then convert as a String.
final public  voidsetValue(float theValue)
     Convert from a float, normalize and then convert as a String.
public  voidsetValue(Number theValue)
     Called when setting a DECIMAL value internally or from through a procedure or function.
public  voidsetValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable)
    
final public  NumberDataValuetimes(NumberDataValue left, NumberDataValue right, NumberDataValue result)
    
abstract public  NumberDataValuetimesNN(NumberDataValue left, NumberDataValue right, NumberDataValue result)
     Multiple two non-nullable values using DECIMAL arithmetic.
final public  inttypePrecedence()
    
final public  inttypeToBigDecimal()
     DECIMAL implementation.
public  voidwriteExternal(ObjectOutput out)
    

Field Detail
data2c
protected byte[] data2c(Code)
The unscaled value as a binary two's complement array.



sqlScale
protected int sqlScale(Code)
The SQL scale, zero or positive, of the value




Constructor Detail
BinaryDecimal
BinaryDecimal()(Code)




Method Detail
divide
public NumberDataValue divide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result) throws StandardException(Code)



divide
final public NumberDataValue divide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result, int scale) throws StandardException(Code)
This method implements the / operator for BigDecimal/BigDecimal
Parameters:
  dividend - The numerator
Parameters:
  divisor - The denominator
Parameters:
  result - The result of a previous call to this method, nullif not called yet
Parameters:
  scale - The result scale, if < 0, calculate the scale accordingto the actual values' sizes A SQLDecimal containing the result of the division
exception:
  StandardException - Thrown on error



divideNN
abstract public NumberDataValue divideNN(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result, int scale) throws StandardException(Code)
Divide two non-nullable values using DECIMAL arithmetic.



estimateMemoryUsage
public int estimateMemoryUsage()(Code)



getByte
final public byte getByte() throws StandardException(Code)
Return a byte from this value.
exception:
  StandardException - this value is out of range for a short



getClone
public DataValueDescriptor getClone()(Code)



getDecimalValueScale
public int getDecimalValueScale()(Code)
Return the SQL scale of this value, number of digits after the decimal point, or zero for a whole number.



getInt
final public int getInt() throws StandardException(Code)
Return a int from this value.
exception:
  StandardException - this value is out of range for an int



getLength
final public int getLength()(Code)



getShort
final public short getShort() throws StandardException(Code)
Return a short from this value.
exception:
  StandardException - this value is out of range for a short



getTypeFormatId
final public int getTypeFormatId()(Code)
Return my format identifier.
See Also:   org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId



getTypeName
final public String getTypeName()(Code)



hashCode
public int hashCode()(Code)



isNegative
protected boolean isNegative()(Code)



isNull
public boolean isNull()(Code)
see if the decimal value is null.



minus
final public NumberDataValue minus(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException(Code)



minusNN
public NumberDataValue minusNN(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException(Code)
Implement subtraction using addition and negation of the right value.



plus
final public NumberDataValue plus(NumberDataValue addend1, NumberDataValue addend2, NumberDataValue result) throws StandardException(Code)
This method implements the + operator for DECIMAL.
Parameters:
  addend1 - One of the addends
Parameters:
  addend2 - The other addend
Parameters:
  result - The result of a previous call to this method, nullif not called yet A SQLDecimal containing the result of the addition
exception:
  StandardException - Thrown on error



plusNN
abstract public NumberDataValue plusNN(NumberDataValue addend1, NumberDataValue addend2, NumberDataValue result) throws StandardException(Code)
Add two non-nullable values using DECIMAL arithmetic. For subclasses of BinaryDecimal, any implementation must handle the result and addend2 (right) being references to the same object.



readExternal
public void readExternal(ObjectInput in) throws IOException(Code)
Note the use of data2c: we reuse the array if the incoming array is the same length or smaller than the array length.
See Also:   java.io.Externalizable.readExternal
See Also:   



readExternalFromArray
public void readExternalFromArray(ArrayInputStream in) throws IOException(Code)



restoreToNull
public void restoreToNull()(Code)



setFrom
protected void setFrom(DataValueDescriptor dvd) throws StandardException(Code)
Set this DECIMAL value from another DataValueDescriptor



setValue
public void setValue(long theValue)(Code)
Set the value from a long.



setValue
final public void setValue(int theValue)(Code)
Set the value from an int, just copy 'byte-by-byte' from the int to a four byte array. Then reduce.
See Also:   NumberDataValue.setValue



setValue
public void setValue(boolean theValue)(Code)
Set the value from a boolean



setValue
final public void setValue(double theValue) throws StandardException(Code)
Convert from a double, normalize and then convert as a String.
exception:
  StandardException - Thrown on error



setValue
final public void setValue(float theValue) throws StandardException(Code)
Convert from a float, normalize and then convert as a String.



setValue
public void setValue(Number theValue) throws StandardException(Code)
Called when setting a DECIMAL value internally or from through a procedure or function. Handles long in addition to BigDecimal to handle identity being stored as a long but returned as a DECIMAL.



setValueFromResultSet
public void setValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable) throws StandardException, SQLException(Code)



times
final public NumberDataValue times(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException(Code)



timesNN
abstract public NumberDataValue timesNN(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException(Code)
Multiple two non-nullable values using DECIMAL arithmetic.



typePrecedence
final public int typePrecedence()(Code)

See Also:   DataValueDescriptor.typePrecedence
See Also:   



typeToBigDecimal
final public int typeToBigDecimal()(Code)
DECIMAL implementation. Use DECIMAL to indicate to self that another passed in value is an instance of this type.



writeExternal
public void writeExternal(ObjectOutput out) throws IOException(Code)
Distill the Decimal to a byte array and Write out:
  • scale (unsigned byte)
  • length of byte array
  • the byte array



Fields inherited from org.apache.derby.iapi.types.NumberDataType
static Comparable MAXLONG_PLUS_ONE(Code)(Java Doc)
static Comparable MINLONG_MINUS_ONE(Code)(Java Doc)
static DataValueDescriptor ZERO_DECIMAL(Code)(Java Doc)

Methods inherited from org.apache.derby.iapi.types.NumberDataType
final public NumberDataValue absolute(NumberDataValue result) throws StandardException(Code)(Java Doc)
final public int compare(DataValueDescriptor arg) throws StandardException(Code)(Java Doc)
final public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException(Code)(Java Doc)
public NumberDataValue divide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result) throws StandardException(Code)(Java Doc)
public NumberDataValue divide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result, int scale) throws StandardException(Code)(Java Doc)
public int getDecimalValuePrecision()(Code)(Java Doc)
public int getDecimalValueScale()(Code)(Java Doc)
abstract protected boolean isNegative()(Code)(Java Doc)
public NumberDataValue minus(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException(Code)(Java Doc)
public NumberDataValue mod(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result) throws StandardException(Code)(Java Doc)
public static double normalizeDOUBLE(double v) throws StandardException(Code)(Java Doc)
public static float normalizeREAL(float v) throws StandardException(Code)(Java Doc)
public static float normalizeREAL(double v) throws StandardException(Code)(Java Doc)
final protected boolean objectNull(Object o)(Code)(Java Doc)
public NumberDataValue plus(NumberDataValue addend1, NumberDataValue addend2, NumberDataValue result) throws StandardException(Code)(Java Doc)
public void setBigDecimal(Number bigDecimal) throws StandardException(Code)(Java Doc)
void setObject(Object theValue) throws StandardException(Code)(Java Doc)
public void setValue(short theValue) throws StandardException(Code)(Java Doc)
public void setValue(byte theValue) throws StandardException(Code)(Java Doc)
public void setValue(Number theValue) throws StandardException(Code)(Java Doc)
public NumberDataValue sqrt(NumberDataValue result) throws StandardException(Code)(Java Doc)
abstract protected int typeCompare(DataValueDescriptor arg) throws StandardException(Code)(Java Doc)
public int typeToBigDecimal()(Code)(Java Doc)

Methods inherited from org.apache.derby.iapi.types.DataType
public void checkHostVariable(int declaredLength) throws StandardException(Code)(Java Doc)
public Object cloneObject()(Code)(Java Doc)
public DataValueDescriptor coalesce(DataValueDescriptor[] argumentsList, DataValueDescriptor returnValue) throws StandardException(Code)(Java Doc)
public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException(Code)(Java Doc)
final protected StandardException dataTypeConversion(String targetType)(Code)(Java Doc)
public BooleanDataValue equals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public boolean equals(Object other)(Code)(Java Doc)
protected static int flip(int operator)(Code)(Java Doc)
void genericSetObject(Object theValue) throws StandardException(Code)(Java Doc)
public boolean getBoolean() throws StandardException(Code)(Java Doc)
public byte getByte() throws StandardException(Code)(Java Doc)
public byte[] getBytes() throws StandardException(Code)(Java Doc)
public Date getDate(Calendar cal) throws StandardException(Code)(Java Doc)
public double getDouble() throws StandardException(Code)(Java Doc)
public float getFloat() throws StandardException(Code)(Java Doc)
public int getInt() throws StandardException(Code)(Java Doc)
public long getLong() throws StandardException(Code)(Java Doc)
protected String getNationalString(LocaleFinder localeFinder) throws StandardException(Code)(Java Doc)
public Object getObject() throws StandardException(Code)(Java Doc)
public short getShort() throws StandardException(Code)(Java Doc)
public InputStream getStream() throws StandardException(Code)(Java Doc)
public Time getTime(Calendar cal) throws StandardException(Code)(Java Doc)
public Timestamp getTimestamp(Calendar cal) throws StandardException(Code)(Java Doc)
public String getTraceString() throws StandardException(Code)(Java Doc)
String getTypeName(String className)(Code)(Java Doc)
public BooleanDataValue greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public BooleanDataValue greaterThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public BooleanDataValue in(DataValueDescriptor left, DataValueDescriptor[] inList, boolean orderedList) throws StandardException(Code)(Java Doc)
final protected StandardException invalidFormat()(Code)(Java Doc)
final public BooleanDataValue isNotNull()(Code)(Java Doc)
final public BooleanDataValue isNullOp()(Code)(Java Doc)
public BooleanDataValue lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public BooleanDataValue lessThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException(Code)(Java Doc)
public BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
final protected StandardException outOfRange()(Code)(Java Doc)
public void setBigDecimal(Number bigDecimal) throws StandardException(Code)(Java Doc)
protected void setFrom(DataValueDescriptor dvd) throws StandardException(Code)(Java Doc)
public void setInto(PreparedStatement ps, int position) throws SQLException, StandardException(Code)(Java Doc)
public void setInto(ResultSet rs, int position) throws SQLException, StandardException(Code)(Java Doc)
void setObject(Object theValue) throws StandardException(Code)(Java Doc)
public void setObjectForCast(Object theValue, boolean instanceOfResultType, String resultTypeClassName) throws StandardException(Code)(Java Doc)
public void setToNull()(Code)(Java Doc)
public void setValue(Time theValue) throws StandardException(Code)(Java Doc)
public void setValue(Time theValue, Calendar cal) throws StandardException(Code)(Java Doc)
public void setValue(Timestamp theValue) throws StandardException(Code)(Java Doc)
public void setValue(Timestamp theValue, Calendar cal) throws StandardException(Code)(Java Doc)
public void setValue(Date theValue) throws StandardException(Code)(Java Doc)
public void setValue(Date theValue, Calendar cal) throws StandardException(Code)(Java Doc)
public void setValue(String theValue) throws StandardException(Code)(Java Doc)
public void setValue(int theValue) throws StandardException(Code)(Java Doc)
public void setValue(double theValue) throws StandardException(Code)(Java Doc)
public void setValue(float theValue) throws StandardException(Code)(Java Doc)
public void setValue(short theValue) throws StandardException(Code)(Java Doc)
public void setValue(long theValue) throws StandardException(Code)(Java Doc)
public void setValue(byte theValue) throws StandardException(Code)(Java Doc)
public void setValue(boolean theValue) throws StandardException(Code)(Java Doc)
public void setValue(byte[] theValue) throws StandardException(Code)(Java Doc)
final public void setValue(DataValueDescriptor dvd) throws StandardException(Code)(Java Doc)
public void setValue(InputStream theStream, int valueLength) throws StandardException(Code)(Java Doc)
public void throwLangSetMismatch(Object value) throws StandardException(Code)(Java Doc)
void throwLangSetMismatch(String argTypeName) throws StandardException(Code)(Java Doc)
public int typePrecedence()(Code)(Java Doc)
public int typeToBigDecimal() throws StandardException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.