01
/**//* Copyright (C) 2008 db4objects Inc. http://www.db4o.com */
02
03
package com.db4odoc.tp.rollback;
04
05
import com.db4o.activation.ActivationPurpose;
06
import com.db4o.activation.Activator;
07
import com.db4o.ta.Activatable;
08
09
public class Id implements Activatable ...{
10
int number = 0;
11
12
transient Activator _activator;
13
14
public Id(int number)...{
15
this.number = number;
16
}
17
18
public void bind(Activator activator) ...{
19
if (_activator == activator) ...{
20
return;
21
}
22
if (activator != null && _activator != null) ...{
23
throw new IllegalStateException();
24
}
25
_activator = activator;
26
}
27
28
public void activate(ActivationPurpose purpose) ...{
29
if (_activator == null)
30
return;
31
_activator.activate(purpose);
32
}
33
34
35
public String toString()...{
36
activate(ActivationPurpose.READ);
37
return String.valueOf(number);
38
}
39
40
public void change(int i) ...{
41
activate(ActivationPurpose.WRITE);
42
this.number = i;
43
}
44
}