1 package org.simantics.acorn.internal;
3 import org.simantics.db.service.Bytes;
4 import org.simantics.db.service.ClusterUID;
6 public abstract class ClusterUpdateProcessorBase2 {
8 final private byte[] bytes;
10 final private int len;
11 final private ClusterUID uid;
13 public ClusterUpdateProcessorBase2(byte[] operations) {
14 this.bytes = operations;
15 this.len = Bytes.readLE4(bytes, 0) + 4; // whatta?
16 int version = Bytes.readLE4(bytes, 4);
17 assert(version == ClusterChange2.VERSION);
18 long cuid1 = Bytes.readLE8(bytes, 8);
19 long cuid2 = Bytes.readLE8(bytes, 16);
21 uid = ClusterUID.make(cuid1, cuid2);
24 public ClusterUID getClusterUID() {
28 private void processSetImmutable(int op) {
29 int value = bytes[pos++]&0xff;
30 setImmutable(value > 0);
33 private void processUndoValue(int op) {
34 Bytes.readLE4(bytes, pos);
38 public void process() {
42 int op = bytes[pos++]&0xff;
46 case ClusterChange2.SET_IMMUTABLE_OPERATION:
47 processSetImmutable(op);
49 case ClusterChange2.UNDO_VALUE_OPERATION:
53 throw new IllegalStateException();
61 abstract void setImmutable(boolean value);