Java Doc for UUID.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » util » 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 » Rule Engine » drolls Rule Engine » org.drools.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.drools.util.UUID

UUID
public class UUID implements Serializable,Cloneable,Comparable(Code)
UUID represents Universally Unique Identifiers (aka Global UID in Windows world). UUIDs are usually generated via UUIDGenerator (or in case of 'Null UUID', 16 zero bytes, via static method getNullUUID()), or received from external systems. By default class caches the string presentations of UUIDs so that description is only created the first time it's needed. For memory stingy applications this caching can be turned off (note though that if uuid.toString() is never called, desc is never calculated so only loss is the space allocated for the desc pointer... which can of course be commented out to save memory). Similarly, hash code is calculated when it's needed for the first time, and from thereon that value is just returned. This means that using UUIDs as keys should be reasonably efficient. UUIDs can be compared for equality, serialized, cloned and even sorted. Equality is a simple bit-wise comparison. Ordering (for sorting) is done by first ordering based on type (in the order of numeric values of types), secondarily by time stamp (only for time-based time stamps), and finally by straight numeric byte-by-byte comparison (from most to least significant bytes).


Field Summary
final public static  byteINDEX_CLOCK_HI
    
final public static  byteINDEX_CLOCK_LO
    
final public static  byteINDEX_CLOCK_MID
    
final public static  byteINDEX_CLOCK_SEQUENCE
    
final public static  byteINDEX_TYPE
    
final public static  byteINDEX_VARIATION
    
final public static  StringNAMESPACE_DNS
    
final public static  StringNAMESPACE_OID
    
final public static  StringNAMESPACE_URL
    
final public static  StringNAMESPACE_X500
    
final public static  byteTYPE_DCE
    
final public static  byteTYPE_NAME_BASED
    
final public static  byteTYPE_NULL
    
final public static  byteTYPE_RANDOM_BASED
    
final public static  byteTYPE_TIME_BASED
    

Constructor Summary
public  UUID()
     Default constructor creates a NIL UUID, one that contains all zeroes Note that the clearing of array is actually unnecessary as JVMs are required to clear up the allocated arrays by default.
public  UUID(byte[] data)
     Constructor for cases where you already have the 16-byte binary representation of the UUID (for example if you save UUIDs binary takes less than half of space string representation takes).
public  UUID(byte[] data, int start)
    
 UUID(int type, byte[] data)
    
public  UUID(String id)
     Constructor for creating UUIDs from the canonical string representation Note that implementation is optimized for speed, not necessarily code clarity...

Method Summary
public  byte[]asByteArray()
    
public  Objectclone()
     Default cloning behaviour (bitwise copy) is just fine...
public  intcompareTo(Object o)
     Let's also make UUIDs sortable.
public  booleanequals(Object o)
     Checking equality of UUIDs is easy; just compare the 128-bit number.
public static  UUIDgetNullUUID()
    
public  intgetType()
    
public  inthashCode()
    
public  booleanisNullUUID()
    
public static  voidsetDescCaching(boolean state)
    
public  voidtoByteArray(byte[] dst, int pos)
     Fills in the 16 bytes (from index pos) of the specified byte array with the UUID contents.
public  voidtoByteArray(byte[] dst)
    
public  byte[]toByteArray()
    
public  StringtoString()
    
public static  UUIDvalueOf(String id)
     Constructs a new UUID instance given the canonical string representation of an UUID.
public static  UUIDvalueOf(byte[] src, int start)
     Constructs a new UUID instance given a byte array that contains the (16 byte) binary representation.
public static  UUIDvalueOf(byte[] src)
     Constructs a new UUID instance given a byte array that contains the (16 byte) binary representation.

Field Detail
INDEX_CLOCK_HI
final public static byte INDEX_CLOCK_HI(Code)



INDEX_CLOCK_LO
final public static byte INDEX_CLOCK_LO(Code)



INDEX_CLOCK_MID
final public static byte INDEX_CLOCK_MID(Code)



INDEX_CLOCK_SEQUENCE
final public static byte INDEX_CLOCK_SEQUENCE(Code)



INDEX_TYPE
final public static byte INDEX_TYPE(Code)



INDEX_VARIATION
final public static byte INDEX_VARIATION(Code)



NAMESPACE_DNS
final public static String NAMESPACE_DNS(Code)



NAMESPACE_OID
final public static String NAMESPACE_OID(Code)



NAMESPACE_URL
final public static String NAMESPACE_URL(Code)



NAMESPACE_X500
final public static String NAMESPACE_X500(Code)



TYPE_DCE
final public static byte TYPE_DCE(Code)



TYPE_NAME_BASED
final public static byte TYPE_NAME_BASED(Code)



TYPE_NULL
final public static byte TYPE_NULL(Code)



TYPE_RANDOM_BASED
final public static byte TYPE_RANDOM_BASED(Code)



TYPE_TIME_BASED
final public static byte TYPE_TIME_BASED(Code)




Constructor Detail
UUID
public UUID()(Code)
Default constructor creates a NIL UUID, one that contains all zeroes Note that the clearing of array is actually unnecessary as JVMs are required to clear up the allocated arrays by default.



UUID
public UUID(byte[] data)(Code)
Constructor for cases where you already have the 16-byte binary representation of the UUID (for example if you save UUIDs binary takes less than half of space string representation takes).
Parameters:
  data - array that contains the binary representation of UUID



UUID
public UUID(byte[] data, int start)(Code)
Constructor for cases where you already have the binary representation of the UUID (for example if you save UUIDs binary takes less than half of space string representation takes) in a byte array
Parameters:
  data - array that contains the binary representation of UUID
Parameters:
  start - byte offset where UUID starts



UUID
UUID(int type, byte[] data)(Code)
Protected constructor used by UUIDGenerator
Parameters:
  type - UUID type
Parameters:
  data - 16 byte UUID contents



UUID
public UUID(String id) throws NumberFormatException(Code)
Constructor for creating UUIDs from the canonical string representation Note that implementation is optimized for speed, not necessarily code clarity... Also, since what we get might not be 100% canonical (see below), let's not yet populate mDesc here.
Parameters:
  id - String that contains the canonical representation ofthe UUID to build; 36-char string (see UUID specs for details).Hex-chars may be in upper-case too; UUID class will always outputthem in lowercase.




Method Detail
asByteArray
public byte[] asByteArray()(Code)
Returns the UUID as a 16-byte byte array 16-byte byte array that contains UUID bytes in the networkbyte order



clone
public Object clone()(Code)
Default cloning behaviour (bitwise copy) is just fine... Could clear out cached string presentation, but there's probably no point in doing that.



compareTo
public int compareTo(Object o)(Code)
Let's also make UUIDs sortable. This will mostly/only be useful with time-based UUIDs; they will sorted by time of creation. The order will be strictly correct with UUIDs produced over one JVM's lifetime; that is, if more than one JVMs create UUIDs and/or system is rebooted the order may not be 100% accurate between UUIDs created under different JVMs. For all UUIDs, type is first compared, and UUIDs of different types are sorted together (ie. null UUID is before all other UUIDs, then time-based UUIDs etc). If types are the same, time-based UUIDs' time stamps (including additional clock counter) are compared, so UUIDs created first are ordered first. For all other types (and for time-based UUIDs with same time stamp, which should only occur when comparing a UUID with itself, or with UUIDs created on different JVMs or external systems) binary comparison is done over all 16 bytes.
Parameters:
  o - Object to compare this UUID to; should be a UUID -1 if this UUID should be ordered before the one passed,1 if after, and 0 if they are the same
throws:
  ClassCastException - if o is not a UUID.



equals
public boolean equals(Object o)(Code)
Checking equality of UUIDs is easy; just compare the 128-bit number.



getNullUUID
public static UUID getNullUUID()(Code)
Accessor for getting the shared null UUID the shared null UUID



getType
public int getType()(Code)
Returns the UUID type code UUID type



hashCode
public int hashCode()(Code)



isNullUUID
public boolean isNullUUID()(Code)



setDescCaching
public static void setDescCaching(boolean state)(Code)



toByteArray
public void toByteArray(byte[] dst, int pos)(Code)
Fills in the 16 bytes (from index pos) of the specified byte array with the UUID contents.
Parameters:
  dst - Byte array to fill
Parameters:
  pos - Offset in the array



toByteArray
public void toByteArray(byte[] dst)(Code)



toByteArray
public byte[] toByteArray()(Code)
'Synonym' for 'asByteArray'



toString
public String toString()(Code)



valueOf
public static UUID valueOf(String id) throws NumberFormatException(Code)
Constructs a new UUID instance given the canonical string representation of an UUID. Note that calling this method returns the same result as would using the matching (1 string arg) constructor.
Parameters:
  id - Canonical string representation used for constructingan UUID instance
throws:
  NumberFormatException - if 'id' is invalid UUID



valueOf
public static UUID valueOf(byte[] src, int start)(Code)
Constructs a new UUID instance given a byte array that contains the (16 byte) binary representation. Note that calling this method returns the same result as would using the matching constructor
Parameters:
  src - Byte array that contains the UUID definition
Parameters:
  start - Offset in the array where the UUID starts



valueOf
public static UUID valueOf(byte[] src)(Code)
Constructs a new UUID instance given a byte array that contains the (16 byte) binary representation. Note that calling this method returns the same result as would using the matching constructor
Parameters:
  src - Byte array that contains the UUID definition



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.