UUID.st
author Stefan Vogel <sv@exept.de>
Fri, 13 Aug 2004 15:31:06 +0200
changeset 1467 a394ade68816
parent 1447 210f3ac37991
child 1491 512b21b45a9e
permissions -rw-r--r--
Protect against a nil SequenceNumber
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2002 by eXept Software AG
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"{ Package: 'stx:libbasic2' }"
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
ByteArray variableByteSubclass:#UUID
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	instanceVariableNames:''
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    17
	classVariableNames:'CachedMACAddress Lock SequenceNumber LastTime Increment'
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
1304
1c58aa764724 category
Claus Gittinger <cg@exept.de>
parents: 1287
diff changeset
    19
	category:'Net-Communication-Support'
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!UUID class methodsFor:'documentation'!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 2002 by eXept Software AG
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
              All Rights Reserved
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
"
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    36
!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    37
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    38
documentation
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    39
"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    40
    128-bit Universal Unique Ids (UUIDs) as define by OpenGroup/DCE
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    41
    http://www.opengroup.org/onlinepubs/9629399/apdxa.htm.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    42
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    43
    A UUID is unique in time and space (at least until about Year 3400).
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    44
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    45
    [author:]
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    46
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    47
    [instance variables:]
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    48
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    49
    [class variables:]
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    50
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    51
    [see also:]
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    52
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    53
"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    54
! !
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    55
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    56
!UUID class methodsFor:'initialization'!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    57
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    58
initialize
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    59
    "I want to get informed about image restarts"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    60
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    61
    Lock isNil ifTrue:[
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    62
        Lock := RecursionLock new name:'UUID'.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    63
        LastTime := 0.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    64
        Increment := 0.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    65
        ObjectMemory addDependent:self.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    66
    ]
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    67
!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    68
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    69
update:something with:aParameter from:changedObject
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    70
    "flush cached MAC address (may have been restarted on another host)"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    71
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    72
    (something == #restarted) ifTrue:[
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    73
        CachedMACAddress := nil.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    74
        SequenceNumber := nil.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
    75
    ]
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
! !
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
!UUID class methodsFor:'instance creation'!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
1382
626693b1fed7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    80
fromBytes:aByteArray
626693b1fed7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    81
    ^ self fromBytes:aByteArray msb:(UninterpretedBytes isBigEndian)
626693b1fed7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    82
!
626693b1fed7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
    83
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
fromBytes:aByteArray msb:msb
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    |uuid d1 d2 d3|
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    uuid := self new.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    uuid replaceFrom:1 to:16 with:aByteArray.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    msb ifTrue:[
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
        d1 := aByteArray unsignedLongAt:1 bigEndian:msb.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
        uuid unsignedLongAt:1 put:d1 bigEndian:false.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
        d2 := aByteArray unsignedShortAt:1+4 bigEndian:msb.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
        uuid unsignedShortAt:1+4 put:d2 bigEndian:false.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
        d3 := aByteArray unsignedShortAt:1+4+2 bigEndian:msb.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
        uuid unsignedShortAt:1+4+2 put:d3 bigEndian:false.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    ].
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    ^ uuid
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    "
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
     UUID fromBytes:#[16r01 16r02 16r03 16r04
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
                      16r05 16r06 16r07 16r08
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
                      16r09 16r10 16r11 16r12
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
                      16r13 16r14 16r15 16r16] msb:false. 
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    "
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    "
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
     UUID fromBytes:#[16r01 16r02 16r03 16r04
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
                      16r05 16r06 16r07 16r08
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
                      16r09 16r10 16r11 16r12
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
                      16r13 16r14 16r15 16r16] msb:true.    
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    "
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   117
genUUID
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   118
    "generate a new UUID"
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    ^ self new genUUID
1447
210f3ac37991 *** empty log message ***
penk
parents: 1433
diff changeset
   121
"
210f3ac37991 *** empty log message ***
penk
parents: 1433
diff changeset
   122
    self genUUID
210f3ac37991 *** empty log message ***
penk
parents: 1433
diff changeset
   123
"
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
new
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    ^ super new:16
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
new:size
1320
fc8265f89040 XMLStandardDecoder compatibility
Stefan Vogel <sv@exept.de>
parents: 1304
diff changeset
   131
    "allow creating with exact size. We need this for XMLStandardDecoder"
fc8265f89040 XMLStandardDecoder compatibility
Stefan Vogel <sv@exept.de>
parents: 1304
diff changeset
   132
fc8265f89040 XMLStandardDecoder compatibility
Stefan Vogel <sv@exept.de>
parents: 1304
diff changeset
   133
    size ~~ 16 ifTrue:[
fc8265f89040 XMLStandardDecoder compatibility
Stefan Vogel <sv@exept.de>
parents: 1304
diff changeset
   134
        ^ self shouldNotImplement.
fc8265f89040 XMLStandardDecoder compatibility
Stefan Vogel <sv@exept.de>
parents: 1304
diff changeset
   135
    ].
fc8265f89040 XMLStandardDecoder compatibility
Stefan Vogel <sv@exept.de>
parents: 1304
diff changeset
   136
    ^ super new:size.
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   137
!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   138
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   139
readFrom:aStringOrStream onError:errorBlock
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   140
    |d offs s uuid t byte|
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   141
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   142
    s := aStringOrStream readStream.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   143
    uuid := self new.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   144
    offs := 1.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   145
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   146
    s skipSeparators.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   147
    s peek == ${ ifTrue:[s next].
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   148
    s skipSeparators.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   149
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   150
    t := s next:8.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   151
    d := Integer readFrom:t radix:16 onError:errorBlock.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   152
    uuid unsignedLongAt:1 put:d bigEndian:false.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   153
    offs := offs + 4.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   154
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   155
    s next.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   156
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   157
    1 to:3 do:[:i |
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   158
        t := s next:4.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   159
        d := Integer readFrom:t radix:16 onError:errorBlock.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   160
        uuid unsignedShortAt:offs put:d bigEndian:false.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   161
        offs := offs + 2.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   162
        s next.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   163
    ].
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   164
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   165
    1 to:6 do:[:i |
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   166
        t := s next:2.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   167
        byte := Integer readFrom:t radix:16 onError:errorBlock.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   168
        uuid at:offs put:byte.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   169
        offs := offs + 1.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   170
    ].
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   171
    ^ uuid
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   172
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   173
    "
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   174
     UUID readFrom:'5ab2e9b4-3d48-11d2-9ea4-80c5140aaa77' 
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   175
     UUID fromString:'5ab2e9b4-3d48-11d2-9ea4-80c5140aaa77' 
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   176
    "
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
! !
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
!UUID class methodsFor:'defaults'!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
uuidVersion
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    ^ 1
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
! !
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   186
!UUID class methodsFor:'helpers'!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   187
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   188
getDtssUtcTime
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   189
    "return the DTSS based time in 100 nsec intervals
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   190
     DTSS UTC base time is October 15, 1582.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   191
     Unix base time is January 1, 1970.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   192
     The difference between both is: 16r01B21DD213814000"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   193
1433
47729d4283ef Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 1382
diff changeset
   194
    ^ Timestamp now getMilliseconds * 10000 + 16r01B21DD213814000.
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   195
!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   196
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   197
getValidMACAddress
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   198
    "return the first valid MAC address (i.e. having at least one byte ~~ 0)"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   199
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   200
    CachedMACAddress isNil ifTrue:[
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   201
        |dictOfIf|
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   202
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   203
        dictOfIf := OperatingSystem getNetworkMACAddresses.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   204
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   205
        dictOfIf do:[:macAddress |
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   206
            (macAddress contains:[:byte | byte ~~ 0]) ifTrue:[
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   207
                ^ CachedMACAddress := macAddress
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   208
            ].
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   209
        ].
1287
a49df91aeb78 NEVER return nil uuids
Stefan Vogel <sv@exept.de>
parents: 1214
diff changeset
   210
        self error:'no mac address' mayProceed:true.
a49df91aeb78 NEVER return nil uuids
Stefan Vogel <sv@exept.de>
parents: 1214
diff changeset
   211
        ^ #[16r55 16r55 16r55 16r55 16r55 16r55].
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   212
    ].
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   214
    ^ CachedMACAddress
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   215
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   216
    "
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   217
       CachedMACAddress := nil.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   218
       self getValidMACAddress
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   219
    "
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   220
! !
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   221
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   222
!UUID methodsFor:'accessing'!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   223
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   224
clockSeqAndReserved
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   225
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   226
    ^ self unsignedShortAt:9 bigEndian:false
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   227
!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   228
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   229
node
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   230
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   231
    ^ self copyFrom:10 to:16
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   232
!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   233
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   234
timeHighAndVersion
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   235
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   236
    ^ self unsignedShortAt:7 bigEndian:false
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   237
!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   238
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   239
timeLow
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   240
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   241
    ^ self unsignedLongAt:1 bigEndian:false
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   242
!
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   243
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   244
timeMid
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   245
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   246
    ^ self unsignedShortAt:5 bigEndian:false
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   247
! !
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   248
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
!UUID methodsFor:'converting'!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
1382
626693b1fed7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
   251
asBytes
626693b1fed7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
   252
    ^ self asBytesMSB:(UninterpretedBytes isBigEndian)
626693b1fed7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
   253
!
626693b1fed7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
   254
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
asBytesMSB:msb
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
    |bytes d1 d2 d3|
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
    bytes := ByteArray new:16.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    bytes replaceFrom:1 to:16 with:self.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    msb ifTrue:[
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
        d1 := self unsignedLongAt:1 bigEndian:false.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
        d2 := self unsignedShortAt:1+4 bigEndian:false.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
        d3 := self unsignedShortAt:1+4+2 bigEndian:false.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
        bytes unsignedLongAt:1 put:d1 bigEndian:true.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
        bytes unsignedShortAt:1+4 put:d2 bigEndian:true.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
        bytes unsignedShortAt:1+4+2 put:d3 bigEndian:true.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    ].
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
    ^ bytes
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
! !
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
!UUID methodsFor:'generating uuids'!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
genUUID
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   276
    |macBytes utcTime|
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   278
    macBytes := self class getValidMACAddress.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   280
    "use 60 bit counter of 100ns ticks since 00:00:00 15.oct 1582 (sigh)"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   281
    Lock critical:[
1467
a394ade68816 Protect against a nil SequenceNumber
Stefan Vogel <sv@exept.de>
parents: 1447
diff changeset
   282
        SequenceNumber isNil ifTrue:[
a394ade68816 Protect against a nil SequenceNumber
Stefan Vogel <sv@exept.de>
parents: 1447
diff changeset
   283
            SequenceNumber := Random nextIntegerBetween:0 and:16383.
a394ade68816 Protect against a nil SequenceNumber
Stefan Vogel <sv@exept.de>
parents: 1447
diff changeset
   284
        ].
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   285
        utcTime := self class getDtssUtcTime.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   286
        LastTime < utcTime ifTrue:[
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   287
            Increment := 0.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   288
        ] ifFalse:[
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   289
            LastTime = utcTime ifTrue:[
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   290
                "clock didn't advance since last call. Simply add a tick"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   291
                Increment := Increment + 1.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   292
            ] ifFalse:[
1467
a394ade68816 Protect against a nil SequenceNumber
Stefan Vogel <sv@exept.de>
parents: 1447
diff changeset
   293
                "clock went backwards - increment SequenceNumber"
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   294
                Increment := 0.
1214
7ae6b9302754 Fix previous change
Stefan Vogel <sv@exept.de>
parents: 1213
diff changeset
   295
                SequenceNumber := SequenceNumber + 1.
7ae6b9302754 Fix previous change
Stefan Vogel <sv@exept.de>
parents: 1213
diff changeset
   296
                SequenceNumber >= 16384 ifTrue:[SequenceNumber := 0].
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   297
            ].
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
        ].
1214
7ae6b9302754 Fix previous change
Stefan Vogel <sv@exept.de>
parents: 1213
diff changeset
   299
        
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   300
        LastTime := utcTime.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   301
        utcTime := utcTime + Increment.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
    ].
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   304
    "first 60 bits of timestamp"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   305
    self replaceFrom:1 to:8 with:utcTime digitBytes.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   306
    "multiplex the 4 bit version number in high bits of byte 8"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   307
    self at:8 put:((self at:8) bitOr:(self class uuidVersion bitShift:4)).
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   309
    "2 sequence bytes + reserved bits"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   310
    self at:9  put:(SequenceNumber digitAt:1).
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   311
    self at:10 put:((SequenceNumber digitAt:2) bitOr:2r10000000).
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   312
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   313
    "48 bits of MAC-Address"
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   314
    self replaceFrom:11 to:16 with:macBytes startingAt:1.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
    "
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   317
      self genUUID
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   318
    "
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   320
    "
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   321
      1 to: 100 do:[ : el |
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   322
          Transcript show:el.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   323
          Transcript show:': '.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   324
          Transcript showCR:(UUID genUUID).
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   325
      ].
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   326
    "
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
! !
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
!UUID methodsFor:'printing'!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
displayString
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
    ^ self printString
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
printOn:aStream
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   336
    |offs d tmpStream|
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   338
    tmpStream := '' writeStream.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
    d := self unsignedLongAt:1 bigEndian:false.
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   341
    d printOn:tmpStream base:16 size:8 fill:$0.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   343
    tmpStream nextPut:$-.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   345
    offs := 5.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   346
    3 timesRepeat:[
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
        d := self unsignedShortAt:offs bigEndian:false.
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
        offs := offs + 2.
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   349
        d printOn:tmpStream base:16 size:4 fill:$0.
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   350
        tmpStream nextPut:$-.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
    ].
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
    6 timesRepeat:[
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   354
        d := self at:offs.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
        offs := offs + 1.
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   356
        d printOn:tmpStream base:16 size:2 fill:$0.
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
    ].
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   359
    aStream nextPutAll:(tmpStream contents asLowercase).
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
! !
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
!UUID class methodsFor:'documentation'!
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
version
1467
a394ade68816 Protect against a nil SequenceNumber
Stefan Vogel <sv@exept.de>
parents: 1447
diff changeset
   365
    ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.10 2004-08-13 13:31:06 stefan Exp $'
1188
58856b846271 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
! !
1213
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   367
5a23a433a990 Refactoring
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
   368
UUID initialize!